;;; uniquify.el --- unique buffer names dependent on file name -*- lexical-binding: t -*-
-;; Copyright (C) 1989, 1995-1997, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1995-1997, 2001-2016 Free Software Foundation,
+;; Inc.
;; Author: Dick King <king@reasoning.com>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: files
;; Created: 15 May 86
;; Package: emacs
;;; Commentary:
-;; Emacs's standard method for making buffer names unique adds <2>, <3>,
+;; Emacs's traditional method for making buffer names unique adds <2>, <3>,
;; etc. to the end of (all but one of) the buffers. This file replaces
;; that behavior, for buffers visiting files and dired buffers, with a
;; uniquification that adds parts of the file name until the buffer names
:group 'files)
-(defcustom uniquify-buffer-name-style nil
- "If non-nil, buffer names are uniquified with parts of directory name.
-The value determines the buffer name style and is one of `forward',
-`reverse', `post-forward', or `post-forward-angle-brackets'.
-For example, files `/foo/bar/mumble/name' and `/baz/quux/mumble/name'
+(defcustom uniquify-buffer-name-style 'post-forward-angle-brackets
+ "How to construct unique buffer names for files with the same base name.
+The value can be one of: `forward', `reverse', `post-forward',
+`post-forward-angle-brackets', or nil.
+
+For example, the files `/foo/bar/mumble/name' and `/baz/quux/mumble/name'
would have the following buffer names in the various styles:
- forward bar/mumble/name quux/mumble/name
- reverse name\\mumble\\bar name\\mumble\\quux
- post-forward name|bar/mumble name|quux/mumble
- post-forward-angle-brackets name<bar/mumble> name<quux/mumble>
- nil name name<2>
-Of course, the \"mumble\" part may be stripped as well, depending on the setting
-of `uniquify-strip-common-suffix'."
+
+ forward bar/mumble/name quux/mumble/name
+ reverse name\\mumble\\bar name\\mumble\\quux
+ post-forward name|bar/mumble name|quux/mumble
+ post-forward-angle-brackets name<bar/mumble> name<quux/mumble>
+ nil name name<2>
+
+The \"mumble\" part may be stripped as well, depending on the
+setting of `uniquify-strip-common-suffix'. For more options that
+you can set, browse the `uniquify' custom group."
:type '(radio (const forward)
(const reverse)
(const post-forward)
(const post-forward-angle-brackets)
- (const :tag "standard Emacs behavior (nil)" nil))
- :require 'uniquify
- :group 'uniquify)
+ (const :tag "numeric suffixes" nil))
+ :version "24.4"
+ :require 'uniquify)
(defcustom uniquify-after-kill-buffer-p t
"If non-nil, rerationalize buffer names after a buffer has been killed."
- :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
- :group 'uniquify)
+ :type 'boolean)
;; 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)
- :group 'uniquify)
+ :type '(choice (const :tag "Uniquify all buffers" nil) regexp))
(defcustom uniquify-min-dir-content 0
"Minimum number of directory name components included in buffer name."
- :type 'integer
- :group 'uniquify)
+ :type 'integer)
(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)
- :group 'uniquify)
+ :type '(choice (const nil) string))
(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
- :group 'uniquify)
+ :type 'boolean)
(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
- :group 'uniquify)
+ :type 'boolean)
(defvar uniquify-list-buffers-directory-modes '(dired-mode cvs-mode vc-dir-mode)
"List of modes for which uniquify should obey `list-buffers-directory'.