From unknown Mon Jun 16 23:41:59 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#62548 <62548@debbugs.gnu.org> To: bug#62548 <62548@debbugs.gnu.org> Subject: Status: [PATCH] project.el: Use project-name to calculate prefixed buffer name Reply-To: bug#62548 <62548@debbugs.gnu.org> Date: Tue, 17 Jun 2025 06:41:59 +0000 retitle 62548 [PATCH] project.el: Use project-name to calculate prefixed bu= ffer name reassign 62548 emacs submitter 62548 Spencer Baugh severity 62548 normal tag 62548 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 30 14:36:02 2023 Received: (at submit) by debbugs.gnu.org; 30 Mar 2023 18:36:02 +0000 Received: from localhost ([127.0.0.1]:59432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phx7y-0007Vo-5S for submit@debbugs.gnu.org; Thu, 30 Mar 2023 14:36:02 -0400 Received: from lists.gnu.org ([209.51.188.17]:44576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phx7w-0007VP-P1 for submit@debbugs.gnu.org; Thu, 30 Mar 2023 14:36:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phx7w-0003l8-A2 for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 14:36:00 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phx7s-0000BS-E4 for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 14:36:00 -0400 From: Spencer Baugh To: bug-gnu-emacs@gnu.org Subject: [PATCH] project.el: Use project-name to calculate prefixed buffer name Date: Thu, 30 Mar 2023 14:35:53 -0400 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain 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' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Use-project-name-to-calculate-prefixed-buffer-name.patch >From 2141d988d376cfd6a572a86c77346815c45cc686 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 30 Mar 2023 14:34:29 -0400 Subject: [PATCH] Use project-name to calculate prefixed buffer name * lisp/progmodes/project.el (project-prefixed-buffer-name): (project-shell): (project-eshell): Use project-name to calculate prefixed buffer name (project-compilation-buffer-name-function): Update doc. --- lisp/progmodes/project.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 11228226592..6d058edf878 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1165,8 +1165,9 @@ project-shell if one already exists." (interactive) (require 'comint) - (let* ((default-directory (project-root (project-current t))) - (default-project-shell-name (project-prefixed-buffer-name "shell")) + (let* ((pr (project-current t)) + (default-directory (project-root pr)) + (default-project-shell-name (project-prefixed-buffer-name pr "shell")) (shell-buffer (get-buffer default-project-shell-name))) (if (and shell-buffer (not current-prefix-arg)) (if (comint-check-proc shell-buffer) @@ -1183,8 +1184,9 @@ project-eshell if one already exists." (interactive) (defvar eshell-buffer-name) - (let* ((default-directory (project-root (project-current t))) - (eshell-buffer-name (project-prefixed-buffer-name "eshell")) + (let* ((pr (project-current t)) + (default-directory (project-root pr)) + (eshell-buffer-name (project-prefixed-buffer-name pr "eshell")) (eshell-buffer (get-buffer eshell-buffer-name))) (if (and eshell-buffer (not current-prefix-arg)) (pop-to-buffer eshell-buffer (bound-and-true-p display-comint-buffer-action)) @@ -1246,10 +1248,9 @@ project-query-replace-regexp (defvar compilation-read-command) (declare-function compilation-read-command "compile") -(defun project-prefixed-buffer-name (mode) +(defun project-prefixed-buffer-name (pr mode) (concat "*" - (file-name-nondirectory - (directory-file-name default-directory)) + (project-name pr) "-" (downcase mode) "*")) @@ -1261,7 +1262,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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 30 16:26:40 2023 Received: (at 62548) by debbugs.gnu.org; 30 Mar 2023 20:26:41 +0000 Received: from localhost ([127.0.0.1]:59521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phyr2-0004OV-Lv for submit@debbugs.gnu.org; Thu, 30 Mar 2023 16:26:40 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:41951) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phyr1-0004OJ-6u for 62548@debbugs.gnu.org; Thu, 30 Mar 2023 16:26:39 -0400 From: Spencer Baugh To: 62548@debbugs.gnu.org Subject: Re: bug#62548: [PATCH] project.el: Use project-name to calculate prefixed buffer name In-Reply-To: (Spencer Baugh's message of "Thu, 30 Mar 2023 14:35:53 -0400") References: Date: Thu, 30 Mar 2023 16:26:33 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 62548 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 08 21:54:17 2023 Received: (at 62548-done) by debbugs.gnu.org; 9 Apr 2023 01:54:17 +0000 Received: from localhost ([127.0.0.1]:59952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plKG1-00005m-6y for submit@debbugs.gnu.org; Sat, 08 Apr 2023 21:54:17 -0400 Received: from mail-wm1-f42.google.com ([209.85.128.42]:51765) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plKFv-00005A-F7 for 62548-done@debbugs.gnu.org; Sat, 08 Apr 2023 21:54:15 -0400 Received: by mail-wm1-f42.google.com with SMTP id l16so712323wms.1 for <62548-done@debbugs.gnu.org>; Sat, 08 Apr 2023 18:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681005245; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=x7tDIuiixdbryn/JZCqntek5PY6GoThmiiBuo34n2Q8=; b=UK+vgjWQecNTIyKodd1ctBEMFMTZipid6gm0hP9QVbfcdAzZJxFBHzY27EtUlsjnB2 wNVJktJnPhpWhEoaB9W7yfIA/EEAia60wTT/vcS5cCGIJDy4uG796eZ+dFpfhv3jl1Oo vGpns/zpA067ADSWjP/Qniwk6FZ5i2iOGdbhqA+nb7Sohez8tKKm5xydxSL/5UcOi8GS URyfIzoC3Deac92b1L/HTVZXp6MAGMo1FA+aHnyvD6dhPPwBN6VYd0npKmooxSUkwBEf kjWjGh/yc1yWEZEp2TekskKJwa/CtIH3m7K1KP02++yD7mba/3CdHQz8rn1JapeBhEB5 6MIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681005245; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=x7tDIuiixdbryn/JZCqntek5PY6GoThmiiBuo34n2Q8=; b=wH9t+bDt5WlSKD/VzQCpfgkxSmhI73JN1CbxnqFArwVWML16Ge431MySvEyr0gZ/4E rV3Ll61gMxHRIsTA/Gm28/WdFJC1ItJieNqnMwhoMGinl/CZBiuOkL/EcNKd1+uYdAHc O531jvB1Fx8Cswm1/kqbPuKhdatYfYua5T59W+Me0K6t4jXyaEMcrFnlP120Efb7bnlX GPuMO4xf8c73tONS4umIXmTXl6+a9ZzY8oMwkHyZgtyGBzV6BqMNdNqbRbWNcNO/47IH euNaeFnwQG5yudt4me2dLlDPRZgFhS38zWwxquxaA2mzO2B6eTpLDkqDLTcSdrm6bcND 0QVQ== X-Gm-Message-State: AAQBX9dPjd9qEuBKa/oH9DWWHU7Q04WwS83ZXs2Ob43GKusmhslIrwmq IqP6dAlcvDLEspYeP9qd0pY= X-Google-Smtp-Source: AKy350b46j2CP4MsiVi/s3iMnLQ9L0vfInBfxbi1i34rSWqgdeqeB27QYIwa68xPEaBmKtr0QG5z6w== X-Received: by 2002:a1c:4b04:0:b0:3ed:253c:621b with SMTP id y4-20020a1c4b04000000b003ed253c621bmr4767141wma.21.1681005245345; Sat, 08 Apr 2023 18:54:05 -0700 (PDT) Received: from [192.168.0.2] ([85.132.229.92]) by smtp.googlemail.com with ESMTPSA id r13-20020a05600c458d00b003f07ddfc3dfsm6497902wmo.3.2023.04.08.18.54.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Apr 2023 18:54:04 -0700 (PDT) Message-ID: Date: Sun, 9 Apr 2023 04:54:02 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: bug#62548: [PATCH] project.el: Use project-name to calculate prefixed buffer name Content-Language: en-US To: Spencer Baugh , 62548-done@debbugs.gnu.org References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: 62548-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) 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. From unknown Mon Jun 16 23:41:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 07 May 2023 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator