all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Invoking gdb hangs after tweak in comint.el
@ 2019-03-12  9:51 martin rudalics
  2019-03-12 12:07 ` Mattias Engdegård
  0 siblings, 1 reply; 4+ messages in thread
From: martin rudalics @ 2019-03-12  9:51 UTC (permalink / raw)
  To: emacs-devel

This change

diff --git a/lisp/comint.el b/lisp/comint.el
index a5fca7e..e5012be 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2081,7 +2081,7 @@ Make backspaces delete the previous character."
                         (prompt-re (concat "\\`" (regexp-quote prompt))))
                    (while (string-match prompt-re string)
                      (setq string (substring string (match-end 0)))))))
-            (while (string-match (concat "\\(^" comint-prompt-regexp
+            (while (string-match (concat "\\(" comint-prompt-regexp
                                           "\\)\\1+")
                                   string)
                (setq string (replace-match "\\1" nil nil string)))

hangs Emacs indefinitely when I invoke gdb via say

M-x gdb -i=mi home/martin/emacs-git/trunk/obj-gtk/src/emacs

and I subsequently have to kill the Emacs process with the task
manager.

I have reverted that tweak for now.  Please consider a different
solution.

Thanks in advance, martin



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

* Re: Invoking gdb hangs after tweak in comint.el
  2019-03-12  9:51 Invoking gdb hangs after tweak in comint.el martin rudalics
@ 2019-03-12 12:07 ` Mattias Engdegård
  2019-03-19  0:47   ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Mattias Engdegård @ 2019-03-12 12:07 UTC (permalink / raw)
  To: martin rudalics, emacs-devel

tis 2019-03-12 klockan 10:51 +0100 skrev martin rudalics:
> -            (while (string-match (concat "\\(^" comint-prompt-regexp
> +            (while (string-match (concat "\\(" comint-prompt-regexp
>                                            "\\)\\1+")
>                                    string)
>                 (setq string (replace-match "\\1" nil nil string)))

And this shows just how good my review of that change was. Sorry!
That code never worked in the first place; only Paul Eggert's fix
exposed its brokenness for us all to see. (comint-prompt-regexp is "^",
making the loop infinite.)

A comint expert needs to look at it, but since the loop never worked,
perhaps it could be removed entirely? Either that, or add a condition:

-            (while (string-match (concat "\\(^" comint-prompt-regexp
-                                         "\\)\\1+")
-                                 string)
+            (while (and (string-match (concat "\\(" comint-prompt-
regexp
+                                              "\\)\\1+")
+                                      string)
+                        (> (match-end 1) (match-beginning 1)))




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

* Re: Invoking gdb hangs after tweak in comint.el
  2019-03-12 12:07 ` Mattias Engdegård
@ 2019-03-19  0:47   ` Paul Eggert
  2019-04-23  9:21     ` martin rudalics
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2019-03-19  0:47 UTC (permalink / raw)
  To: Mattias Engdegård, martin rudalics, emacs-devel

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

On 3/12/19 5:07 AM, Mattias Engdegård wrote:
>
> A comint expert needs to look at it, but since the loop never worked,
> perhaps it could be removed entirely?

Stefan would be a good person to look at it since he wrote the code. In
the meantime I installed the attached, with a commit message that I hope
explains things.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Remove-buggy-regexp-use-in-comint-output-filter.patch --]
[-- Type: text/x-patch; name="0001-Remove-buggy-regexp-use-in-comint-output-filter.patch", Size: 2202 bytes --]

From 8bd3aa929a0ce6510d7c7550070f569caa65ec5e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 18 Mar 2019 17:44:21 -0700
Subject: [PATCH] Remove buggy regexp use in comint-output-filter
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This reverts commit 2012-07-02T16:18:02!monnier@iro.umontreal.ca
which perhaps could be rethought and recommitted, and perhaps
it’s no longer needed now that comint-use-prompt-regexp
is almost always nil.
* lisp/comint.el (comint-output-filter): Don’t try to skip
repeated prompts, since comint-prompt-regexp typically begins
with "^" and the resulting "^^" in the regular expression does
not have the desired effect.  Noted by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00380.html
---
 lisp/comint.el | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/lisp/comint.el b/lisp/comint.el
index a71821baa5..d21cc1378f 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2072,20 +2072,6 @@ comint-output-filter
 	    (goto-char (process-mark process))
 	    (set-marker comint-last-output-start (point))
 
-            ;; Try to skip repeated prompts, which can occur as a result of
-            ;; commands sent without inserting them in the buffer.
-            (let ((bol (save-excursion (forward-line 0) (point)))) ;No fields.
-              (when (and (not (bolp))
-                         (looking-back comint-prompt-regexp bol))
-                (let* ((prompt (buffer-substring bol (point)))
-                       (prompt-re (concat "\\`" (regexp-quote prompt))))
-                  (while (string-match prompt-re string)
-                    (setq string (substring string (match-end 0)))))))
-            (while (string-match (concat "\\(^" comint-prompt-regexp
-                                         "\\)\\1+")
-                                 string)
-              (setq string (replace-match "\\1" nil nil string)))
-
 	    ;; insert-before-markers is a bad thing. XXX
 	    ;; Luckily we don't have to use it any more, we use
 	    ;; window-point-insertion-type instead.
-- 
2.20.1


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

* Re: Invoking gdb hangs after tweak in comint.el
  2019-03-19  0:47   ` Paul Eggert
@ 2019-04-23  9:21     ` martin rudalics
  0 siblings, 0 replies; 4+ messages in thread
From: martin rudalics @ 2019-04-23  9:21 UTC (permalink / raw)
  To: Paul Eggert, Mattias Engdegård, emacs-devel

> Stefan would be a good person to look at it since he wrote the code. In
> the meantime I installed the attached, with a commit message that I hope
> explains things.

Thanks for the fix.

martin





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

end of thread, other threads:[~2019-04-23  9:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-12  9:51 Invoking gdb hangs after tweak in comint.el martin rudalics
2019-03-12 12:07 ` Mattias Engdegård
2019-03-19  0:47   ` Paul Eggert
2019-04-23  9:21     ` martin rudalics

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.