summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2020-12-09 22:56:12 +0200
committerDmitry Gutov <dgutov@yandex.ru>2020-12-09 22:56:48 +0200
commit5af6a87d51fd5008c05876616c665679ffd0a597 (patch)
treebe4d0821826147eade57393793cf8bf78d959ee2 /lisp/progmodes
parentea8ff97536905ebc9157dd2194aaf68a17099b81 (diff)
downloademacs-5af6a87d51fd5008c05876616c665679ffd0a597.tar.gz
emacs-5af6a87d51fd5008c05876616c665679ffd0a597.tar.bz2
emacs-5af6a87d51fd5008c05876616c665679ffd0a597.zip
Allow specifying the project to switch to programmatically
* lisp/progmodes/project.el (project-switch-project): Allow specifying the project to switch to programmatically (bug#45134).
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/project.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 449eadc3de7..98ad41487a1 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1275,13 +1275,15 @@ the menu entries in the dispatch menu.")
" "))
;;;###autoload
-(defun project-switch-project ()
+(defun project-switch-project (dir)
"\"Switch\" to another project by running an Emacs command.
The available commands are presented as a dispatch menu
-made from `project-switch-commands'."
- (interactive)
- (let ((dir (project-prompt-project-dir))
- (choice nil))
+made from `project-switch-commands'.
+
+When called in a program, it will use the project corresponding
+to directory DIR."
+ (interactive (list (project-prompt-project-dir)))
+ (let ((choice nil))
(while (not choice)
(setq choice (assq (read-event (project--keymap-prompt))
project-switch-commands)))