unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: sbaugh@catern.com, Stefan Monnier <monnier@iro.umontreal.ca>,
	62732@debbugs.gnu.org
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 09:57:02 -0400	[thread overview]
Message-ID: <iermt01qlld.fsf@janestreet.com> (raw)
In-Reply-To: <83y1jl5jrq.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 12 Jul 2023 16:42:01 +0300")

Eli Zaretskii <eliz@gnu.org> writes:
>> From: Stefan Monnier <monnier@iro.umontreal.ca>
>> Cc: Spencer Baugh <sbaugh@janestreet.com>,  sbaugh@catern.com,
>>   62732@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.

Not to prelong the discussion any further, but one more detail: This
uniquify-trailing-separator-p variable really IMO should be a dired
variable, since it only affects dired buffer naming (at least in core
Emacs, for now).  This behavior has really nothing to do with uniquify.
So IMO it should never have been a uniquify variable in the first place,
and in an earlier version of my patch I moved the variable to dired and
obsoleted the old one.

I dropped that move because it wasn't particularly necessary and could
be done in a followup, but of these three options, 2 and 3 work much
better with moving this variable to dired, because only 2 and 3 let
dired control this without affecting other packages.  Option 1 forces
the same behavior on every package.  I guess we could still have that as
a dired variable, but it seems weirder.

(As a dired variable, it could control just "does dired pass a directory
name or a file name to create-file-buffer?", and create-file-buffer
could always include the trailing slash when it sees a directory name)





  reply	other threads:[~2023-07-12 13:57 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-09  1:37 bug#62732: 29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD sbaugh
2023-04-09  1:49 ` sbaugh
2023-04-09 12:13   ` sbaugh
2023-04-21 20:59     ` sbaugh
2023-05-05  6:06       ` Eli Zaretskii
2023-07-03 18:54         ` sbaugh
2023-07-03 19:19           ` Eli Zaretskii
2023-05-05 20:30     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-08 17:48       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-09 14:49         ` sbaugh
2023-05-05 20:13   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-05 20:37     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-05 21:14     ` Spencer Baugh
2023-07-09 15:38     ` sbaugh
2023-07-09 16:15       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-10  1:36         ` sbaugh
2023-07-10  2:04           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-10  2:55             ` sbaugh
2023-07-10  3:38               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-10 12:57             ` Eli Zaretskii
2023-07-10 12:56           ` Eli Zaretskii
2023-07-10 13:39             ` Spencer Baugh
2023-07-10 14:25               ` Eli Zaretskii
2023-07-10 16:53             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-10 19:12               ` Eli Zaretskii
2023-07-10 19:18                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-11  2:25                   ` Eli Zaretskii
2023-07-11  2:55                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-11 12:01                       ` Eli Zaretskii
2023-07-11 12:31                         ` Spencer Baugh
2023-07-11 15:31                           ` Eli Zaretskii
2023-07-12 13:04                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-12 13:42                               ` Eli Zaretskii
2023-07-12 13:57                                 ` Spencer Baugh [this message]
2023-07-12 19:43                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-13  4:50                                 ` Eli Zaretskii
2023-07-13 15:52                                   ` sbaugh
2023-07-13 16:02                                     ` Eli Zaretskii
2023-07-13 16:21                                       ` sbaugh
2023-07-17  5:03                                         ` Michael Heerdegen
2023-07-17 11:35                                           ` Eli Zaretskii
2023-07-18  4:13                                             ` Michael Heerdegen
2023-07-18 11:12                                               ` Eli Zaretskii
2023-07-13 21:51                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iermt01qlld.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=62732@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=sbaugh@catern.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).