GNU bug report logs - #77157
[PATCH] 'uniquify' user option setters and automatic buffer refresh

Previous Next

Package: emacs;

Reported by: Ship Mints <shipmints <at> gmail.com>

Date: Fri, 21 Mar 2025 18:12:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ship Mints <shipmints <at> gmail.com>
Subject: bug#77157: closed (Re: bug#77157: [PATCH] 'uniquify' user option
 setters and automatic buffer refresh)
Date: Sat, 29 Mar 2025 12:09:02 +0000
[Message part 1 (text/plain, inline)]
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 77157 <at> debbugs.gnu.org.

-- 
77157: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77157
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Ship Mints <shipmints <at> gmail.com>
Cc: 77157-done <at> debbugs.gnu.org
Subject: Re: bug#77157: [PATCH] 'uniquify' user option setters and automatic
 buffer refresh
Date: Sat, 29 Mar 2025 15:07:31 +0300
> From: Ship Mints <shipmints <at> gmail.com>
> Date: Sat, 22 Mar 2025 08:09:18 -0400
> Cc: 77157 <at> debbugs.gnu.org
> 
> On Sat, Mar 22, 2025 at 7:40 AM Ship Mints <shipmints <at> gmail.com> wrote:
> 
>  On Sat, Mar 22, 2025 at 7:17 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>  > From: Ship Mints <shipmints <at> gmail.com>
>  > Date: Sat, 22 Mar 2025 07:04:08 -0400
>  > Cc: 77157 <at> debbugs.gnu.org
>  > 
>  >  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.

[Message part 3 (message/rfc822, inline)]
From: Ship Mints <shipmints <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 'uniquify' user option setters and automatic buffer refresh
Date: Fri, 21 Mar 2025 14:11:01 -0400
[Message part 4 (text/plain, inline)]
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
[Message part 5 (text/html, inline)]
[0001-uniquify-user-option-setters-and-automatic-buffer-re.patch (application/octet-stream, attachment)]

This bug report was last modified 55 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.