unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
@ 2024-12-06 12:17 Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-06 16:16 ` Eli Zaretskii
  2024-12-06 17:44 ` Visuwesh
  0 siblings, 2 replies; 10+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-06 12:17 UTC (permalink / raw)
  To: 74709

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

Tags: patch

Hi,

This patch prevents from having an empty unique qualifier in the buffer
name.  Maybe this could happen with others file buffer as well but, most
of the time, you could witness it with Dired buffer in homedir.  Here is
a recipe:

  - emacs -Q
  - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
  - C-x d /~/             ;; This buffer is named "~<>"

With this patch, the last buffer will simply be named "~" instead.

In GNU Emacs 31.0.50 (build 26, x86_64-unknown-openbsd7.6, X toolkit) of
 2024-12-06 built on computer
Repository revision: 2c1dfba7feb67c39299da0579a2be7ff14e13ccb
Repository branch: mgi/unique
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: OpenBSD computer 7.6 GENERIC.MP#458 amd64

Configured using:
 'configure CC=egcc CPPFLAGS=-I/usr/local/include
 LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
 --bindir=/home/manuel/bin --with-x-toolkit=lucid
 --with-toolkit-scroll-bars=no --without-cairo
 --without-compress-install'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-empty-unique-qualifier-in-buffer-name.patch --]
[-- Type: text/patch, Size: 1018 bytes --]

From 70b7e0afe02669df44fd719c2ab35561b565f2df Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Fri, 6 Dec 2024 12:01:29 +0100
Subject: [PATCH] Avoid empty unique qualifier in buffer name

