Subject: Re: bug#30187: master a710f8a: * lisp/comint.el (comint-history-isearch-setup): Check if process is live.

From: Leo Liu <[email-masked]>
Date: Thu, 08 Feb 2018 11:13:46 +0800

On 2018-02-07 23:20 +0200, Juri Linkov wrote:
> Before this fix the search was broken in *Async Shell Command*
> and in inactive shells.

Thanks. I tried the following examples and saw their failures.

>
> For example, try to set comint-history-isearch to ‘dwim’
> and type ‘C-r’ in a *Async Shell Command* buffer.  It fails with
>
>   Lisp error: (wrong-type-argument processp nil)
>   process-mark(nil)
>   comint-after-pmark-p()
>   comint-history-isearch-setup()
>   ...

It seems to make a lot of sense to have comint-after-pmark-p return nil
instead. WDYT?

> Or even when comint-history-isearch is nil by default, run shell ‘M-x shell’,
> then exit it, and after “Process shell finished” type ‘M-r’ and any letter
> to search for it:
>
>   Lisp error: (wrong-type-argument processp nil)
>   process-mark(nil)
>   comint-delete-input()
>   comint-goto-input(nil)
>   comint-history-isearch-pop-state
>   ...
>
> In these cases the history can't be searched because there is no active shell.
> I wonder what use case do you need in inactive shells without a prompt,
> so it's impossible to search in the history.  How you used to search
> through the shell history without failing in ‘comint-goto-input’ like
> in the backtrace above?

My use case is using a function (or in Erlang's lingo a light-weight
process) to communicate with a remote Erlang shell. So there is no
process as comint/emacs understands.

Leo