Subject: bug#41879: 28.0.50; [Patch]: Add project-switch-to-buffer in project.el

From: Theodor Thornhill <[email-masked]>
Date: Thu, 18 Jun 2020 10:31:28 +0000

That was a lousy diff, sorry...

Theo

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index e24d81c1b4..d4a2b7707e 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -779,10 +779,12 @@ project-switch-to-buffer
   (let ((root (project-root (project-current t))))
     (switch-to-buffer
      (read-buffer
-      "Switch to buffer: " nil t
+      "Switch to buffer: "
+      (buffer-name (other-buffer (current-buffer)))
+      t
       (lambda (buffer)
         ;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist.
-        (when-let ((file (buffer-file-name (cdr buffer))))
+        (when-let ((file (buffer-local-value 'default-directory (cdr buffer))))
           (file-in-directory-p file root)))))))
 
 (defcustom project-kill-buffers-skip-conditions