all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18131: 24.4.50; View-search-... skips all matches between (point) and edge of window
@ 2014-07-28 18:06 Dima Kogan
       [not found] ` <handler.18131.B.14065708586384.ack@debbugs.gnu.org>
  2016-02-23 12:26 ` bug#18131: 24.4.50; View-search-... skips all matches between (point) and edge of window Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Dima Kogan @ 2014-07-28 18:06 UTC (permalink / raw)
  To: 18131

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

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.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-View-search-.-now-hit-all-the-matches-regardless-of-.patch --]
[-- Type: text/x-diff, Size: 1034 bytes --]

From ed227e61fe92c54c18542455448ed7f28d0c9e77 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-25 22:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 18:06 bug#18131: 24.4.50; View-search-... skips all matches between (point) and edge of window Dima Kogan
     [not found] ` <handler.18131.B.14065708586384.ack@debbugs.gnu.org>
2014-07-28 18:26   ` bug#18131: patch update Dima Kogan
2016-02-23 12:26 ` bug#18131: 24.4.50; View-search-... skips all matches between (point) and edge of window Lars Ingebrigtsen
2016-12-25  6:43   ` Dima Kogan
2019-06-25 22:50     ` Lars Ingebrigtsen

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.