1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

project-switch-to-buffer: Don't disambiguate too much

* lisp/progmodes/project.el (project--read-project-buffer):
Use the new function from 'uniquify' to generate buffer names that
are just unique to the current project, not globally (bug#77312).
This commit is contained in:
Dmitry Gutov 2025-06-06 05:38:55 +03:00
parent 79cd1cc30e
commit 1c465fc087

View file

@ -1574,13 +1574,28 @@ general form of conditions."
(and (memq (cdr buffer) buffers)
(not
(project--buffer-check
(cdr buffer) project-ignore-buffer-conditions)))))
(buffer (read-buffer
"Switch to buffer: "
(when (funcall predicate (cons other-name other-buffer))
other-name)
nil
predicate)))
buffer project-ignore-buffer-conditions)))))
(buffer
(if (and (fboundp 'uniquify-get-unique-names)
uniquify-buffer-name-style)
;; Forgo the use of `buffer-read-function' (often nil) in
;; favor of uniquifying the buffers better.
(let* ((unique-names (uniquify-get-unique-names buffers))
(other-name (when (funcall predicate (cons other-name other-buffer))
(car (rassoc other-buffer unique-names))))
(result (completing-read
"Switch to buffer: "
unique-names
predicate
nil nil nil
other-name)))
(assoc-default result unique-names #'equal result))
(read-buffer
"Switch to buffer: "
(when (funcall predicate (cons other-name other-buffer))
other-name)
nil
predicate))))
;; XXX: This check hardcodes the default buffer-belonging relation
;; which `project-buffers' is allowed to override. Straighten
;; this up sometime later. Or not. Since we can add a method