diff options
| author | Dmitry Gutov | 2020-05-19 01:00:43 +0300 |
|---|---|---|
| committer | Simen Heggestøyl | 2020-05-26 17:41:45 +0200 |
| commit | 0b057ca9bcfa2bbef57f7e5a1da47d62f4f1f15a (patch) | |
| tree | e4704d560eb1f57aff8dd6a6bd3c4158026639b2 | |
| parent | 0db801a3adf8e8584c9b071764200259336a8434 (diff) | |
| download | emacs-0b057ca9bcfa2bbef57f7e5a1da47d62f4f1f15a.tar.gz emacs-0b057ca9bcfa2bbef57f7e5a1da47d62f4f1f15a.zip | |
Teach project-current to inhibit the prompt
* lisp/progmodes/project.el:
(project-current-inhibit-prompt): New variable.
(project-current, project-switch-project): Use it.
| -rw-r--r-- | lisp/progmodes/project.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 956a4b8a345..132d172a08e 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -101,6 +101,9 @@ Each functions on this hook is called in turn with one | |||
| 101 | argument (the directory) and should return either nil to mean | 101 | argument (the directory) and should return either nil to mean |
| 102 | that it is not applicable, or a project instance.") | 102 | that it is not applicable, or a project instance.") |
| 103 | 103 | ||
| 104 | (defvar project-current-inhibit-prompt nil | ||
| 105 | "Non-nil to skip prompting the user in `project-current'.") | ||
| 106 | |||
| 104 | ;;;###autoload | 107 | ;;;###autoload |
| 105 | (defun project-current (&optional maybe-prompt dir) | 108 | (defun project-current (&optional maybe-prompt dir) |
| 106 | "Return the project instance in DIR or `default-directory'. | 109 | "Return the project instance in DIR or `default-directory'. |
| @@ -110,7 +113,8 @@ the user for a different project to look in." | |||
| 110 | (let ((pr (project--find-in-directory dir))) | 113 | (let ((pr (project--find-in-directory dir))) |
| 111 | (cond | 114 | (cond |
| 112 | (pr) | 115 | (pr) |
| 113 | (maybe-prompt | 116 | ((unless project-current-inhibit-prompt |
| 117 | maybe-prompt) | ||
| 114 | (setq dir (project-prompt-project-dir) | 118 | (setq dir (project-prompt-project-dir) |
| 115 | pr (project--find-in-directory dir)))) | 119 | pr (project--find-in-directory dir)))) |
| 116 | (if pr | 120 | (if pr |
| @@ -829,7 +833,8 @@ and presented in a dispatch menu." | |||
| 829 | (setq choice (read-key-sequence (project--keymap-prompt)))) | 833 | (setq choice (read-key-sequence (project--keymap-prompt)))) |
| 830 | (if (equal choice (kbd "C-g")) | 834 | (if (equal choice (kbd "C-g")) |
| 831 | (message "Quit") | 835 | (message "Quit") |
| 832 | (let ((default-directory dir)) | 836 | (let ((default-directory dir) |
| 837 | (project-current-inhibit-prompt t)) | ||
| 833 | (call-interactively | 838 | (call-interactively |
| 834 | (nth 2 (assoc choice project-switch-commands))))))) | 839 | (nth 2 (assoc choice project-switch-commands))))))) |
| 835 | 840 | ||