[Top][All Lists]

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

bug#7468: 24.0.50; Isearch highlighting

From: Juri Linkov
Subject: bug#7468: 24.0.50; Isearch highlighting
Date: Tue, 23 Nov 2010 01:34:29 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> I've also tried to copy that section of the manual into a brand new
> buffer, but there I can't reproduce the problem.

The difference between this recipe in a normal buffer and an Info buffer
is in the line

    (when (not isearch-error)

in `isearch-lazy-highlight-new-loop'.  A normal Isearch starts
a new lazy highlighting loop even if there are no matches,
so it has a chance to set `isearch-lazy-highlight-last-string'.
But an Isearch in Info has the text "Initial node" in `isearch-error',
so `isearch-lazy-highlight-new-loop' doesn't set the last search string
to `isearch-lazy-highlight-last-string'.

This bug is not specific to an Isearch in Info.  You can get the same bug
for a regexp Isearch in a normal buffer as:

1) Search for the regexp "foot[" (C-M-s foot[)
2) Remove the last "[" (<DEL>)

There is no lazy highlighting too.

I think this patch is a general fix for all these bug cases:

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el     2010-10-02 22:37:21 +0000
+++ lisp/isearch.el     2010-11-23 01:30:44 +0000
@@ -2628,6 +2628,7 @@ (defvar isearch-lazy-highlight-case-fold
 (defvar isearch-lazy-highlight-regexp nil)
 (defvar isearch-lazy-highlight-space-regexp nil)
 (defvar isearch-lazy-highlight-forward nil)
+(defvar isearch-lazy-highlight-error nil)
 (defun lazy-highlight-cleanup (&optional force)
   "Stop lazy highlighting and remove extra highlighting from current buffer.
@@ -2669,9 +2670,12 @@ (defun isearch-lazy-highlight-new-loop (
                  (not (= (window-end)   ; Window may have been split/joined.
                 (not (eq isearch-forward
-                         isearch-lazy-highlight-forward))))
+                         isearch-lazy-highlight-forward))
+                (not (eq isearch-error
+                         isearch-lazy-highlight-error))))
     ;; something important did indeed change
     (lazy-highlight-cleanup t) ;kill old loop & remove overlays
+    (setq isearch-lazy-highlight-error isearch-error)
     (when (not isearch-error)
       (setq isearch-lazy-highlight-start-limit beg
            isearch-lazy-highlight-end-limit end)

reply via email to

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