unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: isearch-push-state
Date: Wed, 12 Mar 2008 12:36:02 +0200	[thread overview]
Message-ID: <874pbcgrfx.fsf@jurta.org> (raw)
In-Reply-To: <jwvmyp5kv6q.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 11 Mar 2008 13:55:08 -0400")

> Thanks Juri.  I'm not sure I understand what you said: are you saying
> that those extra state-pushes are just unnecessary or are they
> really harmful?

They are both unnecessary and harmful for different reasons.

They are unnecessary when doing backtracking with DEL.  They add an
unnecessary and inconsistent state that puts point to the beginning
of the previous successful match, lazy-highlights matches
for the string later entered in the minibuffer, and no string
is highlighted at the current successful match.

So for instance, `C-s foo M-e C-a C-k bar C-s DEL' in a buffer
where both strings "foo" and "bar" exist, isearch enters the
state where point is on "foo", the echo area displays
"I-search: bar", "bar" is highlighted in `lazy-highlight' face,
and no string is highlighted in `isearch' face even though
the echo area says it returned to the state where it successfully
found the string "bar".

The first part of my patch removes this inconsistent state in
`isearch-edit-string', but keeps the second call to `isearch-push-state'
that records the correct state after searching for a new string.

The second part of the patch (in `isearch-ring-adjust') removes the state
that is a duplicate of the state added by `isearch-edit-string'.

> It seems they are harmful w.r.t the new failed-search-highlight
> thingy, but shouldn't the failed-search-highlight thingy try to pop
> several states until findind one that does succeed?

This is what it already tries to do, but fails when encounters an
inconsistent state, e.g. `C-s foo M-e C-a C-k bar C-s in a buffer
where only the string "foo" exists, the stack contains a state
marked as successful with the failed search string:

(["bar" "bar" 194 nil t nil nil nil nil 192 t nil]
 ["bar" "bar" 194 197 t nil nil nil nil 192 t nil] <-- wrong state
 ["foo" "foo" 197 197 t 194 nil nil nil 192 t nil]
 ["fo"  "fo"  196 196 t 194 nil nil nil 192 t nil]
 ["f"   "f"   195 195 t 194 nil nil nil 192 t nil]
 [""    ""    192 t   t nil nil nil nil 192 t nil])

> I'm not sure I like the idea that "spurious" state pushes can really
> be harmful.
>
> This said, wherever you remove those pushes, please replace them with
> a comment mentioning that it was there and why you think
> it's unnecessary.

OK, will do.

-- 
Juri Linkov
http://www.jurta.org/emacs/




  reply	other threads:[~2008-03-12 10:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AD44E90D-EAA9-4E0B-AED7-CB4505DC73F9@t-online.de>
     [not found] ` <87myp99rd3.fsf@jurta.org>
2008-03-09 21:59   ` First two elements of search-ring shown twice in minibuffer when using M-p multiple times? Juri Linkov
2008-03-10 14:31     ` Stefan Monnier
2008-03-10 17:12       ` Word search (was: First two elements of search-ring shown twice in minibuffer when using M-p multiple times?) Juri Linkov
2008-03-10 18:34         ` Word search Stefan Monnier
2008-03-10 22:38           ` Juri Linkov
2008-03-11 18:47             ` Stefan Monnier
2008-03-12  0:35               ` Juri Linkov
2008-03-12  1:49                 ` Stefan Monnier
2008-03-12 10:38                   ` Juri Linkov
2008-03-12 14:09                     ` Stefan Monnier
2008-03-12 17:51                 ` Richard Stallman
2008-03-11 20:24             ` Richard Stallman
2008-03-12  0:37               ` Juri Linkov
2008-03-12 17:51                 ` Richard Stallman
2008-03-13  2:08                   ` Juri Linkov
2008-03-13 22:24                     ` Richard Stallman
2008-03-13 10:55                   ` René Kyllingstad
2008-03-14  1:08                     ` Juri Linkov
2008-03-12 19:18                 ` Drew Adams
2008-03-13  1:06                   ` Richard Stallman
2008-03-13  2:17                   ` Juri Linkov
2008-03-13 22:24                     ` Richard Stallman
2008-03-10 16:36     ` First two elements of search-ring shown twice in minibuffer when using M-p multiple times? Tobias Bading
2008-03-10 16:55       ` Juri Linkov
2008-03-10 17:59     ` isearch-push-state (was: First two elements of search-ring shown twice in minibuffer when using M-p multiple times?) Juri Linkov
2008-03-11 17:55       ` isearch-push-state Stefan Monnier
2008-03-12 10:36         ` Juri Linkov [this message]
2008-03-12 14:07           ` isearch-push-state Stefan Monnier
2008-03-10 18:28     ` First two elements of search-ring shown twice in minibuffer when using M-p multiple times? Juri Linkov

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=874pbcgrfx.fsf@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).