[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1ca1660 22/67: swiper.el: Save position before last search
From: |
Oleh Krehel |
Subject: |
[elpa] master 1ca1660 22/67: swiper.el: Save position before last search |
Date: |
Sun, 22 Mar 2015 17:33:56 +0000 |
branch: master
commit 1ca16600b13037f30a4cd0892f4f339e02b6c9a3
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el: Save position before last search
* swiper.el (swiper--ivy): Forward to `swiper--action'.
(swiper--helm): Use `swiper--action-helm'.
(swiper--action-helm): New defun.
(swiper--action): Generalize, use push-mark, similarly to `isearch'.
Fixes #12.
---
swiper.el | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/swiper.el b/swiper.el
index b4aa703..dd1f106 100644
--- a/swiper.el
+++ b/swiper.el
@@ -147,13 +147,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(swiper--cleanup)
(if (null ivy-exit)
(goto-char swiper--opoint)
- (goto-char (point-min))
- (forward-line (1- (read res)))
- (re-search-forward
- (ivy--regex ivy-text)
- (line-end-position)
- t)
- (swiper--ensure-visible)))))
+ (swiper--action res ivy-text)))))
(defun swiper--helm (&optional initial-input)
"`isearch' with an overview using `helm'.
@@ -184,7 +178,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(candidates . ,(swiper--candidates))
(filtered-candidate-transformer
helm-fuzzy-highlight-matches)
- (action . swiper--action))
+ (action . swiper--action-helm))
:keymap (make-composed-keymap
swiper-helm-keymap
helm-map)
@@ -355,13 +349,21 @@ When non-nil, INITIAL-INPUT is the initial search
pattern."
(forward-line -1)
(helm-next-line 1))))
-(defun swiper--action (x)
+(defun swiper--action-helm (x)
"Goto line X."
+ (swiper--action x helm-input))
+
+(defun swiper--action (x input)
+ "Goto line X and search for input."
(goto-char (point-min))
(forward-line (1- (read x)))
(re-search-forward
- (ivy--regex helm-input) (line-end-position) t)
- (swiper--ensure-visible))
+ (ivy--regex input) (line-end-position) t)
+ (swiper--ensure-visible)
+ (when (/= (point) swiper--opoint)
+ (unless (and transient-mark-mode mark-active)
+ (push-mark swiper--opoint t)
+ (message "Mark saved where search started"))))
(provide 'swiper)
- [elpa] master 9bcf1dc 12/67: Update dependencies., (continued)
- [elpa] master 9bcf1dc 12/67: Update dependencies., Oleh Krehel, 2015/03/22
- [elpa] master 7cea819 18/67: ivy.el: Add `ivy-exit', Oleh Krehel, 2015/03/22
- [elpa] master eb1def0 17/67: Add initial-input optional argument, Oleh Krehel, 2015/03/22
- [elpa] master 2f5cc11 15/67: swiper.el: Use `with-selected-window' instead of `with-current-buffer', Oleh Krehel, 2015/03/22
- [elpa] master 02065be 19/67: swiper.el: Restore original point on canceling, Oleh Krehel, 2015/03/22
- [elpa] master 6a874a4 11/67: Add `ivy' back end, Oleh Krehel, 2015/03/22
- [elpa] master f268cc8 21/67: Reveal invisible overlays, Oleh Krehel, 2015/03/22
- [elpa] master 835208a 20/67: Inherit standard faces by default, Oleh Krehel, 2015/03/22
- [elpa] master f148a94 24/67: Fix use of cl-incf, Oleh Krehel, 2015/03/22
- [elpa] master 2ed9ee2 23/67: Require delsel for `minibuffer-keyboard-quit', Oleh Krehel, 2015/03/22
- [elpa] master 1ca1660 22/67: swiper.el: Save position before last search,
Oleh Krehel <=
- [elpa] master 02ca7a1 25/67: Add anchoring, Oleh Krehel, 2015/03/22
- [elpa] master b1ac649 26/67: Don't recenter unless necessary, Oleh Krehel, 2015/03/22
- [elpa] master a07c2e4 27/67: swiper.el: Make ivy the default back end, Oleh Krehel, 2015/03/22
- [elpa] master baa9df7 30/67: Truncate candidates to window width in the minibuffer, Oleh Krehel, 2015/03/22
- [elpa] master 7c6d00d 32/67: ivy.el (ivy-read): Return immediately for less than 2 candidates, Oleh Krehel, 2015/03/22
- [elpa] master 315be36 31/67: counsel.el: Add, Oleh Krehel, 2015/03/22
- [elpa] master 0772929 29/67: Add some rudimentary history handling, Oleh Krehel, 2015/03/22
- [elpa] master 045fb60 28/67: ivy.el (ivy-previous-line): Change to `cl-decf', Oleh Krehel, 2015/03/22
- [elpa] master e1cdb29 37/67: counsel.el: Add Clojure completion at point, Oleh Krehel, 2015/03/22
- [elpa] master 7ff3dd9 35/67: Need to check value of variable, Oleh Krehel, 2015/03/22