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: sbaugh
Subject: bug#62621: 29.0.60; uniquify can't make buffers unique based on things other than filename
Date: Fri, 14 Jul 2023 11:28:13 +0000 (UTC)
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 62621@debbugs.gnu.org
>> From: sbaugh@catern.com
>> Date: Thu, 13 Jul 2023 22:51:53 +0000 (UTC)
>> 
>> I've thought quite a bit about how to make this configurable, and I
>> think just letting people write their own arbitrary transformation
>> functions, as I do in this patch, is what we should provide.  Making
>> things any more modular is fairly difficult.  Packages can come along
>> and provide other fancy functions if they like.
>
> If there are a couple of simpler alternatives which could be offered
> via simple symbolic values, we should not force everyone to write
> functions, IMNSHO.  IOW, we should NOT immediately generalize to
> functions only because such generalization could make sense in some
> use cases.  Repeat after me: Use options whose values are functions
> are hard on our users, because they require them to be Lisp
> programmers.

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?

>> +(defcustom uniquify-dirname-transform #'identity
>> +  "A function to transform the dirname used to uniquify a buffer.
>
> "Function to transform buffer's `default-directory' for uniquifying its name."

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.

>> +It takes a single argument: the directory of the buffer.  It
>> +should return a string filename (which does not need to actually
>> +exist in the filesystem) to use for uniquifying the buffer name."
>> +  :type '(choice (function-item :tag "Don't change the dirname" identity)
>> +                 function)
>> +  :group 'uniquify)
>
> The :version tag is missing.
>
> Also, the doc string should state that the default is to use the
> buffer's default-directory without any transformations.  It should
> also include a link to uniquify-buffer-file-name, so that users could
> consult the uniquify facilities if they need to.

Will include that in the next version.





reply via email to

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