[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 02065be 19/67: swiper.el: Restore original point on cancel
From: |
Oleh Krehel |
Subject: |
[elpa] master 02065be 19/67: swiper.el: Restore original point on canceling |
Date: |
Sun, 22 Mar 2015 17:33:54 +0000 |
branch: master
commit 02065be07453d243c6e1b49d5fdd01ba685c8419
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el: Restore original point on canceling
* swiper.el (swiper--opoint): New defvar.
(swiper): Update.
(swiper--ivy): Update.
Fixes #9.
---
swiper.el | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/swiper.el b/swiper.el
index afc1642..b838124 100644
--- a/swiper.el
+++ b/swiper.el
@@ -110,11 +110,15 @@
map)
"Allows you to go to next and previous hit isearch-style.")
+(defvar swiper--opoint
+ "The point when `swiper' starts.")
+
;;;###autoload
(defun swiper (&optional initial-input)
"`isearch' with an overview.
When non-nil, INITIAL-INPUT is the initial search pattern."
(interactive)
+ (setq swiper--opoint (point))
(if (and (eq 'swiper-completion-method 'helm)
(featurep 'helm))
(swiper--helm initial-input)
@@ -133,19 +137,22 @@ When non-nil, INITIAL-INPUT is the initial search
pattern."
(interactive)
(ido-mode -1)
(swiper--init)
- (unwind-protect
- (let ((res (ivy-read "pattern: "
- (swiper--candidates)
- initial-input
- #'swiper--update-input-ivy)))
- (goto-char (point-min))
- (forward-line (1- (read res)))
- (re-search-forward
- (ivy--regex ivy-text)
- (line-end-position)
- t))
- (ido-mode 1)
- (swiper--cleanup)))
+ (let (res)
+ (unwind-protect
+ (setq res (ivy-read "pattern: "
+ (swiper--candidates)
+ initial-input
+ #'swiper--update-input-ivy))
+ (ido-mode 1)
+ (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)))))
(defun swiper--helm (&optional initial-input)
"`isearch' with an overview using `helm'.
- [elpa] master 1099ebf 08/67: Use cl-lib macros instead of cl.el, (continued)
- [elpa] master 1099ebf 08/67: Use cl-lib macros instead of cl.el, Oleh Krehel, 2015/03/22
- [elpa] master 7b86747 09/67: swiper.el (swiper--regex): Update signature, Oleh Krehel, 2015/03/22
- [elpa] master a267b34 10/67: familiar isearch key bindings while helm is active, Oleh Krehel, 2015/03/22
- [elpa] master a817342 14/67: ivy.el: Improve the highlighting in the minibuffer, Oleh Krehel, 2015/03/22
- [elpa] master 97ab66a 13/67: README.md: Update, Oleh Krehel, 2015/03/22
- [elpa] master eb829a9 16/67: Account for zero-length regex matches, Oleh Krehel, 2015/03/22
- [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 <=
- [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, 2015/03/22
- [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