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

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

[elpa] externals/el-search f02e86f 142/332: New command `el-search-from-


From: Stefan Monnier
Subject: [elpa] externals/el-search f02e86f 142/332: New command `el-search-from-beginning'
Date: Tue, 1 Dec 2020 15:48:30 -0500 (EST)

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

    New command `el-search-from-beginning'
---
 el-search.el | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/el-search.el b/el-search.el
index 160e243..b8c0abe 100644
--- a/el-search.el
+++ b/el-search.el
@@ -41,6 +41,7 @@
 ;;   (define-key global-map          [(control ?J)] 
#'el-search-jump-to-search-head)
 ;;   (define-key global-map          [(control ?N)] 
#'el-search-continue-in-next-buffer)
 ;;   (define-key global-map          [(control ?O)] #'el-search-overview)
+;;   (define-key global-map          [(control ?A)] #'el-search-from-beginning)
 ;;
 ;;   (define-key el-search-read-expression-map [(control ?S)] 
#'exit-minibuffer)
 ;;
@@ -245,10 +246,6 @@
 ;; you select an older search to resume and switches to the buffer and
 ;; position where this search had been suspended.
 ;;
-;; There is no special command to restart a prior search from the
-;; beginning.  I suggest to use the pattern input history or
-;; `repeat-complex-command'.
-;;
 ;;
 ;; Writing replacement rules for semi-automatic code rewriting
 ;; ===========================================================
@@ -1643,6 +1640,18 @@ additional pattern types are currently defined:"
 
 (put 'el-search-pattern 'function-documentation '(el-search--make-docstring 
'el-search-pattern))
 
+(defun el-search-from-beginning (&optional restart-search)
+  "Go to the first of the current search's recorded matches in this buffer.
+With prefix arg, restart the current search."
+  (interactive "P")
+  (if (not restart-search)
+      (setf (el-search-object-matches el-search--current-search) 
el-search--this-buffer-matches)
+    (cl-callf el-search-reset-search el-search--current-search)
+    (setq el-search--success nil)
+    (el-search--message-no-log "[Wrapped search]")
+    (sit-for .7))
+  (el-search-continue-search))
+
 (defun el-search-previous-match ()
   "Revisit found matches in the current buffer in reverse order."
   ;; Implementing backward el-searching is very hard (or very slow,



reply via email to

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