;;; uniquify.el --- unique buffer names dependent on file name
-;; Copyright (c) 1989,95,96,97,2001,2003 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1995, 1996, 1997, 2001, 2002, 2003,
+;; 2004, 2005 Free Software Foundation, Inc.
;; Author: Dick King <king@reasoning.com>
;; Maintainer: FSF
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;;; User-visible variables
(defgroup uniquify nil
- "Unique buffer names dependent on file name"
+ "Unique buffer names dependent on file name."
:group 'applications)
(const post-forward)
(const post-forward-angle-brackets)
(const :tag "standard Emacs behavior (nil)" nil))
- :require 'uniquify)
+ :require 'uniquify
+ :group 'uniquify)
(defcustom uniquify-after-kill-buffer-p t
"If non-nil, rerationalize buffer names after a buffer has been killed."
- :type 'boolean)
+ :type 'boolean
+ :group 'uniquify)
(defcustom uniquify-ask-about-buffer-names-p nil
"*If non-nil, permit user to choose names for buffers with same base file.
If the user chooses to name a buffer, uniquification is preempted and no
other buffer names are changed."
- :type 'boolean)
+ :type 'boolean
+ :group 'uniquify)
;; The default value matches certain Gnus buffers.
(defcustom uniquify-ignore-buffers-re nil
For instance, set this to \"^draft-[0-9]+$\" to avoid having uniquify rename
draft buffers even if `uniquify-after-kill-buffer-p' is non-nil and the
visited file name isn't the same as that of the buffer."
- :type '(choice (const :tag "Uniquify all buffers" nil) regexp))
+ :type '(choice (const :tag "Uniquify all buffers" nil) regexp)
+ :group 'uniquify)
(defcustom uniquify-min-dir-content 0
"*Minimum number of directory name components included in buffer name."
- :type 'integer)
+ :type 'integer
+ :group 'uniquify)
(defcustom uniquify-separator nil
"*String separator for buffer name components.
base file name from directory part in buffer names (default \"|\").
When `uniquify-buffer-name-style' is `reverse', separates all
file name components (default \"\\\")."
- :type '(choice (const nil) string))
+ :type '(choice (const nil) string)
+ :group 'uniquify)
(defcustom uniquify-trailing-separator-p nil
"*If non-nil, add a file name separator to dired buffer names.
If `uniquify-buffer-name-style' is `forward', add the separator at the end;
if it is `reverse', add the separator at the beginning; otherwise, this
variable is ignored."
- :type 'boolean)
+ :type 'boolean
+ :group 'uniquify)
(defcustom uniquify-strip-common-suffix
;; Using it when uniquify-min-dir-content>0 doesn't make much sense.
E.g. if you open /a1/b/c/d and /a2/b/c/d, the buffer names will say
\"d|a1\" and \"d|a2\" instead of \"d|a1/b/c\" and \"d|a2/b/c\".
This can be handy when you have deep parallel hierarchies."
- :type 'boolean)
+ :type 'boolean
+ :group 'uniquify)
(defvar uniquify-list-buffers-directory-modes '(dired-mode cvs-mode)
"List of modes for which uniquify should obey `list-buffers-directory'.
If `uniquify-min-dir-content' > 0, always pulls that many
file name elements.
Arguments BASE, DIRNAME, and NEWBUF specify the new buffer that causes
-this rationaliztion."
- (if (null dirname)
- (with-current-buffer newbuf (setq uniquify-managed nil))
+this rationalization."
+ (interactive
+ (list (if uniquify-managed
+ (uniquify-item-base (car uniquify-managed)) (buffer-name))
+ (uniquify-buffer-file-name (current-buffer))
+ (current-buffer)))
+ ;; Make sure we don't get confused by outdated uniquify-managed info in
+ ;; this buffer.
+ (with-current-buffer newbuf (setq uniquify-managed nil))
+ (when dirname
(setq dirname (expand-file-name (directory-file-name dirname)))
(let ((fix-list (list (uniquify-make-item base dirname newbuf)))
items)
(provide 'uniquify)
-;;; arch-tag: e763faa3-56c9-4903-8eb8-26e1c45a0065
+;; arch-tag: e763faa3-56c9-4903-8eb8-26e1c45a0065
;;; uniquify.el ends here