From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#62621: 29.0.60; uniquify can't make buffers unique based on things other than filename Date: Fri, 14 Jul 2023 08:46:00 -0400 Message-ID: References: <87bkgfjugn.fsf@catern.com> <83edlb3t0t.fsf@gnu.org> <878rbika0i.fsf@catern.com> <83h6q6g0qx.fsf@gnu.org> <83edlafzht.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10595"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: sbaugh@catern.com, 62621@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 14 14:47:19 2023 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 1qKICc-0002Un-MP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Jul 2023 14:47:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKICO-0005NV-10; Fri, 14 Jul 2023 08:47:04 -0400 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 1qKICM-0005Md-HK for bug-gnu-emacs@gnu.org; Fri, 14 Jul 2023 08:47:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKICM-0008Du-9Y for bug-gnu-emacs@gnu.org; Fri, 14 Jul 2023 08:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qKICL-0007Xs-Q7 for bug-gnu-emacs@gnu.org; Fri, 14 Jul 2023 08:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jul 2023 12:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62621 X-GNU-PR-Package: emacs Original-Received: via spool by 62621-submit@debbugs.gnu.org id=B62621.168933876828897 (code B ref 62621); Fri, 14 Jul 2023 12:47:01 +0000 Original-Received: (at 62621) by debbugs.gnu.org; 14 Jul 2023 12:46:08 +0000 Original-Received: from localhost ([127.0.0.1]:41674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKIBT-0007W0-MN for submit@debbugs.gnu.org; Fri, 14 Jul 2023 08:46:08 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:60969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKIBR-0007VB-GO for 62621@debbugs.gnu.org; Fri, 14 Jul 2023 08:46:06 -0400 In-Reply-To: <83edlafzht.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 14 Jul 2023 15:29:02 +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:265089 Archived-At: Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: sbaugh@catern.com, 62621@debbugs.gnu.org >> Date: Fri, 14 Jul 2023 08:20:02 -0400 >> >> Eli Zaretskii writes: >> >> >> I agree, and I'm happy to change it to use a simple symbolic value >> >> 'project instead for the transform I wrote, but I'm not sure how best to >> >> handle the dependencies: uniquify.el is in loadup.el, is it OK for it to >> >> rely on project-uniquify-dirname-transform being autoloaded? >> > >> > I don't understand the difficulty. If the function value could be >> > defined in uniquify.el, why cannot a symbolic value be defined there? >> >> I don't understand your question :) >> >> Here's concretely the diff I would apply. This makes uniquify.el mention a >> function from project.el. Is that OK? > > No. I figured. So now you see the issue with the symbolic approach. If the defcustom just takes a function, though, that solves the dependency issue. Because the user's config handles taking the function from project.el and putting it in the variable from uniquify.el. >> > If the symbolic values are specific to project, simply let-bind >> > uniquify-dirname-transform to the value of the appropriate project.el >> > defcustom when project.el calls uniquify. >> >> These customizations are in effect all the time, not just when the user >> is calling a project.el command. e.g. rename-buffer triggers uniquify. > > Then you can set the buffer-local value of uniquify-dirname-transform > in the project.el buffers. Would that solve the problem? The buffers it should affect are all file-visiting buffers. project.el doesn't currently have any code which runs for every new buffer. I guess we've considered adding that, but I'm not sure this is a good reason... >> >> Unfortunately, this isn't quite right. uniquify never uses >> >> default-directory, counterintuitively - by default, it uses the >> >> directory of buffer-file-name, which can differ from default-directory. >> > >> > That's a minor issue, just use "buffer's directory" instead. >> > >> > But I wonder why uniquify does something counterintuitive like that. >> >> I assume it's something like "default-directory changes (such as by M-x >> cd) shouldn't change the buffer name too". > > default-directory of a file-visiting buffer doesn't change. I don't think that's true. If I open ~/.emacs.d/init.el then (cd "/") then default-directory in that file-visiting buffer is / instead of ~/.emacs.d >> The fact that uniquify doesn't use default-directory also means it's >> unable to uniquify buffers which aren't visiting files > > Exactly.