]> git.eshelyaron.com Git - emacs.git/commitdiff
project.el: Use project-name to calculate prefixed buffer name
authorSpencer Baugh <sbaugh@janestreet.com>
Sun, 9 Apr 2023 01:50:20 +0000 (04:50 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 9 Apr 2023 01:51:37 +0000 (04:51 +0300)
* lisp/progmodes/project.el (project-prefixed-buffer-name):
Use project-name to calculate prefixed buffer name (bug#62548).
(project-compilation-buffer-name-function): Update doc.

lisp/progmodes/project.el

index 11228226592bd1940e5c0abeca2e8deddb97f67b..877d79353aa7bda075b688e6aa156db65d3097a3 100644 (file)
@@ -1248,8 +1248,10 @@ If you exit the `query-replace', you can later continue the
 
 (defun project-prefixed-buffer-name (mode)
   (concat "*"
-          (file-name-nondirectory
-           (directory-file-name default-directory))
+          (if-let ((proj (project-current nil)))
+              (project-name proj)
+            (file-name-nondirectory
+             (directory-file-name default-directory)))
           "-"
           (downcase mode)
           "*"))
@@ -1261,7 +1263,7 @@ If non-nil, it overrides `compilation-buffer-name-function' for
   :version "28.1"
   :group 'project
   :type '(choice (const :tag "Default" nil)
-                 (const :tag "Prefixed with root directory name"
+                 (const :tag "Prefixed with project name"
                         project-prefixed-buffer-name)
                  (function :tag "Custom function")))