aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2025-06-06 05:38:55 +0300
committerDmitry Gutov2025-06-06 05:41:26 +0300
commit1c465fc0879b68b1cd7a05c033f6bb82fd5fa3aa (patch)
treea3a2b400e007afc97ba69fea34d79a4fd84ba412
parent79cd1cc30e0c9a5f058279dc6f618e5dc22a1945 (diff)
downloademacs-1c465fc0879b68b1cd7a05c033f6bb82fd5fa3aa.tar.gz
emacs-1c465fc0879b68b1cd7a05c033f6bb82fd5fa3aa.zip
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).
-rw-r--r--lisp/progmodes/project.el29
1 files changed, 22 insertions, 7 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 6e9c81ee581..5cf9a68a294 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1574,13 +1574,28 @@ general form of conditions."
1574 (and (memq (cdr buffer) buffers) 1574 (and (memq (cdr buffer) buffers)
1575 (not 1575 (not
1576 (project--buffer-check 1576 (project--buffer-check
1577 (cdr buffer) project-ignore-buffer-conditions))))) 1577 buffer project-ignore-buffer-conditions)))))
1578 (buffer (read-buffer 1578 (buffer
1579 "Switch to buffer: " 1579 (if (and (fboundp 'uniquify-get-unique-names)
1580 (when (funcall predicate (cons other-name other-buffer)) 1580 uniquify-buffer-name-style)
1581 other-name) 1581 ;; Forgo the use of `buffer-read-function' (often nil) in
1582 nil 1582 ;; favor of uniquifying the buffers better.
1583 predicate))) 1583 (let* ((unique-names (uniquify-get-unique-names buffers))
1584 (other-name (when (funcall predicate (cons other-name other-buffer))
1585 (car (rassoc other-buffer unique-names))))
1586 (result (completing-read
1587 "Switch to buffer: "
1588 unique-names
1589 predicate
1590 nil nil nil
1591 other-name)))
1592 (assoc-default result unique-names #'equal result))
1593 (read-buffer
1594 "Switch to buffer: "
1595 (when (funcall predicate (cons other-name other-buffer))
1596 other-name)
1597 nil
1598 predicate))))
1584 ;; XXX: This check hardcodes the default buffer-belonging relation 1599 ;; XXX: This check hardcodes the default buffer-belonging relation
1585 ;; which `project-buffers' is allowed to override. Straighten 1600 ;; which `project-buffers' is allowed to override. Straighten
1586 ;; this up sometime later. Or not. Since we can add a method 1601 ;; this up sometime later. Or not. Since we can add a method