From: Juri Linkov <juri@linkov.net>
To: Drew Adams <drew.adams@oracle.com>
Cc: 21092@debbugs.gnu.org
Subject: bug#21092: 25.0.50; Option `lazy-highlight-max-at-a-time' does not work
Date: Wed, 02 Sep 2015 01:55:03 +0300 [thread overview]
Message-ID: <87mvx5oim0.fsf@mail.linkov.net> (raw)
In-Reply-To: <719ef340-0997-40fe-b1d8-c20c2a69155e@default> (Drew Adams's message of "Mon, 31 Aug 2015 14:35:31 -0700 (PDT)")
>> > You clearly do not want this done.
>>
>> Not at all. I only disagree that it's a bug.
>
> Good to hear. But it sure didn't sound like it:
>
> J >>> There is no need to highlight all matches in the buffer
> J >>> during Isearch.
> E >> What if someone wants to?
> J > Why would someone want such a strange thing?
>
> Anyway, I'm glad you agree now that such a strange thing can be useful.
I tried to find a useful application for this feature, and finally found.
> Whole buffer OR rest-of-buffer forward or backward. Au choix.
> Both behaviors are useful.
Since you can scroll up or down, highlighting the whole buffer is unavoidable.
> Not clear why you want a separate option for this. It cannot be
> used in combination with `lazy-highlight-max-at-a-time', can it?
Of course, it is useful in combination with ‘lazy-highlight-max-at-a-time’
that can define the incrementality (how many steps to do) regardless
whether highlighting the whole buffer or only matches on the screen.
> A second question concerns how to control whether this acts
> only in the current search direction or in both directions.
We can highlight only in the search direction because regexp
search might match different results depending on direction.
So you need to switch directions with ‘C-r’ to re-highlight
the buffer.
> For exmaple, I might want a toggle between max=10 and
> whole-buffer.
This will be possible with two separate variables:
the existing ‘lazy-highlight-max-at-a-time’
to toggle between max=10 and max=nil
and the new ‘lazy-highlight-buffer’
to toggle between whole-buffer and screen-only
implemented by this small patch:
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 8d4bf24..a53b314 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -332,6 +332,13 @@ (defcustom lazy-highlight-max-at-a-time 20
(integer :tag "Some"))
:group 'lazy-highlight)
+(defcustom lazy-highlight-buffer nil
+ "Highlight the whole buffer (for `lazy-highlight').
+A value of nil means highlight all matches on the screen.
+A value of t means highlight all matches in the whole buffer."
+ :type 'boolean
+ :group 'lazy-highlight)
+
(defface lazy-highlight
'((((class color) (min-colors 88) (background light))
(:background "paleturquoise"))
@@ -3029,10 +3040,12 @@ (defun isearch-lazy-highlight-new-loop (&optional beg end)
isearch-lax-whitespace))
(not (eq isearch-lazy-highlight-regexp-lax-whitespace
isearch-regexp-lax-whitespace))
- (not (= (window-start)
- isearch-lazy-highlight-window-start))
- (not (= (window-end) ; Window may have been split/joined.
- isearch-lazy-highlight-window-end))
+ (if lazy-highlight-buffer nil
+ (not (= (window-start)
+ isearch-lazy-highlight-window-start)))
+ (if lazy-highlight-buffer nil
+ (not (= (window-end) ; Window may have been split/joined.
+ isearch-lazy-highlight-window-end)))
(not (eq isearch-forward
isearch-lazy-highlight-forward))
;; In case we are recovering from an error.
@@ -3092,13 +3105,13 @@ (defun isearch-lazy-highlight-search ()
(+ isearch-lazy-highlight-start
;; Extend bound to match whole string at point
(1- (length isearch-lazy-highlight-last-string)))
- (window-end)))
+ (if lazy-highlight-buffer (point-max) (window-end))))
(max (or isearch-lazy-highlight-start-limit (point-min))
(if isearch-lazy-highlight-wrapped
(- isearch-lazy-highlight-end
;; Extend bound to match whole string at point
(1- (length isearch-lazy-highlight-last-string)))
- (window-start))))))
+ (if lazy-highlight-buffer (point-min) (window-start)))))))
;; Use a loop like in `isearch-search'.
(while retry
(setq success (isearch-search-string
@@ -3142,12 +3155,12 @@ (defun isearch-lazy-highlight-update ()
(if isearch-lazy-highlight-forward
(if (= mb (if isearch-lazy-highlight-wrapped
isearch-lazy-highlight-start
- (window-end)))
+ (if lazy-highlight-buffer (point-max) (window-end))))
(setq found nil)
(forward-char 1))
(if (= mb (if isearch-lazy-highlight-wrapped
isearch-lazy-highlight-end
- (window-start)))
+ (if lazy-highlight-buffer (point-min) (window-start))))
(setq found nil)
(forward-char -1)))
@@ -3174,12 +3187,12 @@ (defun isearch-lazy-highlight-update ()
(setq isearch-lazy-highlight-wrapped t)
(if isearch-lazy-highlight-forward
(progn
- (setq isearch-lazy-highlight-end (window-start))
+ (setq isearch-lazy-highlight-end (if lazy-highlight-buffer (point-min) (window-start)))
(goto-char (max (or isearch-lazy-highlight-start-limit (point-min))
- (window-start))))
- (setq isearch-lazy-highlight-start (window-end))
+ (if lazy-highlight-buffer (point-min) (window-start)))))
+ (setq isearch-lazy-highlight-start (if lazy-highlight-buffer (point-max) (window-end)))
(goto-char (min (or isearch-lazy-highlight-end-limit (point-max))
- (window-end))))))))
+ (if lazy-highlight-buffer (point-max) (window-end)))))))))
(unless nomore
(setq isearch-lazy-highlight-timer
(run-at-time lazy-highlight-interval nil
next prev parent reply other threads:[~2015-09-01 22:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <<9e1b9e19-6a1e-4241-a3e6-2876509e1423@default>
[not found] ` <<7245a30d-355a-425e-b19b-1c9ecc5e94e3@default>
[not found] ` <<83lhcv4wp4.fsf@gnu.org>
2015-08-28 15:19 ` bug#21092: 25.0.50; Option `lazy-highlight-max-at-a-time' does not work Drew Adams
2015-08-28 15:46 ` Eli Zaretskii
2015-08-28 21:14 ` Juri Linkov
2015-08-28 21:43 ` Drew Adams
2015-08-29 7:07 ` Eli Zaretskii
[not found] ` <<56e13714-27a7-47f9-93df-299b4a25457d@default>
[not found] ` <<83wpwf2z6m.fsf@gnu.org>
2015-08-28 15:59 ` Drew Adams
2015-08-28 16:03 ` Eli Zaretskii
[not found] ` <<e4ec2bca-0db5-43ba-a100-e99601d39e4c@default>
[not found] ` <<83twrj2ye6.fsf@gnu.org>
2015-08-28 16:15 ` Drew Adams
2015-08-28 16:44 ` Drew Adams
2015-08-28 16:59 ` Drew Adams
[not found] ` <<87si73dsjt.fsf@mail.linkov.net>
[not found] ` <<b0d4a886-77ae-4b58-b1b8-3b15999f5052@default>
[not found] ` <<83pp26373z.fsf@gnu.org>
2015-08-29 14:42 ` Drew Adams
2015-08-29 21:10 ` Juri Linkov
2015-08-30 2:40 ` Eli Zaretskii
2015-08-30 5:39 ` Drew Adams
2015-08-30 20:58 ` Juri Linkov
2015-08-30 22:39 ` Drew Adams
2015-08-31 20:01 ` Juri Linkov
2015-08-31 21:35 ` Drew Adams
2015-09-01 22:55 ` Juri Linkov [this message]
2015-09-02 0:07 ` Drew Adams
2015-09-02 22:40 ` Juri Linkov
2015-12-24 0:47 ` Juri Linkov
2017-02-22 0:16 ` Juri Linkov
2015-07-19 13:36 Drew Adams
2015-08-27 20:29 ` Drew Adams
2015-08-28 8:57 ` Eli Zaretskii
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=87mvx5oim0.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=21092@debbugs.gnu.org \
--cc=drew.adams@oracle.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 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.