GNU bug report logs - #62548
[PATCH] project.el: Use project-name to calculate prefixed buffer name

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Thu, 30 Mar 2023 18:37:01 UTC

Severity: normal

Tags: patch

Fixed in version 30.1

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62548 in the body.
You can then email your comments to 62548 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#62548; Package emacs. (Thu, 30 Mar 2023 18:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Spencer Baugh <sbaugh <at> janestreet.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 30 Mar 2023 18:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] project.el: Use project-name to calculate prefixed buffer name
Date: Thu, 30 Mar 2023 14:35:53 -0400
[Message part 1 (text/plain, inline)]
Tags: patch


project.el: Use project-name to calculate prefixed buffer name.  This
makes the name more easily customizable and works better for projects
which don't have a meaningful last directory component.


In GNU Emacs 29.0.60 (build 3, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2023-03-13 built on
 igm-qws-u22796a
Repository revision: e759905d2e0828eac4c8164b09113b40f6899656
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: CentOS Linux 7 (Core)

Configured using:
 'configure --with-x-toolkit=lucid --with-modules
 --with-gif=ifavailable'

[0001-Use-project-name-to-calculate-prefixed-buffer-name.patch (text/patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62548; Package emacs. (Thu, 30 Mar 2023 20:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 62548 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: 62548 <at> debbugs.gnu.org
Subject: Re: bug#62548: [PATCH] project.el: Use project-name to calculate
 prefixed buffer name
Date: Thu, 30 Mar 2023 16:26:33 -0400
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")))
 
-- 
2.30.2




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Sun, 09 Apr 2023 01:55:02 GMT) Full text and rfc822 format available.

Notification sent to Spencer Baugh <sbaugh <at> janestreet.com>:
bug acknowledged by developer. (Sun, 09 Apr 2023 01:55:02 GMT) Full text and rfc822 format available.

Message #13 received at 62548-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Spencer Baugh <sbaugh <at> janestreet.com>, 62548-done <at> debbugs.gnu.org
Subject: Re: bug#62548: [PATCH] project.el: Use project-name to calculate
 prefixed buffer name
Date: Sun, 9 Apr 2023 04:54:02 +0300
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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 May 2023 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 40 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.