From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: sbaugh@catern.com
Cc: 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: Sat, 08 Jul 2023 13:48:55 -0400 [thread overview]
Message-ID: <jwvbkgmxpz1.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <jwvsfcaset2.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 05 May 2023 16:30:28 -0400")
> Ping again on this latest version of my patch. I have some actual
> features I'd like to add to uniquify, but they're on top of this patch.
> Plus it would be nice to land the tests added in my patch.
Sorry for not following up further, but I was waiting for a reaction to
my proposal to replace the additional arg to `create-file-buffer`
by the patch below.
If we can't avoid changing the API of `create-file-buffer`, I'd like
a comment explaining clearly why. As it stands the patch is a bit vague
about that, if not confusing:
;; FIXME we really need to fold the uniquify stuff in here by default,
-;; not using advice, and add it to the doc string.
-(defun create-file-buffer (filename)
+(defun create-file-buffer (filename &optional directory)
"Create a suitably named buffer for visiting FILENAME, and return it.
FILENAME (sans directory) is used unchanged if that name is free;
-otherwise a string <2> or <3> or ... is appended to get an unused name.
+otherwise the buffer is renamed according to
+`uniquify-buffer-name-style' to get an unused name.
Emacs treats buffers whose names begin with a space as internal buffers.
To avoid confusion when visiting a file whose name begins with a space,
-this function prepends a \"|\" to the final result if necessary."
+this function prepends a \"|\" to the final result if necessary.
+
+If DIRECTORY is non-nil, a file name separator will be added to
+the buffer name according to `uniquify-trailing-separator-p'."
Where will that separator be added? And why is the arg called `directory`?
And why/when is that arg needed, since the separator will often be
introduced anyway by uniquify even with a nil arg?
Stefan
Stefan Monnier [2023-05-05 16:30:28] wrote:
>> Ah, while I'm at it, here's a fix (based on the patch in the preceding
>> mail) for a different bug which I just noticed: create-file-buffer's
>> documentations states:
>>
>>>Emacs treats buffers whose names begin with a space as internal buffers.
>>>To avoid confusion when visiting a file whose name begins with a space,
>>>this function prepends a "|" to the final result if necessary.
>>
>> But uniquify renames the buffer away from having that "|". This patch
>> fixes that bug.
>
> How 'bout the patch below (based on the current code), instead?
>
>
> Stefan
>
>
> diff --git a/lisp/uniquify.el b/lisp/uniquify.el
> index dee9ecba2ea..c252d5461aa 100644
> --- a/lisp/uniquify.el
> +++ b/lisp/uniquify.el
> @@ -498,7 +498,7 @@ uniquify--create-file-buffer-advice
> (when uniquify-buffer-name-style
> (let ((filename (expand-file-name (directory-file-name filename))))
> (uniquify-rationalize-file-buffer-names
> - (file-name-nondirectory filename)
> + (buffer-name buf)
> (file-name-directory filename)
> buf))))
>
next prev parent reply other threads:[~2023-07-08 17:48 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 [this message]
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
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=jwvbkgmxpz1.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=62732@debbugs.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).