aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodor Thornhill2020-06-20 04:02:18 +0300
committerDmitry Gutov2020-06-20 04:02:18 +0300
commitbe5d0c0f63081b5aee5efe2fbcc5c4ace6ca9a02 (patch)
treea61b828b9a6865788b668f537a8e0c823ade8ea8
parent2eda8199bf3227f979edf532fae2d74892c27b5a (diff)
downloademacs-be5d0c0f63081b5aee5efe2fbcc5c4ace6ca9a02.tar.gz
emacs-be5d0c0f63081b5aee5efe2fbcc5c4ace6ca9a02.zip
project-shell: Pop to an existing shell buffer by default
* lisp/progmodes/project.el (project-shell): Pop to an existing shell buffer by default. If there's none, or if universal argument is used, open a subsequent shell buffer and jump to it. Prefix shell buffer name with the base name of project root directory. (Bug#41858)
-rw-r--r--lisp/progmodes/project.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index be1b801ca2b..d35bdf6ce0c 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -715,11 +715,20 @@ PREDICATE, HIST, and DEFAULT have the same meaning as in
715 715
716;;;###autoload 716;;;###autoload
717(defun project-shell () 717(defun project-shell ()
718 "Start an inferior shell in the current project's root directory." 718 "Start an inferior shell in the current project's root directory.
719With \\[universal-argument] prefix, create subsequent shell buffers
720with uniquified names."
719 (interactive) 721 (interactive)
720 (let ((default-directory (project-root (project-current t)))) 722 (let* ((default-directory (project-root (project-current t)))
721 ;; Use ‘create-file-buffer’ to uniquify shell buffer names. 723 (default-project-shell-name
722 (shell (create-file-buffer "*shell*")))) 724 (concat "*" (file-name-nondirectory
725 (directory-file-name
726 (file-name-directory default-directory)))
727 "-shell*"))
728 (shell-buffer (get-buffer default-project-shell-name)))
729 (if (and shell-buffer (not current-prefix-arg))
730 (pop-to-buffer shell-buffer)
731 (shell (generate-new-buffer-name default-project-shell-name)))))
723 732
724;;;###autoload 733;;;###autoload
725(defun project-eshell () 734(defun project-eshell ()