[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master eb1def0 17/67: Add initial-input optional argument
From: |
Oleh Krehel |
Subject: |
[elpa] master eb1def0 17/67: Add initial-input optional argument |
Date: |
Sun, 22 Mar 2015 17:33:54 +0000 |
branch: master
commit eb1def0a6b2cb85a68944b43db3ba612bbeb31e2
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add initial-input optional argument
* swiper.el (swiper): Update.
(swiper--ivy): Update.
(swiper--helm): Update.
* ivy.el (ivy-read): Update.
Fixes #8.
---
ivy.el | 5 +++--
swiper.el | 21 +++++++++++++--------
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/ivy.el b/ivy.el
index 45a8700..e4c7fe0 100644
--- a/ivy.el
+++ b/ivy.el
@@ -106,10 +106,11 @@ On error (read-only), quit without selecting."
(minibuffer-keyboard-quit))))
;;** Entry Point
-(defun ivy-read (prompt collection &optional update-fn)
+(defun ivy-read (prompt collection &optional initial-input update-fn)
"Read a string in the minibuffer, with completion.
PROMPT is a string to prompt with; normally it ends in a colon and a space.
COLLECTION is a list of strings.
+If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
UPDATE-FN is called each time the current candidate(s) is changed."
(setq ivy--index 0)
(setq ivy--old-re nil)
@@ -119,7 +120,7 @@ UPDATE-FN is called each time the current candidate(s) is
changed."
(unwind-protect
(minibuffer-with-setup-hook
#'ivy--minibuffer-setup
- (read-from-minibuffer prompt))
+ (read-from-minibuffer prompt initial-input))
(remove-hook 'post-command-hook #'ivy--exhibit)))
(defvar ivy-text ""
diff --git a/swiper.el b/swiper.el
index 6970968..afc1642 100644
--- a/swiper.el
+++ b/swiper.el
@@ -111,13 +111,14 @@
"Allows you to go to next and previous hit isearch-style.")
;;;###autoload
-(defun swiper ()
- "`isearch' with an overview."
+(defun swiper (&optional initial-input)
+ "`isearch' with an overview.
+When non-nil, INITIAL-INPUT is the initial search pattern."
(interactive)
(if (and (eq 'swiper-completion-method 'helm)
(featurep 'helm))
- (swiper--helm)
- (swiper--ivy)))
+ (swiper--helm initial-input)
+ (swiper--ivy initial-input)))
(defun swiper--init ()
"Perform initialization common to both completion methods."
@@ -126,14 +127,16 @@
(setq swiper--anchor (line-number-at-pos))
(setq swiper--window (selected-window)))
-(defun swiper--ivy ()
- "`isearch' with an overview using `ivy'."
+(defun swiper--ivy (&optional initial-input)
+ "`isearch' with an overview using `ivy'.
+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)))
@@ -144,8 +147,9 @@
(ido-mode 1)
(swiper--cleanup)))
-(defun swiper--helm ()
- "`isearch' with an overview using `helm'."
+(defun swiper--helm (&optional initial-input)
+ "`isearch' with an overview using `helm'.
+When non-nil, INITIAL-INPUT is the initial search pattern."
(interactive)
(require 'helm)
(swiper--init)
@@ -176,6 +180,7 @@
:keymap (make-composed-keymap
swiper-helm-keymap
helm-map)
+ :input initial-input
:preselect
(format "^%d " swiper--anchor)
:buffer "*swiper*"))
- [elpa] master ff0ee94 06/67: Add dependency on emacs 24.1, (continued)
- [elpa] master ff0ee94 06/67: Add dependency on emacs 24.1, Oleh Krehel, 2015/03/22
- [elpa] master 1c0b30b 07/67: add autoload cookie for lazy loading, Oleh Krehel, 2015/03/22
- [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 <=
- [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, 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