Subject: bug#66317: Project mode-line

From: Dmitry Gutov <[email-masked]>
Date: Thu, 5 Oct 2023 23:16:04 +0300

On 05/10/2023 23:03, Spencer Baugh wrote:
> then while I'm at the find-file prompt, all modelines for all buffers
> show emacs-29 as the current project, no matter what they showed before
> (even if they didn't show anything before)
> 
> Haven't thought at all about how to fix this, but we might want to think
> about it in the context of bug#63648 where we've been rethinking the
> implementation of project-switch-project.

This can be fixed with e.g. patch below.

Thank for the reminder about that report, BTW.

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 2e6ae89a443..867e4754622 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1990,8 +1990,11 @@ project-switch-project
    (let ((command (if (symbolp project-switch-commands)
                       project-switch-commands
                     (project--switch-project-command))))
-    (let ((project-current-directory-override dir))
-      (call-interactively command))))
+    (unwind-protect
+        (progn
+          (setq-local project-current-directory-override dir)
+          (call-interactively command))
+      (kill-local-variable 'project-current-directory-override))))

  ;;;###autoload
  (defun project-uniquify-dirname-transform (dirname)