]> git.eshelyaron.com Git - emacs.git/commit
Don't recalculate the buffer basename inside uniquify
authorSpencer Baugh <sbaugh@catern.com>
Sun, 9 Jul 2023 14:24:33 +0000 (10:24 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 13 Jul 2023 21:50:56 +0000 (17:50 -0400)
commitee4cc106b88879c86d08c6fcda06657fb15df0f1
tree56aba9fbd3f1aae6fe6e5d86f40d5ac63a001513
parent0cd519971d199836ba0a6e9f0e36af9b9accaf0d
Don't recalculate the buffer basename inside uniquify

Previously, uniquify--create-file-buffer-advice would use the filename
of the buffer to calculate what the buffer's basename should be.  Now
that gets passed in from create-file-buffer, which lets us fix several
bugs:

1. before this patch, if a buffer happened to be named the same thing
as directory in its default-directory, the buffer would get renamed
with a directory separator according to uniquify-trailing-separator-p.

2. buffers with a leading space should get a leading |, as described
by create-file-buffer's docstring; before this patch, uniquify would
remove that leading |.

* lisp/dired.el (dired-internal-noselect): Pass a directory name to
create-file-buffer.
* lisp/files.el (create-file-buffer): Do uniquify-trailing-separator-p
handling if passed a directory filename. (bug#62732)
* lisp/uniquify.el (uniquify-item):
(uniquify-rationalize-file-buffer-names, uniquify-rationalize,
uniquify-get-proposed-name, uniquify-rationalize-conflicting-sublist):
Remove uniquify-trailing-separator-p handling.
(uniquify--create-file-buffer-advice): Take new basename argument and
use it, instead of recalculating the basename from the filename.
lisp/dired.el
lisp/files.el
lisp/uniquify.el
test/lisp/uniquify-tests.el [new file with mode: 0644]