emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/el-search 34f734e 258/332: [el-search] Add special scro


From: Stefan Monnier
Subject: [elpa] externals/el-search 34f734e 258/332: [el-search] Add special scroll commands
Date: Tue, 1 Dec 2020 15:48:58 -0500 (EST)

branch: externals/el-search
commit 34f734ec7c76bbae128d3e87e646ebbfa8f4c39a
Author: Michael Heerdegen <michael_heerdegen@web.de>
Commit: Michael Heerdegen <michael_heerdegen@web.de>

    [el-search] Add special scroll commands
    
    * packages/el-search/el-search.el (el-search-scroll-down)
    (el-search-scroll-up): New commands.
    Bindings will be added in a later commit.
---
 el-search.el | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/el-search.el b/el-search.el
index 2acd9ed..40c24ad 100644
--- a/el-search.el
+++ b/el-search.el
@@ -2770,6 +2770,32 @@ Use the normal search commands to seize the search."
     (add-hook 'post-command-hook #'el-search-hl-post-command-fun t t)
     (el-search--message-no-log "%s" printed-sexp)))
 
+(defun el-search-scroll-down ()
+  "Jump to the first match starting after `window-end'."
+  (interactive)
+  (setq this-command 'el-search-pattern)
+  (let ((here (point)))
+    (goto-char (window-end))
+    (if (el-search--search-pattern-1 (el-search--current-matcher) t nil
+                                     (el-search--current-heuristic-matcher))
+        (el-search-jump-to-search-head 0)
+      (goto-char here)
+      (el-search--message-no-log "[No more matches after here]")
+      (sit-for 1))))
+
+(defun el-search-scroll-up ()
+  "Jump to the hindmost match starting before `window-start'."
+  (interactive)
+  (setq this-command 'el-search-pattern)
+  (let ((here (point)))
+    (goto-char (window-start))
+    (if (el-search--search-backward-1 (el-search--current-matcher) t nil
+                                      (el-search--current-heuristic-matcher))
+        (el-search-jump-to-search-head 0)
+      (goto-char here)
+      (el-search--message-no-log "[No more matches before here]")
+      (sit-for 1))))
+
 
 ;;;; El-Occur
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]