emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b37604c263: project-switch-project: Use a different fix for bug#5


From: Dmitry Gutov
Subject: master b37604c263: project-switch-project: Use a different fix for bug#58784
Date: Wed, 23 Nov 2022 21:33:22 -0500 (EST)

branch: master
commit b37604c263e4813dc2a8b80e4e9131a3961c4f3e
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    project-switch-project: Use a different fix for bug#58784
    
    * lisp/progmodes/project.el (project-current-inhibit-prompt):
    Rename to 'project-current-directory-override', and make it a
    string value.
    (project-current): Refer to it.
    (project-switch-project): Bind it.  Drop the temp buffer (bug#58784).
---
 lisp/progmodes/project.el | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index c7b2c386cc..0e08dae154 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -175,8 +175,14 @@ function; the only practical limitation is to use values 
that
 `cl-defmethod' can dispatch on, like a cons cell, or a list, or a
 CL struct.")
 
-(defvar project-current-inhibit-prompt nil
-  "Non-nil to skip prompting the user in `project-current'.")
+(define-obsolete-variable-alias
+  'project-current-inhibit-prompt
+  'project-current-directory-override
+  "29.1")
+
+(defvar project-current-directory-override nil
+  "Value to use instead of `default-directory' when detecting the project.
+When it is non-nil, `project-current' will always skip prompting too.")
 
 ;;;###autoload
 (defun project-current (&optional maybe-prompt directory)
@@ -195,11 +201,12 @@ ignored (per `project-ignores').
 
 See the doc string of `project-find-functions' for the general form
 of the project instance object."
-  (unless directory (setq directory default-directory))
+  (unless directory (setq directory (or project-current-directory-override
+                                        default-directory)))
   (let ((pr (project--find-in-directory directory)))
     (cond
      (pr)
-     ((unless project-current-inhibit-prompt
+     ((unless project-current-directory-override
         maybe-prompt)
       (setq directory (project-prompt-project-dir)
             pr (project--find-in-directory directory))))
@@ -1698,10 +1705,8 @@ to directory DIR."
   (let ((command (if (symbolp project-switch-commands)
                      project-switch-commands
                    (project--switch-project-command))))
-    (with-temp-buffer
-      (let ((default-directory dir)
-            (project-current-inhibit-prompt t))
-        (call-interactively command)))))
+    (let ((project-current-directory-override dir))
+      (call-interactively command))))
 
 (provide 'project)
 ;;; project.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]