Subject: bug#77157: closed (Re: bug#77157: [PATCH] 'uniquify' user option setters and automatic buffer refresh)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 29 Mar 2025 12:09:02 +0000

Your bug report

#77157: [PATCH] 'uniquify' user option setters and automatic buffer refresh

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77157: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77157
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#77157: [PATCH] 'uniquify' user option setters and automatic buffer refresh
From: Eli Zaretskii <[email-masked]>
To: Ship Mints <[email-masked]>
Cc: [email-masked]
Date: Sat, 29 Mar 2025 15:07:31 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Ship Mints <[email-masked]>
> Date: Sat, 22 Mar 2025 08:09:18 -0400
> Cc: [email-masked]
> 
> On Sat, Mar 22, 2025 at 7:40 AM Ship Mints <[email-masked]> wrote:
> 
>  On Sat, Mar 22, 2025 at 7:17 AM Eli Zaretskii <[email-masked]> wrote:
> 
>  > From: Ship Mints <[email-masked]>
>  > Date: Sat, 22 Mar 2025 07:04:08 -0400
>  > Cc: [email-masked]
>  > 
>  >  We usually use the following style for such variables:
>  > 
>  >    Setting this variable directly will not usually take effect;
>  >    use either \\[customize] or `setopt', or call `uniquify--set-option'
>  >    or restart `uniquify-mode' after setting the variable directly.
>  > 
>  >  I'll adapt this language.  Uniquify isn't implemented as a mode.  It's a rename buffer hook in
>  buffer.c
>  >  and depends on 'uniquify-buffer-name-style' to have a defined style.
>  > 
>  >  Even the function 'uniquify-unload-function' doesn't attempt to remove the hook (it probably
>  should set
>  >  'uniquify-buffer-name-style' to nil as part of its business).  It's not even clear if unload ever
>  gets called
>  >  by anyone.  Perhaps a candidate to obsolete.
>  > 
>  > The following seems more precise.  Okay with you?
>  > 
>  > Setting this variable directly will not usually take effect; use either
>  > \\[customize] or `setopt', or call `uniquify--set-option'; otherwise
>  > reload your buffers, or restart Emacs.
> 
>  Yes, but I'd omit the "restart Emacs" alternative, as too far-fetched
>  (we are talking about the ways to make the change take effect in the
>  same session).
> 
>  Thanks.
> 
>  Revised patch attached.  It's my pleasure.
> 
> With bug# added to commit log...

Thanks, installed on the master branch, and closing the bug.

Subject: [PATCH] 'uniquify' user option setters and automatic buffer refresh
From: Ship Mints <[email-masked]>
To: [email-masked]
Date: Fri, 21 Mar 2025 14:11:01 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Okay, here's a fun one that's been on my list for a while that other people
might find useful.  When I have a lot of buffers open, I occasionally want
to increase or decrease uniquify-min-dir-content to make it easier to
discern, with higher precision, one buffer from another with the same name,
and without reloading buffers...

Changing uniquify user options refreshes buffer names.

Use customize interactively, or setopt in Elisp, to refresh buffer names
when changing 'uniquify' user options.  Previously, reloading or renaming
your buffers (or an Emacs restart) was required.

e.g., (setopt uniquify-min-dir-content 2)

In my init file, I have the following which makes this convenient:

  (defun my/uniquify-dir-content-cycle ()
    (interactive)
    (if uniquify-buffer-name-style
        (progn
          (pcase uniquify-min-dir-content
            (0 (setopt uniquify-min-dir-content 1))
            (1 (setopt uniquify-min-dir-content 2))
            (2 (setopt uniquify-min-dir-content 0)))
          (setopt uniquify-strip-common-suffix (= 0
uniquify-min-dir-content))
          (when (< emacs-major-version 31) ; Hopefully deprecated!
            (my/uniquify-refresh)))
      (message "No `uniquify-buffer-name-style' defined")))

-Stephane