GNU bug report logs -
#62621
29.0.60; uniquify can't make buffers unique based on things other than filename
Previous Next
Reported by: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Sun, 2 Apr 2023 17:38:02 UTC
Severity: normal
Found in version 29.0.60
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: sbaugh <at> catern.com, 62621 <at> debbugs.gnu.org
>> Date: Fri, 14 Jul 2023 08:20:02 -0400
>>
>> Eli Zaretskii <eliz <at> 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.
This bug report was last modified 2 years and 19 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.