unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Error in project-shell?
@ 2022-02-28 14:58 Juan José García-Ripoll
  2022-03-02  2:30 ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Juan José García-Ripoll @ 2022-02-28 14:58 UTC (permalink / raw)
  To: emacs-devel

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?

Cheers,

-- 
Juan José García Ripoll
http://juanjose.garciaripoll.com
http://quinfog.hbar.es




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error in project-shell?
  2022-02-28 14:58 Error in project-shell? Juan José García-Ripoll
@ 2022-03-02  2:30 ` Dmitry Gutov
  2022-03-02  7:59   ` Juan José García-Ripoll
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2022-03-02  2:30 UTC (permalink / raw)
  To: Juan José García-Ripoll, emacs-devel

[-- 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Error in project-shell?
  2022-03-02  2:30 ` Dmitry Gutov
@ 2022-03-02  7:59   ` Juan José García-Ripoll
  2022-03-05  2:34     ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Juan José García-Ripoll @ 2022-03-02  7:59 UTC (permalink / raw)
  To: emacs-devel

Thanks!

Dmitry Gutov <dgutov@yandex.ru> writes:
> 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.

-- 
Juan José García Ripoll
http://juanjose.garciaripoll.com
http://quinfog.hbar.es




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error in project-shell?
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2022-03-05  2:34 UTC (permalink / raw)
  To: Juan José García-Ripoll, emacs-devel

On 02.03.2022 09:59, Juan José García-Ripoll wrote:
> Thanks!
> 
> Dmitry Gutov <dgutov@yandex.ru> writes:
>> 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.

Thanks for testing, pushed to master.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error in project-shell?
  2022-03-05  2:34     ` Dmitry Gutov
@ 2022-03-16 15:15       ` Juan José García-Ripoll
  2022-03-19  2:14         ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Juan José García-Ripoll @ 2022-03-16 15:15 UTC (permalink / raw)
  To: emacs-devel

I have been doing further tests and I think that the actual definition
should read as follows

(defun project-shell-fix ()
  "Fixed version for project-shell"
  (interactive)
  (require 'comint)
  (let* ((default-directory (expand-file-name (project-root (project-current t))))
         (default-project-shell-name (project-prefixed-buffer-name "shell"))
         (shell-buffer (get-buffer default-project-shell-name)))
	(if (comint-check-proc shell-buffer)
        (pop-to-buffer shell-buffer (bound-and-true-p display-comint-buffer-action))
      (shell (or shell-buffer default-project-shell-name)))))

The change in the last line is needed, because otherwise the shell is
created with the wrong name.

-- 
Juan José García Ripoll
http://juanjose.garciaripoll.com
http://quinfog.hbar.es




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Error in project-shell?
  2022-03-16 15:15       ` Juan José García-Ripoll
@ 2022-03-19  2:14         ` Dmitry Gutov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2022-03-19  2:14 UTC (permalink / raw)
  To: Juan José García-Ripoll, emacs-devel

Hi again,

On 16.03.2022 17:15, Juan José García-Ripoll wrote:
> I have been doing further tests and I think that the actual definition
> should read as follows
> 
> (defun project-shell-fix ()
>    "Fixed version for project-shell"
>    (interactive)
>    (require 'comint)
>    (let* ((default-directory (expand-file-name (project-root (project-current t))))
>           (default-project-shell-name (project-prefixed-buffer-name "shell"))
>           (shell-buffer (get-buffer default-project-shell-name)))
> 	(if (comint-check-proc shell-buffer)
>          (pop-to-buffer shell-buffer (bound-and-true-p display-comint-buffer-action))
>        (shell (or shell-buffer default-project-shell-name)))))
> 
> The change in the last line is needed, because otherwise the shell is
> created with the wrong name.

Could you describe what happens in more detail? Which wrong name?

And what about other changes? The version you showed differs from the 
current code in more than just the last line.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-19  2:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 14:58 Error in project-shell? Juan José García-Ripoll
2022-03-02  2:30 ` Dmitry Gutov
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

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).