emacs-devel
[Top][All Lists]
Advanced

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

Re: highlight failed part of isearch input


From: Juri Linkov
Subject: Re: highlight failed part of isearch input
Date: Sun, 15 Jul 2007 02:05:40 +0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

>     I think we should try to find a proper place in low-level isearch
>     functions to fix such behavior, because for users it is confusing.
>
> I agree.  Can you work on it?

The patch below fixes `isearch-del-char' to work correctly in all
reported cases.  It failed because `isearch-search-and-update' works
only for adding characters to the successful search (it doesn't call
`isearch-search' for unsuccessful non-regexp search).

A new solution is to set search starting point to the isearch-other-end
and start the search from this position and try to find the remaining
string again.

Index: lisp/isearch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.298
diff -c -r1.298 isearch.el
*** lisp/isearch.el     9 Jul 2007 14:45:01 -0000       1.298
--- lisp/isearch.el     14 Jul 2007 22:59:45 -0000
***************
*** 1260,1269 ****
        (ding)
      (setq isearch-string (substring isearch-string 0 (- (or arg 1)))
            isearch-message (mapconcat 'isearch-text-char-description
!                                      isearch-string "")
!           ;; Don't move cursor in reverse search.
!           isearch-yank-flag t))
!   (isearch-search-and-update))
  
  (defun isearch-yank-string (string)
    "Pull STRING into search string."
--- 1284,1296 ----
        (ding)
      (setq isearch-string (substring isearch-string 0 (- (or arg 1)))
            isearch-message (mapconcat 'isearch-text-char-description
!                                      isearch-string "")))
!   ;; Use the isearch-other-end as new starting point to be able
!   ;; to find the remaining part of the search string again.
!   (if isearch-other-end (goto-char isearch-other-end))
!   (isearch-search)
!   (isearch-push-state)
!   (isearch-update))
  
  (defun isearch-yank-string (string)
    "Pull STRING into search string."

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




reply via email to

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