From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Subject: Re: isearch highlighting with zero-length match
Date: Thu, 02 Sep 2004 18:00:43 +0900 [thread overview]
Message-ID: <wlllftf3k4.wl@church.math.s.chiba-u.ac.jp> (raw)
Could someone please take care of the following issue that I posted to
emacs-pretest-bug in January? Carbon Emacs no longer hangs with this,
but waste of CPU time would occur in any platform.
YAMAMOTO Mitsuharu
mituharu@math.s.chiba-u.ac.jp
[From http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-01/msg00052.html]
> A problem is found in isearch lazy highlighting when zero-length match
> occurs (including the case `isearch-string' is "").
> For example, typing `C-u C-s a ?' in the middle of a window highlights
> the area after the cursor, but not for the area before the cursor.
> For backward isearch, the starting point of the search for
> highlighting go beyond the visible part of the window (and waste CPU
> time).
> In Carbon Emacs for Mac OS X, this behavior of backward isearch
> sometimes causes long hang (but escapable with `C-g') if backward
> isearch is invoked at the head of a large buffer. (I'm not certain,
> but maybe the idle timer is taking precedence of keyboard input?)
> The attached patch solves the problem by taking account of the case of
> zero-length match at the search bound.
[This is a re-generated patch]
Index: lisp/isearch.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.236
diff -c -r1.236 isearch.el
*** lisp/isearch.el 1 Sep 2004 20:32:13 -0000 1.236
--- lisp/isearch.el 2 Sep 2004 08:55:48 -0000
***************
*** 2395,2401 ****
(let ((mb (match-beginning 0))
(me (match-end 0)))
(if (= mb me) ;zero-length match
! (forward-char 1)
;; non-zero-length match
(let ((ov (make-overlay mb me)))
--- 2395,2411 ----
(let ((mb (match-beginning 0))
(me (match-end 0)))
(if (= mb me) ;zero-length match
! (if isearch-forward
! (if (= mb (if isearch-lazy-highlight-wrapped
! isearch-lazy-highlight-start
! (window-end)))
! (setq found nil)
! (forward-char 1))
! (if (= mb (if isearch-lazy-highlight-wrapped
! isearch-lazy-highlight-end
! (window-start)))
! (setq found nil)
! (forward-char -1)))
;; non-zero-length match
(let ((ov (make-overlay mb me)))
***************
*** 2405,2423 ****
(push ov isearch-lazy-highlight-overlays)))
(if isearch-forward
(setq isearch-lazy-highlight-end (point))
! (setq isearch-lazy-highlight-start (point))))
! ;; not found
! (if isearch-lazy-highlight-wrapped
! (setq looping nil
! nomore t)
! (setq isearch-lazy-highlight-wrapped t)
! (if isearch-forward
! (progn
! (setq isearch-lazy-highlight-end (window-start))
! (goto-char (window-start)))
! (setq isearch-lazy-highlight-start (window-end))
! (goto-char (window-end)))))))
(unless nomore
(setq isearch-lazy-highlight-timer
(run-at-time isearch-lazy-highlight-interval nil
--- 2415,2434 ----
(push ov isearch-lazy-highlight-overlays)))
(if isearch-forward
(setq isearch-lazy-highlight-end (point))
! (setq isearch-lazy-highlight-start (point)))))
! ;; not found or zero-length match at the search bound
! (if (not found)
! (if isearch-lazy-highlight-wrapped
! (setq looping nil
! nomore t)
! (setq isearch-lazy-highlight-wrapped t)
! (if isearch-forward
! (progn
! (setq isearch-lazy-highlight-end (window-start))
! (goto-char (window-start)))
! (setq isearch-lazy-highlight-start (window-end))
! (goto-char (window-end)))))))
(unless nomore
(setq isearch-lazy-highlight-timer
(run-at-time isearch-lazy-highlight-interval nil
next reply other threads:[~2004-09-02 9:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-02 9:00 YAMAMOTO Mitsuharu [this message]
2004-09-03 21:53 ` isearch highlighting with zero-length match Juri Linkov
2004-09-04 22:12 ` Richard Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wlllftf3k4.wl@church.math.s.chiba-u.ac.jp \
--to=mituharu@math.s.chiba-u.ac.jp \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.