From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#59502: 29.0.50; [PATCH] Dedicated buffers per project Date: Tue, 06 Dec 2022 19:21:50 +0200 Organization: LINKOV.NET Message-ID: <864ju8a5ch.fsf@mail.linkov.net> References: <87fse7lacm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19583"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 59502@debbugs.gnu.org To: Gabriel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 06 18:28:34 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2bk8-0004w8-BU for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Dec 2022 18:28:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2bjo-00053N-2g; Tue, 06 Dec 2022 12:28:13 -0500 Original-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 1p2bjf-00052E-4w for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 12:28:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p2bje-0002Av-TM for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 12:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p2bje-00062s-OJ for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 12:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Dec 2022 17:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59502 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 59502-submit@debbugs.gnu.org id=B59502.167034766623212 (code B ref 59502); Tue, 06 Dec 2022 17:28:02 +0000 Original-Received: (at 59502) by debbugs.gnu.org; 6 Dec 2022 17:27:46 +0000 Original-Received: from localhost ([127.0.0.1]:44121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2bjN-00062K-SF for submit@debbugs.gnu.org; Tue, 06 Dec 2022 12:27:46 -0500 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:43667) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2bjK-000621-BU for 59502@debbugs.gnu.org; Tue, 06 Dec 2022 12:27:44 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 08E60FF80C; Tue, 6 Dec 2022 17:27:32 +0000 (UTC) In-Reply-To: (Gabriel's message of "Fri, 25 Nov 2022 10:27:59 -0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250132 Archived-At: >> Idly wondering if it'd make sense to also pass the major-mode to >> project-buffer-name-function, since string matching might be unreliable >> in some situations? Can't think of any concrete problem off the top of >> my head, I just have a vague expectation that mode symbols might be more >> stable than buffer names. It's unsubstantiated though, so feel free to >> dismiss. > > I agree, and actually my first implementation used the major-mode symbol > as the argument to function project-buffer-name-function. I changed to > a string to be able to handle the following cases: A string is too confusing. After seeing + (shell-command-buffer-name (funcall project-buffer-name-function + "Shell Command Output"))) the first thought was: why the buffer name is without asterisks as in the standard name "*Shell Command Output*". > | Command | major-mode | > |-----------------------------+------------------| > | project-shell-command | fundamental-mode | > | project-async-shell-command | shell-mode | More consistent would be to accept a symbol as the argument of project-buffer-name-function. Then every project-supported command could have the corresponding symbol that is part of the command name: | Command | name | |-----------------------------+-------------| | project-shell-command | shell | | project-async-shell-command | async-shell | Also for calling the user customized function it would be useful to provide an argument with the standard buffer name. So users won't need to copy the mapping from project-buffer-name-default. Then the default implementation will be just: (defun project-buffer-name-default (project command-symbol buffer-name) (or buffer-name (format "*%s-%s*" (project-name project) command-symbol))) And here is an example of how I'd like to customize it: (setopt project-buffer-name-function (lambda (project _command-symbol buffer-name) (format "%s<%s>" buffer-name (project-name project))))