GNU bug report logs - #18131
24.4.50; View-search-... skips all matches between (point) and edge of window

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Mon, 28 Jul 2014 18:08:01 UTC

Severity: minor

Tags: fixed, patch

Found in version 24.4.50

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18131 in the body.
You can then email your comments to 18131 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18131; Package emacs. (Mon, 28 Jul 2014 18:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dima <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 28 Jul 2014 18:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4.50;
 View-search-... skips all matches between (point) and edge of window
Date: Mon, 28 Jul 2014 11:06:59 -0700
[Message part 1 (text/plain, inline)]
Hi.

The emacs view-mode has navigation with 'n' and 'p' keys to navigate by
searching (like isearch, but with fewer keystrokes and very similar to
less and vi).

I just discovered that unlike less and vi, this view-mode navigation
doesn't hit all the matches, but rather skips the ones between (point)
and the edge of the window. This ensures that any matches that are
visible by the user (but not highlighted by view-mode) are skipped.

This clearly was a design choice, rather than a bug. However, the
documentation doesn't mention this, and I think it is counterintuitive.
Attaching a very simple patch to fix.


[0001-View-search-.-now-hit-all-the-matches-regardless-of-.patch (text/x-diff, inline)]
From ed227e61fe92c54c18542455448ed7f28d0c9e77 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
Date: Mon, 28 Jul 2014 11:05:00 -0700
Subject: [PATCH] View-search-... now hit all the matches, regardless of window
 position

Prior to this patch anything between (point) and the edge of the window was
skipped. This was counterintuitive (not what less or vim do) and was not
mentioned in the documentation
---
 lisp/view.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/view.el b/lisp/view.el
index 9f914b0..498a434 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -960,7 +960,7 @@ for highlighting the match that is found."
      (t (error "No previous View-mode search")))
     (save-excursion
       (if end (goto-char (if (< times 0) (point-max) (point-min)))
-	(move-to-window-line (if (< times 0) 0 -1)))
+	(forward-char (if (< times 0) -1 1)))
       (if (if no (view-search-no-match-lines times regexp)
 	    (re-search-forward regexp nil t times))
 	  (setq where (point))))
-- 
2.0.0


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18131; Package emacs. (Mon, 28 Jul 2014 18:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 18131 <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: 18131 <at> debbugs.gnu.org
Subject: patch update
Date: Mon, 28 Jul 2014 11:26:20 -0700
[Message part 1 (text/plain, inline)]
I jumped the gun with that patch a bit. Here's an updated version

[0001-View-search-.-now-hit-all-the-matches-regardless-of-.patch (text/x-diff, inline)]
From 5c300c00db8de26074b7b537e1cebde19a5574e7 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima <at> secretsauce.net>
Date: Mon, 28 Jul 2014 11:05:00 -0700
Subject: [PATCH] View-search-... now hit all the matches, regardless of window
 position

Prior to this patch anything between (point) and the edge of the window was
skipped. This was counterintuitive (not what less or vim do) and was not
mentioned in the documentation
---
 lisp/view.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/view.el b/lisp/view.el
index 9f914b0..698a73c 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -960,7 +960,7 @@ for highlighting the match that is found."
      (t (error "No previous View-mode search")))
     (save-excursion
       (if end (goto-char (if (< times 0) (point-max) (point-min)))
-	(move-to-window-line (if (< times 0) 0 -1)))
+	(forward-line (if (< times 0) -1 1)))
       (if (if no (view-search-no-match-lines times regexp)
 	    (re-search-forward regexp nil t times))
 	  (setq where (point))))
-- 
2.0.0


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18131; Package emacs. (Tue, 23 Feb 2016 12:27:01 GMT) Full text and rfc822 format available.

Message #11 received at 18131 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 18131 <at> debbugs.gnu.org
Subject: Re: bug#18131: 24.4.50;
 View-search-... skips all matches between (point) and edge of window
Date: Tue, 23 Feb 2016 23:26:13 +1100
Dima Kogan <dima <at> secretsauce.net> writes:

> The emacs view-mode has navigation with 'n' and 'p' keys to navigate by
> searching (like isearch, but with fewer keystrokes and very similar to
> less and vi).
>
> I just discovered that unlike less and vi, this view-mode navigation
> doesn't hit all the matches, but rather skips the ones between (point)
> and the edge of the window. This ensures that any matches that are
> visible by the user (but not highlighted by view-mode) are skipped.
>
> This clearly was a design choice, rather than a bug. However, the
> documentation doesn't mention this, and I think it is counterintuitive.
> Attaching a very simple patch to fix.

[...]

> -	(move-to-window-line (if (< times 0) 0 -1)))

If this was a design choice, then we should perhaps ask the person who
designed it what it's all about...  which isn't easy in this instance,
since this is very old code.

Does anybody have an opinion here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18131; Package emacs. (Sun, 25 Dec 2016 06:44:02 GMT) Full text and rfc822 format available.

Message #14 received at 18131 <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 18131 <at> debbugs.gnu.org
Subject: Re: bug#18131: 24.4.50;
 View-search-... skips all matches between (point) and edge of window
Date: Sat, 24 Dec 2016 22:43:04 -0800
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Dima Kogan <dima <at> secretsauce.net> writes:
>
>> The emacs view-mode has navigation with 'n' and 'p' keys to navigate by
>> searching (like isearch, but with fewer keystrokes and very similar to
>> less and vi).
>>
>> I just discovered that unlike less and vi, this view-mode navigation
>> doesn't hit all the matches, but rather skips the ones between (point)
>> and the edge of the window. This ensures that any matches that are
>> visible by the user (but not highlighted by view-mode) are skipped.
>>
>> This clearly was a design choice, rather than a bug. However, the
>> documentation doesn't mention this, and I think it is counterintuitive.
>> Attaching a very simple patch to fix.
>
> [...]
>
>> -	(move-to-window-line (if (< times 0) 0 -1)))
>
> If this was a design choice, then we should perhaps ask the person who
> designed it what it's all about...  which isn't easy in this instance,
> since this is very old code.
>
> Does anybody have an opinion here?

Can we revisit this? I think view-mode behaving like 'less' does would
be an improvement.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18131; Package emacs. (Tue, 25 Jun 2019 22:51:01 GMT) Full text and rfc822 format available.

Message #17 received at 18131 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 18131 <at> debbugs.gnu.org
Subject: Re: bug#18131: 24.4.50;
 View-search-... skips all matches between (point) and edge of window
Date: Wed, 26 Jun 2019 00:50:07 +0200
Dima Kogan <dima <at> secretsauce.net> writes:

>>> -	(move-to-window-line (if (< times 0) 0 -1)))
>>
>> If this was a design choice, then we should perhaps ask the person who
>> designed it what it's all about...  which isn't easy in this instance,
>> since this is very old code.
>>
>> Does anybody have an opinion here?
>
> Can we revisit this? I think view-mode behaving like 'less' does would
> be an improvement.

After playing with it a bit, I think you're right -- the current
behaviour seems really unobvious.  I've applied your patch to the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 22:51:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 18131 <at> debbugs.gnu.org and Dima Kogan <dima <at> secretsauce.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 22:51:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 24 Jul 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.