From: Juri Linkov <juri@linkov.net>
To: Gabriel <gabriel376@hotmail.com>
Cc: 59502@debbugs.gnu.org
Subject: bug#59502: 29.0.50; [PATCH] Dedicated buffers per project
Date: Tue, 06 Dec 2022 19:21:50 +0200 [thread overview]
Message-ID: <864ju8a5ch.fsf@mail.linkov.net> (raw)
In-Reply-To: <SJ0PR06MB8609B59842427CE38E41324E8B0E9@SJ0PR06MB8609.namprd06.prod.outlook.com> (Gabriel's message of "Fri, 25 Nov 2022 10:27:59 -0300")
>> 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))))
next prev parent reply other threads:[~2022-12-06 17:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-23 5:11 bug#59502: 29.0.50; [PATCH] Dedicated buffers per project Gabriel
2022-11-25 1:37 ` Dmitry Gutov
2022-11-25 2:55 ` Gabriel
2022-11-25 8:14 ` Kévin Le Gouguec
2022-11-25 13:27 ` Gabriel
2022-12-06 17:21 ` Juri Linkov [this message]
2022-12-07 2:31 ` Dmitry Gutov
2022-12-07 7:50 ` Juri Linkov
2022-12-10 1:50 ` Dmitry Gutov
2022-12-10 17:34 ` Juri Linkov
2022-12-04 23:50 ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-25 7:09 ` daanturo
2022-12-05 2:35 ` Dmitry Gutov
2022-12-06 17:23 ` Juri Linkov
2022-12-07 2:35 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=864ju8a5ch.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=59502@debbugs.gnu.org \
--cc=gabriel376@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).