From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#59502: 29.0.50; [PATCH] Dedicated buffers per project Date: Wed, 7 Dec 2022 04:31:26 +0200 Message-ID: <9b353f38-9e1d-9bb6-4512-9e4db594a2a6@yandex.ru> References: <87fse7lacm.fsf@gmail.com> <864ju8a5ch.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26977"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: 59502@debbugs.gnu.org To: Juri Linkov , Gabriel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 07 03:32:21 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 1p2kEO-0006r9-QI for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Dec 2022 03:32:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2kE8-0006yf-Kr; Tue, 06 Dec 2022 21:32:04 -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 1p2kE6-0006yX-N8 for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 21:32:02 -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 1p2kE6-0004tS-FG for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 21:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p2kE5-0003JA-Tv for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 21:32:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Dec 2022 02:32:01 +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.167038030012710 (code B ref 59502); Wed, 07 Dec 2022 02:32:01 +0000 Original-Received: (at 59502) by debbugs.gnu.org; 7 Dec 2022 02:31:40 +0000 Original-Received: from localhost ([127.0.0.1]:46638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2kDk-0003Iw-D4 for submit@debbugs.gnu.org; Tue, 06 Dec 2022 21:31:40 -0500 Original-Received: from mail-ej1-f47.google.com ([209.85.218.47]:37821) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2kDg-0003Ip-78 for 59502@debbugs.gnu.org; Tue, 06 Dec 2022 21:31:38 -0500 Original-Received: by mail-ej1-f47.google.com with SMTP id ud5so10788311ejc.4 for <59502@debbugs.gnu.org>; Tue, 06 Dec 2022 18:31:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=LUi+FpVwFWsgSoVJSjfjgXDpJPVgJ4hJMn6tcarKnu0=; b=gPzw5Q5tVuGMuvrdTxjolvHq8kCuXh9mnPce8+3VS2uCffNOP6t1WwUjxebl6n04CW aLpxDNhRGiY+fvmRs/9QuheN+tSnzQs5nMF4MKx310NacTxIn7NVY3+drR9EGwkewdYn 3UHeCXz/JzHYJGsq5VZh/MVvjcksoJPOFJs+YCJO92tFZm+zCyN7cOkoVEHvkFHrPcFm rqmayY+R5QzmCrx7TrTTEucM2fn4y+0ACYVghiKYsOsdKFTyt6DuqEsxERWgBbJ7JL0p QjCOkvyVrPhzE19260get57Z0FWJGf/VBtKKMm/7ZmF6bjZHYZxuI6tbtPst7y/oHO2P MMHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc: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=LUi+FpVwFWsgSoVJSjfjgXDpJPVgJ4hJMn6tcarKnu0=; b=mZahM71y0sJ01QfY6uznPY86vtrF0K4afo16u3SYkAUcqYPsBxlrV/ADP4GoAPdfWF ZLTZ4DDjnPjgugbAfYqZZDWwESB+ptSwZA22UNoahu9IQGDTM9Ae3/0s+ogJ43LADbkr UkQQqh4exT29Y2b6Bv89aL4Vv4SFAPQGPu9+tdUJ+YtZE/1VrUhDEP/DoJ9vgKNkYYPD f23N43A1rBiEh9THW9b/NgGHfC5cTROumIydGsTyUhYahneJu/HE+fKkzChtyt2HMpOV WDdmYvFkonAmz2YVVVFKofTrCtiyeEFSfo1C1gWhEnYDj+jpqpLDrK1AoE7mBxuhHoe/ AYpg== X-Gm-Message-State: ANoB5pnaVdD8VZqMngKJsrt30AzMeXGoBxfO1w3jxx2g8lLpgpkIJE81 2EjU2OjzuUTo3DTWL3YPXr8= X-Google-Smtp-Source: AA0mqf6ygIrcIlDTn5tvhuWvKFcC1j1SxeiGbOoXoEzh/ctcad4vv4EPZIuHnFazQXsxc1LjHBAcHg== X-Received: by 2002:a17:906:944c:b0:7b2:71fa:c367 with SMTP id z12-20020a170906944c00b007b271fac367mr71768072ejx.377.1670380289093; Tue, 06 Dec 2022 18:31:29 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id 14-20020a170906300e00b00780982d77d1sm7969677ejz.154.2022.12.06.18.31.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Dec 2022 18:31:28 -0800 (PST) Content-Language: en-US In-Reply-To: <864ju8a5ch.fsf@mail.linkov.net> 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:250158 Archived-At: On 06/12/2022 19:21, Juri Linkov wrote: >>> 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"))) I think that's not too bad. > 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)))) I think *prjname/Shell Command Output* sounds nice enough. If it doesn't, we probably wouldn't choose *Shell Command Output* as the name for non-project buffers of this type, would we?