[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ae05765 41/90: Allow to customize the initial input for al
From: |
Oleh Krehel |
Subject: |
[elpa] master ae05765 41/90: Allow to customize the initial input for all commands |
Date: |
Tue, 30 Jun 2015 07:28:23 +0000 |
branch: master
commit ae05765add1f3bc90421f033ff408fb93eba03a1
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Allow to customize the initial input for all commands
* ivy.el (ivy-initial-inputs-alist): New defvar. Customize this to get
an initial input in any command.
(ivy-read): Unless INTIAL-INPUT is given, look it up in
`ivy-initial-inputs-alist' based on `this-command'.
* counsel.el (counsel-M-x-initial-input): Remove defcustom. It's
superseded by `ivy-initial-inputs-alist'.
(counsel-M-x): Update.
Fixes #140
---
counsel.el | 8 +++-----
ivy.el | 8 ++++++++
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/counsel.el b/counsel.el
index a2657b9..abd1fe4 100644
--- a/counsel.el
+++ b/counsel.el
@@ -501,16 +501,14 @@ If a command is bound, add it's binding after it."
cands
"\n")))
-(defcustom counsel-M-x-initial-input "^"
- "Initial input for `counsel-M-x'."
- :group 'ivy)
-
;;;###autoload
(defun counsel-M-x (&optional initial-input)
"Ivy version of `execute-extended-command'.
Optional INITIAL-INPUT is the initial input in the minibuffer."
(interactive)
- (setq initial-input (or initial-input counsel-M-x-initial-input))
+ (unless initial-input
+ (setq initial-input (cdr (assoc this-command
+ ivy-initial-inputs-alist))))
(let ((ivy-format-function #'counsel--format-function-M-x)
(cands obarray)
(pred 'commandp)
diff --git a/ivy.el b/ivy.el
index 07ad9bf..c4ff814 100644
--- a/ivy.el
+++ b/ivy.el
@@ -614,6 +614,11 @@ The matches will be filtered in a sequence, you can mix the
regexps that should match and that should not match as you
like.")
+(defvar ivy-initial-inputs-alist
+ '((org-refile . "^")
+ (counsel-M-x . "^"))
+ "Command to initial input table.")
+
(defcustom ivy-sort-max-size 30000
"Sorting won't be done for collections larger than this."
:type 'integer)
@@ -675,6 +680,9 @@ MATCHER can completely override matching.
DYNAMIC-COLLECTION is a function to call to update the list of
candidates with each input."
+ (unless initial-input
+ (setq initial-input (cdr (assoc this-command
+ ivy-initial-inputs-alist))))
(setq ivy-last
(make-ivy-state
:prompt prompt
- [elpa] master 72d4c76 35/90: Replace "C-x 6" with "<f2>" in counsel-M-x, (continued)
- [elpa] master 72d4c76 35/90: Replace "C-x 6" with "<f2>" in counsel-M-x, Oleh Krehel, 2015/06/30
- [elpa] master 8c3bf21 36/90: ivy-toggle-calling: Toggle calling "RET" action for current candidate, Oleh Krehel, 2015/06/30
- [elpa] master 39eb7ed 38/90: counsel.el (counsel-M-x): Call smex-initialize, Oleh Krehel, 2015/06/30
- [elpa] master 109e5b0 37/90: Bind "C-o" to hydra-ivy/body, Oleh Krehel, 2015/06/30
- [elpa] master 7dea8b7 39/90: ivy.el (hydra-ivy/body): Autoload, Oleh Krehel, 2015/06/30
- [elpa] master 9ceb7ee 42/90: Fix yank/undo bug, Oleh Krehel, 2015/06/30
- [elpa] master d8172a0 40/90: ivy.el (ivy--regex-fuzzy): Improve for "^" and "$", Oleh Krehel, 2015/06/30
- [elpa] master 02cedb7 43/90: ivy.el (ivy-insert-current): Add and bind to "M-i", Oleh Krehel, 2015/06/30
- [elpa] master 1a5b259 44/90: Fix the minibuffer being too small with enough candidates, Oleh Krehel, 2015/06/30
- [elpa] master e334a75 45/90: ivy.el (ivy-initial-inputs-alist): Add man and woman, Oleh Krehel, 2015/06/30
- [elpa] master ae05765 41/90: Allow to customize the initial input for all commands,
Oleh Krehel <=
- [elpa] master 4d66758 47/90: Allow to toggle matching mode with "C-o m", Oleh Krehel, 2015/06/30
- [elpa] master 16fefbc 48/90: ivy-hydra.el (hydra-ivy): Add "C-j" and "C-m" exit points, Oleh Krehel, 2015/06/30
- [elpa] master 7945ab0 49/90: counsel.el (counsel-M-x): Call smex-rank, Oleh Krehel, 2015/06/30
- [elpa] master 76897c0 46/90: ivy.el (ivy-sort-functions-alist): Work for commands as well, Oleh Krehel, 2015/06/30
- [elpa] master 61bb9e0 50/90: Require TRAMP in time, Oleh Krehel, 2015/06/30
- [elpa] master 9df660c 51/90: swiper.el (swiper-query-replace): Don't miss the first, Oleh Krehel, 2015/06/30
- [elpa] master d47dd9b 52/90: ivy-hydra.el: Improve for hydra not installed, Oleh Krehel, 2015/06/30
- [elpa] master 265f47d 53/90: Swiper should not deactivate-mark, Oleh Krehel, 2015/06/30
- [elpa] master 4cdb80c 54/90: ivy-hydra.el (defhydra): Wrap in eval-when-compile, Oleh Krehel, 2015/06/30
- [elpa] master 1dbdcdc 55/90: counsel.el (counsel-M-x): Fixup, Oleh Krehel, 2015/06/30