From unknown Fri Sep 19 22:48:05 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#76500 <76500@debbugs.gnu.org> To: bug#76500 <76500@debbugs.gnu.org> Subject: Status: [PATCH] Allow numbered buffer selection for project shell commands Reply-To: bug#76500 <76500@debbugs.gnu.org> Date: Sat, 20 Sep 2025 05:48:05 +0000 retitle 76500 [PATCH] Allow numbered buffer selection for project shell com= mands reassign 76500 emacs submitter 76500 Paul Nelson severity 76500 wishlist tag 76500 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 23 06:15:40 2025 Received: (at submit) by debbugs.gnu.org; 23 Feb 2025 11:15:41 +0000 Received: from localhost ([127.0.0.1]:59567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tm9xU-0008Kt-Ah for submit@debbugs.gnu.org; Sun, 23 Feb 2025 06:15:40 -0500 Received: from lists.gnu.org ([2001:470:142::17]:51960) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tm9xS-0008Kc-7q for submit@debbugs.gnu.org; Sun, 23 Feb 2025 06:15:39 -0500 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 1tm9xK-0002UD-0a for bug-gnu-emacs@gnu.org; Sun, 23 Feb 2025 06:15:30 -0500 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tm9xH-0002Cn-Nf for bug-gnu-emacs@gnu.org; Sun, 23 Feb 2025 06:15:29 -0500 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5452efeb87aso3575076e87.3 for ; Sun, 23 Feb 2025 03:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740309322; x=1740914122; darn=gnu.org; h=mime-version:date:message-id:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Q34uuHOXBReTgPJfveM2Qs8ofpxlJm1MBhFdmy9WHUE=; b=VTfKy5S83C2GDI0xyZyUy8iipd9RBbOZtqeLlQtNTnt1S31ZDqdX98QY7L8dACluGe fsM9Gw1UW0E/jtyau3s9+LK+SqdtTYfuMpBDrPSUFz/dqvwobAsMwWsF98nm/TtHXFAI qyh59dgHg48wBC3+cWarUKgeoF18r+WlP1QdcGZMjIhSie/5LhbdLKp9TsaTwcGwr316 mgWTnr/WwzMjLrRsiUgelsjULHDyURpBLcpsNfbSi1uVfoMn5Et9ncWqh/96N5ucl9g7 sGvGtcu+W4Q4WVw+5rX6FgQTCv8HudprQw7C/AkkVaWtF6cDkOTrzEtc+THE2iiuXS2a 0Rqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740309322; x=1740914122; h=mime-version:date:message-id:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Q34uuHOXBReTgPJfveM2Qs8ofpxlJm1MBhFdmy9WHUE=; b=NVMnW5Ctban8p62/ypACyPT/cbO4rty7GziSGE6TCpi/Ch0W2LJYxpV4McJVFnfSoJ a5hbnU/7jCibBDqGqUfAWSoD8p5wl4hcHVXFSRFZpHPaXM86s7z16RPo5MIfF4BeUh9A rfPvPOOBxUvDcR6j6B9qrWA+B4qOP1wYZolSZQPUfveOqBPsQWTQg0UJbdNlunL1j9TF aXbT8nTTyNJbc5LXEfFNlgWfnAfj5nROYp0GaZ8WFO/rPCITfhIvsk3lx35po8DggjgF SGbGD4aCte0jz7rRfg1t8nF2elQEmeX6tBgBj0be7I9QPsp80noYRRZZx4x/X8oWGibz uJNw== X-Gm-Message-State: AOJu0YyjaSEMB2130nZ2UCPYiqjh0fY4ZmixO3YXIdi3n4Wgo5n57ju2 YIx2kyxu6lgeCcQvGmT8YTbZhohOW+Q9TyOTpBSDDSflcon8OnxVx38le+pW X-Gm-Gg: ASbGncuXq22rlAuSc7xzte3P1Nd3ava+7HYaUgKs7wmQ4P8aD2NSBY0cBBYc5YjVY+s IYZRzS8NO97T2kmqcqNOiODTFRw8x80VodijLZFYatsiS7cvSR8UKt9a3OD3ryoxl8iCfKMwjYJ lx+7j2uvYucXgT3EqXCO6qkGo55GRiRvcFKqvPn3j2xvhduszwwckvTjPmSGl6APBB1nxHAZsmH PKXZz0h+S+Rjdmfqq2d7dMrMVkR+gw6qzNaKWll20dSaskch4cew5csP+UhYOPFap/KYyLy+jCj c6G+KF0RWI66JFCpyOo0IHcWbm9A5Vpnrr/23qm/yyawnVCp2SE9R995Rt+e3HUkxgE= X-Google-Smtp-Source: AGHT+IGl1ZpZFH/+TnAFJQOskBG14BTbwLqEDGe9NEi8dHNQ3HDCclwqzm4KPpozwvuJBYoJQ8R5Ew== X-Received: by 2002:a05:6512:1307:b0:545:2a7f:8f79 with SMTP id 2adb3069b0e04-54838ef04b8mr4483679e87.16.1740309321961; Sun, 23 Feb 2025 03:15:21 -0800 (PST) Received: from localhost (0x573d6745.static.cust.fastspeed.dk. [87.61.103.69]) by smtp.gmail.com with UTF8SMTPSA id 2adb3069b0e04-54839796e66sm649805e87.106.2025.02.23.03.15.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2025 03:15:20 -0800 (PST) From: Paul Nelson To: bug-gnu-emacs@gnu.org Subject: [PATCH] Allow numbered buffer selection for project shell commands Message-ID: X-Debbugs-Cc: Date: Sun, 23 Feb 2025 12:15:18 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=ultrono@gmail.com; helo=mail-lf1-x129.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) 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: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This patch for project.el adds numeric prefix buffer naming to the project-shell and project-eshell commands, aligning their behavior with that of eshell. Without any prefix, these commands switch to or create a shell session. With a plain C-u, the current behavior is to create a new session with an automatically generated numeric suffix (e.g. "*foo-shell<2>*"), but after switching away from that buffer, there=E2=80=99s no convenient way to switch back. This patch changes that: when given a numeric prefix (e.g. C-2), the command will switch to or create the session buffer with the corresponding suffix. Implementation notes: - project-eshell: The current implementation duplicates some functionality provided by eshell. By removing this redundancy, the numeric prefix behavior is inherited "for free". - project-shell: The revised implementation borrows from that of eshell. Any comments or feedback would be welcome. Thanks, best, Paul --=-=-= Content-Type: text/plain Content-Disposition: inline >From 73bb69e0c473668d9d10b5345963f707b8c0dc46 Mon Sep 17 00:00:00 2001 From: Paul Nelson Date: Fri, 21 Feb 2025 11:49:46 +0100 Subject: [PATCH] Allow numbered buffer selection for project shell commands * project.el (project-shell, project-eshell): When a numeric prefix is supplied (e.g. C-2), the command will switch to or create a session buffer whose name is suffixed with that number, e.g. "*name-of-project-shell<2>*". As before, a plain universal argument C-u creates a new session with an automatically generated numeric suffix. This change makes the behavior consistent with eshell's handling of numeric prefixes. * etc/NEWS: Announce the change. --- etc/NEWS | 7 +++++++ lisp/progmodes/project.el | 36 +++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 82a653c4e1e..2b4efa41488 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -302,6 +302,13 @@ It can be used when switching between projects with similar file trees (such as Git worktrees of the same repository). It supports being invoked standalone or from the 'project-switch-commands' dispatch menu. +--- +*** 'project-shell' and 'project-eshell' support numeric prefix buffer naming. +They now accept numeric prefix arguments to select or create numbered +shell sessions. For example, 'C-2 C-x p s' switches to or creates a +buffer named "*name-of-project-shell<2>*". By comparison, a plain +universal argument as in 'C-u C-x p s' always creates a new session. + ** Registers *** New functions 'buffer-to-register' and 'file-to-register'. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 35bf66c9ffb..04c202a6232 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1397,36 +1397,46 @@ project-shell "Start an inferior shell in the current project's root directory. If a buffer already exists for running a shell in the project's root, switch to it. Otherwise, create a new shell buffer. -With \\[universal-argument] prefix arg, create a new inferior shell buffer even -if one already exists." + +With a nonnumeric prefix arg, create a new inferior shell buffer even if +one already exists. + +With a numeric prefix arg, switch to the session with that number, or +create it if it doesn't already exist." (interactive) (require 'comint) (let* ((default-directory (project-root (project-current t))) - (default-project-shell-name (project-prefixed-buffer-name "shell")) - (shell-buffer (get-buffer default-project-shell-name))) + (base-name (project-prefixed-buffer-name "shell")) + (shell-buffer-name + (cond ((numberp current-prefix-arg) + (format "%s<%d>" base-name current-prefix-arg)) + (current-prefix-arg + (generate-new-buffer-name base-name)) + (t base-name))) + (shell-buffer (get-buffer shell-buffer-name))) (if (and shell-buffer (not current-prefix-arg)) (if (comint-check-proc shell-buffer) (pop-to-buffer shell-buffer (append display-buffer--same-window-action '((category . comint)))) (shell shell-buffer)) - (shell (generate-new-buffer-name default-project-shell-name))))) + (shell shell-buffer-name)))) ;;;###autoload (defun project-eshell () "Start Eshell in the current project's root directory. If a buffer already exists for running Eshell in the project's root, switch to it. Otherwise, create a new Eshell buffer. -With \\[universal-argument] prefix arg, create a new Eshell buffer even -if one already exists." + +With a nonnumeric prefix arg, create a new Eshell buffer even if one +already exists. + +With a numeric prefix arg, switch to the session with that number, or +create it if it doesn't already exist." (interactive) (defvar eshell-buffer-name) (let* ((default-directory (project-root (project-current t))) - (eshell-buffer-name (project-prefixed-buffer-name "eshell")) - (eshell-buffer (get-buffer eshell-buffer-name))) - (if (and eshell-buffer (not current-prefix-arg)) - (pop-to-buffer eshell-buffer (append display-buffer--same-window-action - '((category . comint)))) - (eshell t)))) + (eshell-buffer-name (project-prefixed-buffer-name "eshell"))) + (eshell current-prefix-arg))) ;;;###autoload (defun project-async-shell-command () -- 2.39.3 (Apple Git-145) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 24 16:50:18 2025 Received: (at control) by debbugs.gnu.org; 24 Feb 2025 21:50:19 +0000 Received: from localhost ([127.0.0.1]:43130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tmgLC-0002VH-D5 for submit@debbugs.gnu.org; Mon, 24 Feb 2025 16:50:18 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:59580) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tmgL8-0002Qf-0P for control@debbugs.gnu.org; Mon, 24 Feb 2025 16:50:14 -0500 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5dec996069aso7911051a12.2 for ; Mon, 24 Feb 2025 13:50:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740433808; x=1741038608; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=ZnYcaescRx9NKQeLUmiWPEl8yU5+0EiBJ7dIgn0tkvE=; b=RJwb4yI8wbw5l4vRhaluWOPsTUcNY0NaPA//bAy+d2fbzYwuaUWFgkrzS1o50mf1g7 nhMOcLBODXW23j8JS382TAwA7uB3svRXlPXlbvaqVLjBgKnc75hg5fG5Uk3R8+tPIKno /MGu8eCn5nV92qxIbvXRGUHROys40fM7LPXKbN8he1RRsib4byq4FaPulicL1gxMjFTh 6ZW7WZg9x3uFdyK1u2I3YZ0+wVLuRo1IYgaLF2uuCDm314aSbNKjoYkKCMc9HMjoL9x5 rKuVUC+Lid4tiYRYj3SAISawsiW9mxS0uTvGQnBjWh4lhSvvBiihdVV6OA0kQqc3DSUp zyug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740433808; x=1741038608; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZnYcaescRx9NKQeLUmiWPEl8yU5+0EiBJ7dIgn0tkvE=; b=ETlYh/PMiD7D9m3To4KmSTfude75c8DaGqdovxBmEHx65J0jj4Fvlmb7mmujjSExVV IJhXS70LCt/XsatSlnYVzX4vP9jpcaQcAUgcCMNAZRy+/V3NyqKeBKlZExdaOa/SIJFz vziK78eBo3ew51jc19pUBPXaMv72wIOTHgGBvBuGRNrisb1avQ8n78Tg98kOlDyyQLdR wGP8QzgAHbU9MqGaVGZkIM8RBX/OtDw4PsMVqT3+OWwW5tLZBjk5z+s480yZNEnvF1mB nUd91bjlKJaIdgBmt+wLgRiYnTfMxgRnVSsU9BcFEfR5ldubB249orBU1mHVX222Y79n FycA== X-Gm-Message-State: AOJu0YzyNs87/zqmmQoFeZ+dEks3sbOliHsJMoXOnCyKS80g6oeYTCCx q50y8rOIpv4zB+oD8cbcgf7INlqDqseX/nt4KFIX4z3IU4vK88IShwEmZP5dqTlSLYdEFHS9fPd GAJLJLZde8HpGjBvx3cMqEokfAGrVCslulUI= X-Gm-Gg: ASbGncuuqHMk/9gQSqXnk7ipBbXXqVG2QuIJoo8Q3UuCFXmp+khlYs12nErQMfwqy7t OSKC9y8y41TSmD/va/nNXRONt6TX6W4Ws1AKbgTdvfes2qzdWvgGqLFyXR7mo3c046vCbTR+5Nm Fa3dKnriKDTA== X-Google-Smtp-Source: AGHT+IGks5+B6h/Ly8eJwxAzZ2tIHpJlUantdTbZkxkaBuxSWvYsKVRQT8rlUBGxrh/SIHhjhZH2mJfbuLUFFHUIqkg= X-Received: by 2002:a05:6402:3592:b0:5dc:cfc5:9305 with SMTP id 4fb4d7f45d1cf-5e0b721dfafmr16144550a12.25.1740433807826; Mon, 24 Feb 2025 13:50:07 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 24 Feb 2025 21:50:07 +0000 From: Stefan Kangas MIME-Version: 1.0 Date: Mon, 24 Feb 2025 21:50:07 +0000 X-Gm-Features: AWEUYZm_0pnOVugGISq_YNjxR5kNtclgDdO94T_2eTyzKlzSNzMdqcJwU9K3hlE Message-ID: Subject: control message for bug #76500 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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 (-) severity 76500 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 27 02:39:57 2025 Received: (at 76500) by debbugs.gnu.org; 27 Feb 2025 07:39:57 +0000 Received: from localhost ([127.0.0.1]:57832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tnYUv-0005Qw-4N for submit@debbugs.gnu.org; Thu, 27 Feb 2025 02:39:57 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:33997) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tnYUs-0005QZ-2r for 76500@debbugs.gnu.org; Thu, 27 Feb 2025 02:39:54 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id B3BA843193; Thu, 27 Feb 2025 07:39:45 +0000 (UTC) From: Juri Linkov To: Paul Nelson Subject: Re: bug#76500: [PATCH] Allow numbered buffer selection for project shell commands In-Reply-To: Organization: LINKOV.NET References: Date: Thu, 27 Feb 2025 09:38:57 +0200 Message-ID: <87ldtrzvji.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-State: clean X-GND-Score: 0 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekieeklecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejieehtddtseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepuhhlthhrohhnohesghhmrghilhdrtghomh X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 76500 Cc: 76500@debbugs.gnu.org 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.7 (-) > This patch for project.el adds numeric prefix buffer naming to the > project-shell and project-eshell commands, aligning their behavior with > that of eshell. > [...] > Any comments or feedback would be welcome. I think this would be a useful addition like e.g. a numeric argument allows selecting an Info buffer with 'C-2 C-h i', etc. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 28 06:30:57 2025 Received: (at 76500) by debbugs.gnu.org; 28 Jul 2025 10:30:57 +0000 Received: from localhost ([127.0.0.1]:54572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ugL8C-0006Lx-O3 for submit@debbugs.gnu.org; Mon, 28 Jul 2025 06:30:57 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:49649) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ugL89-0006La-9N for 76500@debbugs.gnu.org; Mon, 28 Jul 2025 06:30:54 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-615398dc162so1575200a12.3 for <76500@debbugs.gnu.org>; Mon, 28 Jul 2025 03:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753698647; x=1754303447; darn=debbugs.gnu.org; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=s0ludsn9V6pjKzA3CHU2eNtk9qaEKGM6SvcBz79K4Hk=; b=Eo7c7pvuU3WYch49lGWBQpdx1kEL1W0GeBMwYNEJ2LxBHl/T32CoppeRcTpRj5By3n MS6wim3tFLuT/KieKWhUo43b3ib/IRlxCBqKpBERDMlpglmXbMs+Q28BTAeHipFNl94Z IXDiWrPPCh/+QnIyXpW0+ZOIcTTmyOpfDsXzypDEQQQx9q5NonyQFzp0dMNwCE3ay+ZF traKFA9tBW9C3jNl3g83p9soz75RWNq3emftpVbZlHdhsTRP+e4fmab6GTqNKInNX8FW TyjB3IgcC93FgBCLKsHQKeM2OClM3gsmarU0Ew4mqFZsgQGr+NZgnpCERr7l7hxnpdm8 t8gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753698647; x=1754303447; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s0ludsn9V6pjKzA3CHU2eNtk9qaEKGM6SvcBz79K4Hk=; b=YREt3PZqhT0uE8AMi0pZO7psfirqim/CePxt03v5a2IgS8IQ9RmCljxyhrNIfJRVJ5 61oy/22iQzMRQWZUqCBL3/XJ9khRDTvTRUzXJoIjkpjprzPUf59euVAcDTJiaudj9/h6 qmOnE70nPivGIKVHzXiRa31d44kG2LVruqi969M0xXvdas29hXHlMndk+C40xk/h9QEh LSKTGsV/QTw+JO3jKj/s7GjAUZEaHF4ZjbWwwlDLGhK58tIn0cyseC7XAWIVj9rolW7U WwnkzrcZl8zbAjC1vosKvr7oaWK/5Ww19AWYSQxNQB5OZv9w565oYoKwvKAuoy7bn42X qI7A== X-Gm-Message-State: AOJu0Yw/tGMJ7PUzAJusTZfamFFZX5owBVBplQIQukTg2cJxTMKuvpDk ZX0IFXLkfFNdwEBGGuHghQx6oFHLFIbEZupJSq2Io8bK+TndaG6PZ6+JDB+c1zTZ X-Gm-Gg: ASbGncsbNU09vMV2BBf6c6CBj97yrk1pEF7mPDgTFKCVpPGycTfajs9ZwGd7L3PABD9 hX1/DOC7i6pJoxD/YjaSRUXCVmELtt9bErfDCWZKDk2Pj0xKo7kdHN8HLhAvkbB3u7IfwIchGNa d4PyySJFVNNgyCLRf7CQE6p4uMYr2PFZLR2uhgR9y32adc3+UmfZWqxTERSHN2Gcjz1m0gec5qy zT9VXphVYkreYq+wKaGCsHnwil8mZu4dlwnx3BcHw6iHE++O8WnsXXStCEE2RRelC5/m0qlj8pt xLwxsy4yAL2nMIw6onwh130RLvvW33dHOm/CUfCTDVTmHVfCnNrCkPvG/LLfS95FcVJJs8768T2 gHTLegXao0cOmWmxgO8PP4g3yFeskSE/2LsscPZu+r3nuFJCAWRPCrEQ+IGAf/FboJxX1RIzNMU N4 X-Google-Smtp-Source: AGHT+IFzI965rz2iYHmFpFmUbGVTG4KUR2MpyxZjY4JPdLiTnfnsgbfxfNbKUVUw19/A9TOHsXyjJQ== X-Received: by 2002:a05:6402:2756:b0:609:d491:8d7c with SMTP id 4fb4d7f45d1cf-614f1f66f87mr9969440a12.33.1753698646341; Mon, 28 Jul 2025 03:30:46 -0700 (PDT) Received: from localhost (0x5da5fbba.static.cust.fastspeed.dk. [93.165.251.186]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-61500ad0474sm3057123a12.32.2025.07.28.03.30.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jul 2025 03:30:45 -0700 (PDT) From: "Paul D. Nelson" To: Juri Linkov Subject: Re: bug#76500: [PATCH] Allow numbered buffer selection for project shell commands In-Reply-To: <87ldtrzvji.fsf@mail.linkov.net> (message from Juri Linkov on Thu, 27 Feb 2025 09:38:57 +0200) Date: Mon, 28 Jul 2025 12:30:44 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76500 Cc: Dmitry Gutov , 76500@debbugs.gnu.org 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 (-) --=-=-= Content-Type: text/plain Juri Linkov writes: >> This patch for project.el adds numeric prefix buffer naming to the >> project-shell and project-eshell commands, aligning their behavior with >> that of eshell. >> [...] >> Any comments or feedback would be welcome. > > I think this would be a useful addition like e.g. > a numeric argument allows selecting an Info buffer > with 'C-2 C-h i', etc. > This patch received a positive response back in February, but nothing further, so I figured I'd send a follow-up, rebased onto a recent master. Any other feedback would be welcome. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-numbered-buffer-selection-for-project-shell.patch >From 07c1b6ea5dffaf2cf0d19a32a843daf80bbbe87a Mon Sep 17 00:00:00 2001 From: Paul Nelson Date: Mon, 28 Jul 2025 11:52:16 +0200 Subject: [PATCH] Allow numbered buffer selection for project-shell * project.el (project-shell, project-eshell): When a numeric prefix is supplied, the command switches to or creates a session buffer whose name has that number as a suffix. For instance, C-2 yields "*name-of-project-shell<2>*". As before, a plain universal argument C-u creates a new session with an automatically generated numeric suffix. This change makes the behavior of the project-shell commands consistent with how M-x eshell handles numeric prefixes. * etc/NEWS: Announce the change. (bug#76500) --- etc/NEWS | 7 +++++++ lisp/progmodes/project.el | 28 +++++++++++++++++----------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 8d41efdaf64..121db04b1d8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -478,6 +478,13 @@ This is like 'C-x s', but only for this project's buffers. *** 'project-remember-project' can now be called interactively. +--- +*** 'project-shell' and 'project-eshell' support numeric prefix buffer naming. +They now accept numeric prefix arguments to select or create numbered +shell sessions. For example, 'C-2 C-x p s' switches to or creates a +buffer named "*name-of-project-shell<2>*". By comparison, a plain +universal argument as in 'C-u C-x p s' always creates a new session. + ** Registers *** New functions 'buffer-to-register' and 'file-to-register'. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 68179206017..a51376144a9 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1414,18 +1414,26 @@ project-shell If a buffer already exists for running a shell in the project's root, switch to it. Otherwise, create a new shell buffer. With \\[universal-argument] prefix arg, create a new inferior shell buffer even -if one already exists." +if one already exists. +With numeric prefix arg, switch to the session with that number, or +create it if it doesn't already exist." (interactive) (require 'comint) (let* ((default-directory (project-root (project-current t))) - (default-project-shell-name (project-prefixed-buffer-name "shell")) - (shell-buffer (get-buffer default-project-shell-name))) + (base-name (project-prefixed-buffer-name "shell")) + (shell-buffer-name + (cond ((numberp current-prefix-arg) + (format "%s<%d>" base-name current-prefix-arg)) + (current-prefix-arg + (generate-new-buffer-name base-name)) + (t base-name))) + (shell-buffer (get-buffer shell-buffer-name))) (if (and shell-buffer (not current-prefix-arg)) (if (comint-check-proc shell-buffer) (pop-to-buffer shell-buffer (append display-buffer--same-window-action '((category . comint)))) (shell shell-buffer)) - (shell (generate-new-buffer-name default-project-shell-name))))) + (shell shell-buffer-name)))) ;;;###autoload (defun project-eshell () @@ -1433,16 +1441,14 @@ project-eshell If a buffer already exists for running Eshell in the project's root, switch to it. Otherwise, create a new Eshell buffer. With \\[universal-argument] prefix arg, create a new Eshell buffer even -if one already exists." +if one already exists. +With numeric prefix arg, switch to the session with that number, or +create it if it doesn't already exist." (interactive) (defvar eshell-buffer-name) (let* ((default-directory (project-root (project-current t))) - (eshell-buffer-name (project-prefixed-buffer-name "eshell")) - (eshell-buffer (get-buffer eshell-buffer-name))) - (if (and eshell-buffer (not current-prefix-arg)) - (pop-to-buffer eshell-buffer (append display-buffer--same-window-action - '((category . comint)))) - (eshell t)))) + (eshell-buffer-name (project-prefixed-buffer-name "eshell"))) + (eshell current-prefix-arg))) ;;;###autoload (defun project-async-shell-command () -- 2.39.3 (Apple Git-145) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 02 10:21:37 2025 Received: (at 76500) by debbugs.gnu.org; 2 Aug 2025 14:21:37 +0000 Received: from localhost ([127.0.0.1]:36879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uiD7B-0003ky-0o for submit@debbugs.gnu.org; Sat, 02 Aug 2025 10:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37560) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uiD78-0003kh-EE for 76500@debbugs.gnu.org; Sat, 02 Aug 2025 10:21:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uiD73-0000qI-2E; Sat, 02 Aug 2025 10:21:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=LrYca8eLJ9loauoeZ9AxvX2o7xZtPlNRgJ3rW5wLVnc=; b=TcPvkWawbxkZ GcEHVhULVE5WEhg6NjLTS2DT/yeh/bMXJHbdFJwd/OkOtMeL3hIjJWQGvC6/0eMmzlnwNG9TfRXNJ bfRItYMXkQWONGvQ90POw8RndxASOm83bMmkkdQay2wCm0yNIeTvMGd7pKsKhCy1cSLHyJZVTDgh4 ftNv9KJ8fmMa0mReXwaznzzodqM65AeiCyYmFlza15n/CR1yBtvqSZbAWlVjSWKBoHpz+sedPOCJK rVsQCDt2kpgQqqqFmqRDKGKDPKneD8rsw7EMkys6LgIug0F9ovaWJ9AjKFsikXHYEh27zaxCdn2rm eftuhtFEc/NYfGzpFT2AaA==; Date: Sat, 02 Aug 2025 17:21:23 +0300 Message-Id: <86jz3lreho.fsf@gnu.org> From: Eli Zaretskii To: "Paul D. Nelson" In-Reply-To: (ultrono@gmail.com) Subject: Re: bug#76500: [PATCH] Allow numbered buffer selection for project shell commands References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76500 Cc: dmitry@gutov.dev, 76500@debbugs.gnu.org, juri@linkov.net 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: -3.3 (---) > Cc: Dmitry Gutov , 76500@debbugs.gnu.org > From: "Paul D. Nelson" > Date: Mon, 28 Jul 2025 12:30:44 +0200 > > Juri Linkov writes: > > >> This patch for project.el adds numeric prefix buffer naming to the > >> project-shell and project-eshell commands, aligning their behavior with > >> that of eshell. > >> [...] > >> Any comments or feedback would be welcome. > > > > I think this would be a useful addition like e.g. > > a numeric argument allows selecting an Info buffer > > with 'C-2 C-h i', etc. > > > > This patch received a positive response back in February, but nothing > further, so I figured I'd send a follow-up, rebased onto a recent > master. Any other feedback would be welcome. Dmitry, any comments? From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 05 21:50:36 2025 Received: (at 76500-done) by debbugs.gnu.org; 6 Aug 2025 01:50:36 +0000 Received: from localhost ([127.0.0.1]:57414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ujTIZ-0002eH-M3 for submit@debbugs.gnu.org; Tue, 05 Aug 2025 21:50:35 -0400 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]:47635) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ujTIW-0002dz-S8 for 76500-done@debbugs.gnu.org; Tue, 05 Aug 2025 21:50:33 -0400 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 3DF677A01CC; Tue, 5 Aug 2025 21:50:27 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Tue, 05 Aug 2025 21:50:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1754445027; x=1754531427; bh=8A1J9c/GZw/ggcHZIlU6opnlqvYh2twIM14G8T/q5es=; b= uHFGCmUvTADF+E63nUZlmb9UA84WY92UXmWl6+Vto6QD1WRl4Fbc52yLa5gVhydv 5PoLZbDjacC83+ZlWtWcJPtO90+23/qaDS2JstlocQdr+sUoh6Sc+tntYeATCaKX 4QLXdHYIIERxPJCUty6ooO0IjDeMDrnxfHFEDAlFw7xtLikt1+yCV8xQrKuIlS2p 9zmZUbV11jzGxWoOyvYsJfbLvi64ER57MOYa8EJbz9goJ+AgiMKcSRZYKmBBvbw1 nYWJPrQXXY8d3eIYm6quAp3FnZigYrD+mHQ78kNvZugP/HG2x0E3Gowu4vDfZVXK QVxWtbqZ53yN97ZwKPy4bg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1754445027; x= 1754531427; bh=8A1J9c/GZw/ggcHZIlU6opnlqvYh2twIM14G8T/q5es=; b=R 8bX+3rdZdORe8FrK9A8za6lKcG0wj9lmTW1TS0m4/dkl4rDe4Bd3bOUW8VS1rl1E 9qI91j0v3BbmtwPj8WaLKyo3h8NPMwUoGtinaCJfIBlSAb7H4/J61MWMQ/eQdPaJ L/kFoehG3vgh6aag4nv4T8/j/oxOAX+fWZ2wjr45SQbb/Psb456YoIDiXvGJEdw3 ocuynbwfn/Mw2MhBSr+/BMzfj/S1FfAVDUexGA3ZqV5jT9y2I60v2X/Iux+gARVA GuHTeXdWbMcHDBxh1rj0lOeJAGpp1/0LOnwTzaiXb8EAHCwCPmMlNh7CM3yt5jGd vijoSzY6HCmugN8Z/N72Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduudeijeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhithhr hicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrthhtvg hrnhepteduleejgeehtefgheegjeekueehvdevieekueeftddvtdevfefhvdevgedujeeh necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughmih htrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtthhopehulhhtrh honhhosehgmhgrihhlrdgtohhmpdhrtghpthhtohepjhhurhhisehlihhnkhhovhdrnhgv thdprhgtphhtthhopeejieehtddtqdguohhnvgesuggvsggsuhhgshdrghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 5 Aug 2025 21:50:25 -0400 (EDT) Message-ID: <3fb63d24-4bd0-4830-8fa8-27f43385ae4e@gutov.dev> Date: Wed, 6 Aug 2025 04:50:23 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#76500: [PATCH] Allow numbered buffer selection for project shell commands To: Eli Zaretskii , "Paul D. Nelson" References: <86jz3lreho.fsf@gnu.org> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <86jz3lreho.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 76500-done Cc: 76500-done@debbugs.gnu.org, juri@linkov.net 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.7 (-) On 02/08/2025 17:21, Eli Zaretskii wrote: >>>> This patch for project.el adds numeric prefix buffer naming to the >>>> project-shell and project-eshell commands, aligning their behavior with >>>> that of eshell. >>>> [...] >>>> Any comments or feedback would be welcome. >>> I think this would be a useful addition like e.g. >>> a numeric argument allows selecting an Info buffer >>> with 'C-2 C-h i', etc. >>> >> This patch received a positive response back in February, but nothing >> further, so I figured I'd send a follow-up, rebased onto a recent >> master. Any other feedback would be welcome. > Dmitry, any comments? Looks good. Thanks! Pushed to master, closing. Small note: I had to fix the file name section for project.el in the commit message. Caught by the push hook, BTW (nice we have those). From unknown Fri Sep 19 22:48:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 03 Sep 2025 11:24:05 +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