emacs-diffs
[Top][All Lists]
Advanced

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

master a658be7742: project-shell: Ensure the resulting buffer is live


From: Dmitry Gutov
Subject: master a658be7742: project-shell: Ensure the resulting buffer is live
Date: Fri, 4 Mar 2022 21:34:07 -0500 (EST)

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

    project-shell: Ensure the resulting buffer is live
    
    * lisp/progmodes/project.el (project-shell):
    Make sure to recreate the shell if the buffer exists but not live
    (https://lists.gnu.org/archive/html/emacs-devel/2022-03/msg00017.html).
---
 lisp/progmodes/project.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index b44f4618be..daaf86f327 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1007,6 +1007,8 @@ directories listed in `vc-directory-exclusion-list'."
   (interactive)
   (vc-dir (project-root (project-current t))))
 
+(declare-function comint-check-proc "comint")
+
 ;;;###autoload
 (defun project-shell ()
   "Start an inferior shell in the current project's root directory.
@@ -1015,11 +1017,14 @@ switch to it.  Otherwise, create a new shell buffer.
 With \\[universal-argument] prefix arg, create a new inferior shell buffer even
 if one already exists."
   (interactive)
+  (require 'comint)
   (let* ((default-directory (project-root (project-current t)))
          (default-project-shell-name (project-prefixed-buffer-name "shell"))
          (shell-buffer (get-buffer default-project-shell-name)))
     (if (and shell-buffer (not current-prefix-arg))
-        (pop-to-buffer shell-buffer (bound-and-true-p 
display-comint-buffer-action))
+        (if (comint-check-proc shell-buffer)
+            (pop-to-buffer shell-buffer (bound-and-true-p 
display-comint-buffer-action))
+          (shell shell-buffer))
       (shell (generate-new-buffer-name default-project-shell-name)))))
 
 ;;;###autoload



reply via email to

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