From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <87mvx5oim0.fsf@mail.linkov.net> References: <6ef534bf-ecf3-48a4-9414-46de26d911c7@default> <87oahpbxu1.fsf@mail.linkov.net> <83r3ml1ou6.fsf@gnu.org> <87h9ng4ho0.fsf@mail.linkov.net> <7d3e51a1-945f-497e-8af1-449cd4151ca1@default> <87y4grw7kx.fsf@mail.linkov.net> <719ef340-0997-40fe-b1d8-c20c2a69155e@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1441148363 23540 80.91.229.3 (1 Sep 2015 22:59:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Sep 2015 22:59:23 +0000 (UTC) Cc: 21092@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 02 00:59:11 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZWuWE-0005UD-Qa for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Sep 2015 00:59:11 +0200 Original-Received: from localhost ([::1]:59244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWuWE-0008Qt-6W for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Sep 2015 18:59:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWuW8-0008Qd-0u for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2015 18:59:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWuW6-0000aB-Ti for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2015 18:59:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWuW6-0000Zy-R2 for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2015 18:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZWuW6-0001SM-Ca for bug-gnu-emacs@gnu.org; Tue, 01 Sep 2015 18:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 01 Sep 2015 22:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21092 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21092-submit@debbugs.gnu.org id=B21092.14411483365583 (code B ref 21092); Tue, 01 Sep 2015 22:59:02 +0000 Original-Received: (at 21092) by debbugs.gnu.org; 1 Sep 2015 22:58:56 +0000 Original-Received: from localhost ([127.0.0.1]:45475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWuW0-0001Ry-3f for submit@debbugs.gnu.org; Tue, 01 Sep 2015 18:58:56 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:57223 helo=homiemail-a76.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZWuVw-0001Rj-UU for 21092@debbugs.gnu.org; Tue, 01 Sep 2015 18:58:54 -0400 Original-Received: from homiemail-a76.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a76.g.dreamhost.com (Postfix) with ESMTP id D415E45808A; Tue, 1 Sep 2015 15:58:51 -0700 (PDT) Original-Received: from localhost.linkov.net (m212-53-118-114.cust.tele2.ee [212.53.118.114]) (Authenticated sender: jurta@jurta.org) by homiemail-a76.g.dreamhost.com (Postfix) with ESMTPA id B5B5D458088; Tue, 1 Sep 2015 15:58:50 -0700 (PDT) In-Reply-To: <719ef340-0997-40fe-b1d8-c20c2a69155e@default> (Drew Adams's message of "Mon, 31 Aug 2015 14:35:31 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106074 Archived-At: >> > 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 unavoid= able. > 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 =E2=80=98lazy-highlight-max-a= t-a-time=E2=80=99 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 =E2=80=98C-r=E2=80=99 to re-highlig= ht the buffer. > For exmaple, I might want a toggle between max=3D10 and > whole-buffer. This will be possible with two separate variables: the existing =E2=80=98lazy-highlight-max-at-a-time=E2=80=99 to toggle between max=3D10 and max=3Dnil and the new =E2=80=98lazy-highlight-buffer=E2=80=99 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) =20 +(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 (=3D (window-start) - isearch-lazy-highlight-window-start)) - (not (=3D (window-end) ; Window may have been split/j= oined. - isearch-lazy-highlight-window-end)) + (if lazy-highlight-buffer nil + (not (=3D (window-start) + isearch-lazy-highlight-window-start))) + (if lazy-highlight-buffer nil + (not (=3D (window-end) ; Window may have been split/j= oined. + 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 (=3D 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 (=3D 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))) =20 @@ -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-m= ax) (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