bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62621: 29.0.60; uniquify can't make buffers unique based on things o


From: Spencer Baugh
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
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Cc: sbaugh@catern.com,  62621@debbugs.gnu.org
>> Date: Fri, 14 Jul 2023 08:20:02 -0400
>> 
>> Eli Zaretskii <eliz@gnu.org> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]