unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Vitalie Spinu <spinuvit@gmail.com>
Cc: 19710@debbugs.gnu.org
Subject: bug#19710: 24.4.51; Isearch is broken in comints which relly on regexp
Date: Wed, 18 Feb 2015 19:01:52 +0200	[thread overview]
Message-ID: <874mqjfa3n.fsf@mail.linkov.net> (raw)
In-Reply-To: <878ufvkyd9.fsf@gmail.com> (Vitalie Spinu's message of "Wed, 18 Feb 2015 17:55:46 +0200")

> 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	other threads:[~2015-02-18 17:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28  9:10 bug#19710: 24.4.51; Isearch is broken in comints which relly on regexp Vitalie Spinu
2015-01-29  0:50 ` Juri Linkov
2015-01-29  8:13   ` Vitalie Spinu
2015-02-05  0:57     ` Juri Linkov
2015-02-05 10:03       ` Vitalie Spinu
2015-02-10  0:39         ` Juri Linkov
2015-02-18 15:55           ` Vitalie Spinu
2015-02-18 17:01             ` Juri Linkov [this message]
2015-02-18 17:46               ` Eli Zaretskii
2015-02-18 18:20                 ` Juri Linkov
2015-02-18 18:18               ` Vitalie Spinu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874mqjfa3n.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=19710@debbugs.gnu.org \
    --cc=spinuvit@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).