* lisp/uniquify.el (uniquify-get-proposed-name): If the unique
qualifier will end up being empty just return the base name.
---
 lisp/uniquify.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index efe42762a6b..677270d6a91 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -397,7 +397,10 @@ uniquify-get-proposed-name
       (setq uniquify-possibly-resolvable t))
 
     (cond
-     ((null extra-string) base)
+     ((or (null extra-string)
+          (and (= 1 (length extra-string))
+               (string= "" (car extra-string))))
+      base)
      ((string-equal base "") ;Happens for dired buffers on the root directory.
       (mapconcat #'identity extra-string "/"))
      ((eq uniquify-buffer-name-style 'reverse)
-- 
2.47.0


[-- Attachment #3: Type: text/plain, Size: 18 bytes --]

-- 
Manuel Giraud

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-06 12:17 bug#74709: [PATCH] Avoid empty unique qualifier in buffer name Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-06 16:16 ` Eli Zaretskii
  2024-12-06 16:34   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-06 17:44 ` Visuwesh
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-12-06 16:16 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 74709

> Date: Fri, 06 Dec 2024 13:17:31 +0100
> From:  Manuel Giraud via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> This patch prevents from having an empty unique qualifier in the buffer
> name.  Maybe this could happen with others file buffer as well but, most
> of the time, you could witness it with Dired buffer in homedir.  Here is
> a recipe:
> 
>   - emacs -Q
>   - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
>   - C-x d /~/             ;; This buffer is named "~<>"
> 
> With this patch, the last buffer will simply be named "~" instead.

FWIW, I actually like the feature whereby once we need the <SOMETHING>
suffix, all the buffers that share the same base name acquire the
brackets.  Why is it a problem that there's nothing inside?  It is not
a bug.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-06 16:16 ` Eli Zaretskii
@ 2024-12-06 16:34   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-06 16:51     ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-06 16:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74709

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Fri, 06 Dec 2024 13:17:31 +0100
>> From:  Manuel Giraud via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> This patch prevents from having an empty unique qualifier in the buffer
>> name.  Maybe this could happen with others file buffer as well but, most
>> of the time, you could witness it with Dired buffer in homedir.  Here is
>> a recipe:
>> 
>>   - emacs -Q
>>   - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
>>   - C-x d /~/             ;; This buffer is named "~<>"
>> 
>> With this patch, the last buffer will simply be named "~" instead.
>
> FWIW, I actually like the feature whereby once we need the <SOMETHING>
> suffix, all the buffers that share the same base name acquire the
> brackets.  Why is it a problem that there's nothing inside?  It is not
> a bug.

No it is not a bug.  It is just a matter of aesthetic.  But you're right
that it could also serve as visual help.  I think this PR could be
ignored then.  Thanks.
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-06 16:34   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-06 16:51     ` Eli Zaretskii
  2024-12-06 17:17       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-12-06 16:51 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 74709

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: 74709@debbugs.gnu.org
> Date: Fri, 06 Dec 2024 17:34:55 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Date: Fri, 06 Dec 2024 13:17:31 +0100
> >> From:  Manuel Giraud via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >> 
> >> This patch prevents from having an empty unique qualifier in the buffer
> >> name.  Maybe this could happen with others file buffer as well but, most
> >> of the time, you could witness it with Dired buffer in homedir.  Here is
> >> a recipe:
> >> 
> >>   - emacs -Q
> >>   - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
> >>   - C-x d /~/             ;; This buffer is named "~<>"
> >> 
> >> With this patch, the last buffer will simply be named "~" instead.
> >
> > FWIW, I actually like the feature whereby once we need the <SOMETHING>
> > suffix, all the buffers that share the same base name acquire the
> > brackets.  Why is it a problem that there's nothing inside?  It is not
> > a bug.
> 
> No it is not a bug.  It is just a matter of aesthetic.  But you're right
> that it could also serve as visual help.  I think this PR could be
> ignored then.  Thanks.

Let's wait a bit for others to chime in, before we decide to close,
okay?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-06 16:51     ` Eli Zaretskii
@ 2024-12-06 17:17       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 10+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-06 17:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 74709

Eli Zaretskii <eliz@gnu.org> writes:

[...]

> Let's wait a bit for others to chime in, before we decide to close,
> okay?

👍
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-06 12:17 bug#74709: [PATCH] Avoid empty unique qualifier in buffer name Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-06 16:16 ` Eli Zaretskii
@ 2024-12-06 17:44 ` Visuwesh
  2024-12-06 19:30   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 10+ messages in thread
From: Visuwesh @ 2024-12-06 17:44 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 74709

[வெள்ளி டிசம்பர் 06, 2024] Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> Tags: patch
>
> Hi,
>
> This patch prevents from having an empty unique qualifier in the buffer
> name.  Maybe this could happen with others file buffer as well but, most
> of the time, you could witness it with Dired buffer in homedir.  Here is
> a recipe:
>
>   - emacs -Q
>   - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
>   - C-x d /~/             ;; This buffer is named "~<>"
>
> With this patch, the last buffer will simply be named "~" instead.

I usually have ~/tmp visited in a Dired buffer.  Sometimes I also visit
/tmp which gets named as "tmp<>".  With this patch, /tmp's buffer is
named "tmp" instead.  This confuses me as I am used to seeing "tmp" for
~/tmp's Dired buffer more often than not.  Can we gate this new
behaviour behind a user option please?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-06 17:44 ` Visuwesh
@ 2024-12-06 19:30   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-07  3:46     ` Visuwesh
  0 siblings, 1 reply; 10+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-06 19:30 UTC (permalink / raw)
  To: Visuwesh; +Cc: 74709

Visuwesh <visuweshm@gmail.com> writes:

> [வெள்ளி டிசம்பர் 06, 2024] Manuel Giraud via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" wrote:
>
>> Tags: patch
>>
>> Hi,
>>
>> This patch prevents from having an empty unique qualifier in the buffer
>> name.  Maybe this could happen with others file buffer as well but, most
>> of the time, you could witness it with Dired buffer in homedir.  Here is
>> a recipe:
>>
>>   - emacs -Q
>>   - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
>>   - C-x d /~/             ;; This buffer is named "~<>"
>>
>> With this patch, the last buffer will simply be named "~" instead.
>
> I usually have ~/tmp visited in a Dired buffer.  Sometimes I also visit
> /tmp which gets named as "tmp<>".  With this patch, /tmp's buffer is
> named "tmp" instead.  This confuses me as I am used to seeing "tmp" for
> ~/tmp's Dired buffer more often than not.  Can we gate this new
> behaviour behind a user option please?

I don't think that there is more confusion then if you only have /tmp
opened which will have its buffer named "tmp", no?
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-06 19:30   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-07  3:46     ` Visuwesh
  2024-12-07 10:04       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 10+ messages in thread
From: Visuwesh @ 2024-12-07  3:46 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 74709

[வெள்ளி டிசம்பர் 06, 2024] Manuel Giraud wrote:

> Visuwesh <visuweshm@gmail.com> writes:
>
>> [வெள்ளி டிசம்பர் 06, 2024] Manuel Giraud via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" wrote:
>>
>>> Tags: patch
>>>
>>> Hi,
>>>
>>> This patch prevents from having an empty unique qualifier in the buffer
>>> name.  Maybe this could happen with others file buffer as well but, most
>>> of the time, you could witness it with Dired buffer in homedir.  Here is
>>> a recipe:
>>>
>>>   - emacs -Q
>>>   - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
>>>   - C-x d /~/             ;; This buffer is named "~<>"
>>>
>>> With this patch, the last buffer will simply be named "~" instead.
>>
>> I usually have ~/tmp visited in a Dired buffer.  Sometimes I also visit
>> /tmp which gets named as "tmp<>".  With this patch, /tmp's buffer is
>> named "tmp" instead.  This confuses me as I am used to seeing "tmp" for
>> ~/tmp's Dired buffer more often than not.  Can we gate this new
>> behaviour behind a user option please?
>
> I don't think that there is more confusion then if you only have /tmp
> opened which will have its buffer named "tmp", no?

Sorry, I meant having /tmp being "tmp" when both ~/tmp and /tmp are open
is confusing for the aforementioned reason.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-07  3:46     ` Visuwesh
@ 2024-12-07 10:04       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-12-21  9:11         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-07 10:04 UTC (permalink / raw)
  To: Visuwesh; +Cc: 74709

Visuwesh <visuweshm@gmail.com> writes:

> [வெள்ளி டிசம்பர் 06, 2024] Manuel Giraud wrote:
>
>> Visuwesh <visuweshm@gmail.com> writes:
>>
>>> [வெள்ளி டிசம்பர் 06, 2024] Manuel Giraud via "Bug reports for GNU Emacs,
>>> the Swiss army knife of text editors" wrote:
>>>
>>>> Tags: patch
>>>>
>>>> Hi,
>>>>
>>>> This patch prevents from having an empty unique qualifier in the buffer
>>>> name.  Maybe this could happen with others file buffer as well but, most
>>>> of the time, you could witness it with Dired buffer in homedir.  Here is
>>>> a recipe:
>>>>
>>>>   - emacs -Q
>>>>   - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
>>>>   - C-x d /~/             ;; This buffer is named "~<>"
>>>>
>>>> With this patch, the last buffer will simply be named "~" instead.
>>>
>>> I usually have ~/tmp visited in a Dired buffer.  Sometimes I also visit
>>> /tmp which gets named as "tmp<>".  With this patch, /tmp's buffer is
>>> named "tmp" instead.  This confuses me as I am used to seeing "tmp" for
>>> ~/tmp's Dired buffer more often than not.  Can we gate this new
>>> behaviour behind a user option please?
>>
>> I don't think that there is more confusion then if you only have /tmp
>> opened which will have its buffer named "tmp", no?
>
> Sorry, I meant having /tmp being "tmp" when both ~/tmp and /tmp are open
> is confusing for the aforementioned reason.

Yes, you're right.  Thinking a bit more about it, I don't think this
patch was a good idea anymore.  When a buffer is named "tmp<>" it
conveys the information that there is another buffer with the same base
name.  If it is just named "tmp", we have lost this bit of information.
-- 
Manuel Giraud





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#74709: [PATCH] Avoid empty unique qualifier in buffer name
  2024-12-07 10:04       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-12-21  9:11         ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2024-12-21  9:11 UTC (permalink / raw)
  To: Manuel Giraud; +Cc: 74709-done, visuweshm

> Cc: 74709@debbugs.gnu.org
> Date: Sat, 07 Dec 2024 11:04:14 +0100
> From:  Manuel Giraud via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Visuwesh <visuweshm@gmail.com> writes:
> 
> > [வெள்ளி டிசம்பர் 06, 2024] Manuel Giraud wrote:
> >
> >> Visuwesh <visuweshm@gmail.com> writes:
> >>
> >>> [வெள்ளி டிசம்பர் 06, 2024] Manuel Giraud via "Bug reports for GNU Emacs,
> >>> the Swiss army knife of text editors" wrote:
> >>>
> >>>> Tags: patch
> >>>>
> >>>> Hi,
> >>>>
> >>>> This patch prevents from having an empty unique qualifier in the buffer
> >>>> name.  Maybe this could happen with others file buffer as well but, most
> >>>> of the time, you could witness it with Dired buffer in homedir.  Here is
> >>>> a recipe:
> >>>>
> >>>>   - emacs -Q
> >>>>   - C-x d /ssh:somewhere: ;; This buffer is named "~</ssh:somewhere:>"
> >>>>   - C-x d /~/             ;; This buffer is named "~<>"
> >>>>
> >>>> With this patch, the last buffer will simply be named "~" instead.
> >>>
> >>> I usually have ~/tmp visited in a Dired buffer.  Sometimes I also visit
> >>> /tmp which gets named as "tmp<>".  With this patch, /tmp's buffer is
> >>> named "tmp" instead.  This confuses me as I am used to seeing "tmp" for
> >>> ~/tmp's Dired buffer more often than not.  Can we gate this new
> >>> behaviour behind a user option please?
> >>
> >> I don't think that there is more confusion then if you only have /tmp
> >> opened which will have its buffer named "tmp", no?
> >
> > Sorry, I meant having /tmp being "tmp" when both ~/tmp and /tmp are open
> > is confusing for the aforementioned reason.
> 
> Yes, you're right.  Thinking a bit more about it, I don't think this
> patch was a good idea anymore.  When a buffer is named "tmp<>" it
> conveys the information that there is another buffer with the same base
> name.  If it is just named "tmp", we have lost this bit of information.

Thanks.  Since there were no further comments withing 2 weeks, I'm now
closing this bug.





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-12-21  9:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 12:17 bug#74709: [PATCH] Avoid empty unique qualifier in buffer name Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-06 16:16 ` Eli Zaretskii
2024-12-06 16:34   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-06 16:51     ` Eli Zaretskii
2024-12-06 17:17       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-06 17:44 ` Visuwesh
2024-12-06 19:30   ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-07  3:46     ` Visuwesh
2024-12-07 10:04       ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-21  9:11         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).