Variable: uniquify-dirname-transform

uniquify-dirname-transform is a customizable variable defined in uniquify.el.gz.

Value

identity

Documentation

Function to transform buffer's directory name when uniquifying buffer's name.

When uniquify-buffer-name-style is non-nil, Emacs makes buffer names unique by adding components of the buffer's directory name until the resulting name is unique. This function is used to transform the buffer's directory name during this uniquifying process, allowing the unique buffer name to include strings from sources other than the buffer's directory. The default is identity, so the unmodified buffer's directory name is used for uniquifying.

This function is called with the buffer's directory name and should return a string which names a file (that does not need to actually exist in the filesystem); the components of this file name will then be used to uniquify the buffer's name.

To include components from the project-name of the buffer, set this variable to project-uniquify-dirname-transform.

This variable was added, or its default value changed, in Emacs 30.1.

Probably introduced at or before Emacs version 30.1.

Source Code

;; Defined in /usr/src/emacs/lisp/uniquify.el.gz
(defcustom uniquify-dirname-transform #'identity
  "Function to transform buffer's directory name when uniquifying buffer's name.

When `uniquify-buffer-name-style' is non-nil, Emacs makes buffer
names unique by adding components of the buffer's directory name
until the resulting name is unique.  This function is used to
transform the buffer's directory name during this uniquifying
process, allowing the unique buffer name to include strings
from sources other than the buffer's directory.  The default is
`identity', so the unmodified buffer's directory name is used for
uniquifying.

This function is called with the buffer's directory name and
should return a string which names a file (that does not need to
actually exist in the filesystem); the components of this file
name will then be used to uniquify the buffer's name.

To include components from the `project-name' of the buffer, set
this variable to `project-uniquify-dirname-transform'."
  :type `(choice (function-item :tag "Use directory name as-is" identity)
                 (function-item :tag "Include project name in directory name"
                                ,#'project-uniquify-dirname-transform)
                 function)
  :version "30.1"
  :group 'uniquify)