GNU bug report logs -
#62732
29.0.60; uniquify-trailing-separator-p affects any buffer whose name matches a dir in CWD
Previous Next
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
Message #20 received at 62732 <at> debbugs.gnu.org (full text, mbox):
> This patch takes the approach of pulling uniquify-trailing-separator-p
> out of uniquify and putting it into dired; now the trailing separator is
> specified when the dired buffer is created. This is incidentally also
> vastly more efficient: The old way did n² filesystem accesses which is
> not something we should be doing on every buffer creation/rename.
It's indeed a better approach, thanks.
I'm a bit annoyed at the need to add an argument to `create-file-buffer`
and I wonder if we could avoid that by replacing:
> +(defun dired--create-buffer (dirname)
> + "Create a buffer with an appropriate name for visiting this directory.
> +
> +Obeys `dired-trailing-separator'."
> + (let* ((filename (directory-file-name dirname))
> + (base (file-name-nondirectory filename)))
> + (create-file-buffer filename
> + (if dired-trailing-separator
> + (cond ((eq uniquify-buffer-name-style 'forward)
> + (file-name-as-directory base))
> + ((eq uniquify-buffer-name-style 'reverse)
> + (concat (or uniquify-separator "\\") base)))))))
with
(defun dired--create-buffer (dirname)
"Create a buffer with an appropriate name for visiting this directory.
Obeys `dired-trailing-separator'."
(let* ((filename (directory-file-name dirname)))
(create-file-buffer (if dired-trailing-separator
(file-name-as-directory filename)
filename))))
or even just
(defun dired--create-buffer (dirname)
"Create a buffer with an appropriate name for visiting this directory."
(create-file-buffer (file-name-as-directory dirname)))
and then do the rest inside `uniquify.el`.
Stefan
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.