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

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

[elpa] master d8c5f8d: New command `el-search-from-beginning'


From: Michael Heerdegen
Subject: [elpa] master d8c5f8d: New command `el-search-from-beginning'
Date: Wed, 18 Jan 2017 22:45:34 +0000 (UTC)

branch: master
commit d8c5f8ded7d4b0041b69961d90e9af32225f2fab
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

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

diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 160e243..b8c0abe 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/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]