GNU bug report logs - #62732
29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD

Previous Next

Package: emacs;

Reported by: sbaugh <at> catern.com

Date: Sun, 9 Apr 2023 01:38:02 UTC

Severity: normal

Found in version 29.0.60

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: sbaugh <at> janestreet.com, 62732 <at> debbugs.gnu.org, sbaugh <at> catern.com
Subject: bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD
Date: Wed, 12 Jul 2023 16:42:01 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Spencer Baugh <sbaugh <at> janestreet.com>,  sbaugh <at> catern.com,
>   62732 <at> debbugs.gnu.org
> Date: Wed, 12 Jul 2023 09:04:40 -0400
> 
> I'm not sure what to make of this discussion.
> 
> The issue at hand is the following: `create-file-buffer` needs to know
> if the filename it receives is for a directory or not so it can decide
> whether the buffer name should end in / or not according to
> `uniquify-trailing-separator-p`.
> 
> I can see 3 ways to provide this info:
> 
> 1- use `file-directory-p`.
> 2- add a boolean `directory` argument to `create-file-buffer`.
> 3- use the presence of a trailing directory separator in the filename.
> 
> Those 3 are very close to each other, in practice, so we're pretty much
> in bikeshed territory.
> 
> My preference is (3) first, (2) second, and (1) last.

I prefer (1), because it avoids requesting the callers to remember to
ensure that every directory ends in a slash.

The trailing-slash semantics is indeed pretty much standard, but only
in interactive usage (where it is made easier by the file-name
completion machinery, both in Emacs and in other programs that ask
users to type file names).  And even in interactive usage it is
problematic: recall the many complaints when we started requiring the
slash in copy-file and such likes.  Here we are talking about a
low-level function, not an interactive command, which then places this
burden on the callers, and I worry that many of them will not pay
attention to this subtlety, and will cause subtle bugs, because AFAIK
the uniquify modes where that is important are rarely used, and thus
such problems could go undetected for many years.




This bug report was last modified 1 year and 312 days ago.

Previous Next


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