unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: "Juan José García-Ripoll" <juanjose.garciaripoll@gmail.com>,
	emacs-devel@gnu.org
Subject: Re: Error in project-shell?
Date: Wed, 2 Mar 2022 04:30:25 +0200	[thread overview]
Message-ID: <aaf193a2-3896-de52-a140-027c33bab7e7@yandex.ru> (raw)
In-Reply-To: <86tucj82d0.fsf@csic.es>

[-- Attachment #1: Type: text/plain, Size: 290 bytes --]

Hi!

On 28.02.2022 16:58, Juan José García-Ripoll wrote:
> Unlike `shell`, `project-shell` does not realize when a process has
> ended. In that case it simply pops up a window that is dead and does not
> invoke the shell again. Is that a feature or a bug?

Please try the attached patch.

[-- Attachment #2: project-shell-undead.diff --]
[-- Type: text/x-patch, Size: 1219 bytes --]

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 4d6b93ceb5..c6f27e8b2e 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1004,6 +1004,8 @@ project-vc-dir
   (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.
@@ -1012,11 +1014,14 @@ project-shell
 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	other threads:[~2022-03-02  2:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 14:58 Error in project-shell? Juan José García-Ripoll
2022-03-02  2:30 ` Dmitry Gutov [this message]
2022-03-02  7:59   ` Juan José García-Ripoll
2022-03-05  2:34     ` Dmitry Gutov
2022-03-16 15:15       ` Juan José García-Ripoll
2022-03-19  2:14         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aaf193a2-3896-de52-a140-027c33bab7e7@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=juanjose.garciaripoll@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).