Function: project-uniquify-dirname-transform

project-uniquify-dirname-transform is an autoloaded and byte-compiled function defined in project.el.gz.

Signature

(project-uniquify-dirname-transform DIRNAME)

Documentation

Uniquify name of directory DIRNAME using project-name, if in a project.

If you set uniquify-dirname-transform to this function, slash-separated components from project-name will be appended to the buffer's directory name when buffers from two different projects would otherwise have the same name.

Probably introduced at or before Emacs version 30.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/project.el.gz
;;;###autoload
(defun project-uniquify-dirname-transform (dirname)
  "Uniquify name of directory DIRNAME using `project-name', if in a project.

If you set `uniquify-dirname-transform' to this function,
slash-separated components from `project-name' will be appended to
the buffer's directory name when buffers from two different projects
would otherwise have the same name."
  (if-let (proj (project-current nil dirname))
      (let ((root (project-root proj)))
        (expand-file-name
         (file-name-concat
          (file-name-directory root)
          (project-name proj)
          (file-relative-name dirname root))))
    dirname))