bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62548: [PATCH] project.el: Use project-name to calculate prefixed bu


From: Dmitry Gutov
Subject: bug#62548: [PATCH] project.el: Use project-name to calculate prefixed buffer name
Date: Sun, 9 Apr 2023 04:54:02 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

Version: 30.1

On 30/03/2023 23:26, Spencer Baugh wrote:
My apologies, my first patch was buggy.  A working patch follows.

* lisp/progmodes/project.el (project-prefixed-buffer-name):
Use project-name to calculate prefixed buffer name
(project-compilation-buffer-name-function):
Update doc.
---
  lisp/progmodes/project.el | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 11228226592..877d79353aa 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1248,8 +1248,10 @@ compilation-read-command
(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 @@ project-compilation-buffer-name-function
    :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")))

Thanks! I've pushed it to master.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]