[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 11b7b0d4abc: project-any-command: Change the method for passing p
From: |
Dmitry Gutov |
Subject: |
master 11b7b0d4abc: project-any-command: Change the method for passing project root |
Date: |
Fri, 8 Dec 2023 15:34:27 -0500 (EST) |
branch: master
commit 11b7b0d4abc7bfc84004f019b3239990063950cf
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>
project-any-command: Change the method for passing project root
* lisp/progmodes/project.el (project-any-command): Change the
check which decides whether 'project-current-directory-override'
should be used. Instead of looking in project-prefix-map, see
whether the command's name starts with 'project-', or the symbol
has the property 'project-command' (bug#67171).
---
lisp/progmodes/project.el | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index a81bb63fba4..7789243cb00 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1841,10 +1841,12 @@ It's also possible to enter an arbitrary directory not
in the list."
;;;###autoload
(defun project-any-command (&optional overriding-map prompt-format)
"Run the next command in the current project.
-If the command is in `project-prefix-map', it gets passed that
-info with `project-current-directory-override'. Otherwise,
-`default-directory' is temporarily set to the current project's
-root.
+
+If the command name starts with `project-', or its symbol has
+property `project-related', it gets passed the project to use
+with the variable `project-current-directory-override'.
+Otherwise, `default-directory' is temporarily set to the current
+project's root.
If OVERRIDING-MAP is non-nil, it will be used as
`overriding-local-map' to provide shorter bindings from that map
@@ -1856,15 +1858,11 @@ which will take priority over the global ones."
(key-binding (read-key-sequence
(format prompt-format (project-root pr)))
t)))
- (root (project-root pr))
- found)
+ (root (project-root pr)))
(when command
- ;; We could also check the command name against "\\`project-",
- ;; and/or (get command 'project-command).
- (map-keymap
- (lambda (_evt cmd) (if (eq cmd command) (setq found t)))
- project-prefix-map)
- (if found
+ (if (when (symbolp command)
+ (or (string-prefix-p "project-" (symbol-name command))
+ (get command 'project-command)))
(let ((project-current-directory-override root))
(call-interactively command))
(let ((default-directory root))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 11b7b0d4abc: project-any-command: Change the method for passing project root,
Dmitry Gutov <=