bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#19710: 24.4.51; Isearch is broken in comints which relly on regexp


From: Juri Linkov
Subject: bug#19710: 24.4.51; Isearch is broken in comints which relly on regexp
Date: Wed, 18 Feb 2015 19:01:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu)

> Relatedly, comint-bol inside multiline output regions is broken.
>
> In shell buffer:
>
>    $ locate pwd
>
> then go to a previous line and M-x comint-bol. It will jump all the way
> back to comint-prompt-regexp.

The following patch for the emacs-24 branch should fix this regression.

It distinguishes two cases: when point is on the output or input
depending on the field property, for the case of comint-use-prompt-regexp=nil.

This means that we can't support multi-line commands for the case
when comint-use-prompt-regexp=t because it doesn't use fields, thus
there is no way to distinguish input from output.

So for comint-use-prompt-regexp=t `M-x comint-bol' will work
as in the previous release, but `M-x comint-bol' will be
fixed for comint-use-prompt-regexp=nil:

diff --git a/lisp/comint.el b/lisp/comint.el
index c81551a..2532dd7 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2267,8 +2267,6 @@ (defun comint-line-beginning-position ()
       ;; Use comint-prompt-regexp
       (save-excursion
        (beginning-of-line)
-       (unless (looking-at comint-prompt-regexp)
-         (re-search-backward comint-prompt-regexp nil t))
        (comint-skip-prompt)
        (point))
     ;; Use input fields.  Note that, unlike the behavior of
@@ -2278,7 +2276,10 @@ (defun comint-line-beginning-position ()
     ;; if there are two fields on a line, then the first one is the
     ;; prompt, and the second one is an input field, and is front-sticky
     ;; (as input fields should be).
-    (constrain-to-field (field-beginning) (line-end-position))))
+    (constrain-to-field (if (eq (field-at-pos (point)) 'output)
+                           (line-beginning-position)
+                         (field-beginning))
+                       (line-end-position))))
 
 (defun comint-bol (&optional arg)
   "Go to the beginning of line, then skip past the prompt, if any.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]