unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ^ and comint-prompt-regexp (was: [Emacs-diffs] master d58c29b: Revert last tweak in 'comint-output-filter')
       [not found] ` <20190312094904.0C64A203A7@vcs0.savannah.gnu.org>
@ 2019-03-12 16:25   ` Stefan Monnier
  2019-03-13 13:08     ` ^ and comint-prompt-regexp Andy Moreton
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2019-03-12 16:25 UTC (permalink / raw)
  To: emacs-devel; +Cc: Martin Rudalics

>     * lisp/comint.el (comint-output-filter): Revert last tweak because
>     it can hang gdb indefinitely.

Hmm... it would be worthwhile to investigate what's really going on here.

> -            (while (string-match (concat "\\(" comint-prompt-regexp
> +            (while (string-match (concat "\\(^" comint-prompt-regexp

Since comint-prompt-regexp almost always starts with "^", this change
seems to be fundamentally wrong: it will give a regexp of the form
\(^^...\) which interprets the second ^ as an actual ^ char rather than
as a `bolp` check.

So if it avoids a problem, it's likely not the right fix but rather
because it just deactivates this loop.

As the original author of this code, I must admit that I don't fully
understand why this loop is here (it seems redundant with the
immediately preceding loop, which was introduced by the same commit).

Maybe we should just comment it out.


        Stefan



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

* Re: ^ and comint-prompt-regexp
  2019-03-12 16:25   ` ^ and comint-prompt-regexp (was: [Emacs-diffs] master d58c29b: Revert last tweak in 'comint-output-filter') Stefan Monnier
@ 2019-03-13 13:08     ` Andy Moreton
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Moreton @ 2019-03-13 13:08 UTC (permalink / raw)
  To: emacs-devel

On Tue 12 Mar 2019, Stefan Monnier wrote:

>>     * lisp/comint.el (comint-output-filter): Revert last tweak because
>>     it can hang gdb indefinitely.
>
> Hmm... it would be worthwhile to investigate what's really going on here.
>
>> -            (while (string-match (concat "\\(" comint-prompt-regexp
>> +            (while (string-match (concat "\\(^" comint-prompt-regexp
>
> As the original author of this code, I must admit that I don't fully
> understand why this loop is here (it seems redundant with the
> immediately preceding loop, which was introduced by the same commit).

It looks to me that the first loop only removes prompts that match the
previous prompt found in the buffer text. The second loop removes any
prompts that match the regexp (which may not be the same as the previous
prompt if `comint-prompt-regexp' contains alternatives).

I presume it was done this way to be slightly faster ?

    AndyM




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

end of thread, other threads:[~2019-03-13 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190312094902.2911.17151@vcs0.savannah.gnu.org>
     [not found] ` <20190312094904.0C64A203A7@vcs0.savannah.gnu.org>
2019-03-12 16:25   ` ^ and comint-prompt-regexp (was: [Emacs-diffs] master d58c29b: Revert last tweak in 'comint-output-filter') Stefan Monnier
2019-03-13 13:08     ` ^ and comint-prompt-regexp Andy Moreton

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