[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 99698e6 035/167: ivy.el (ivy-dispatching-call): Add and bi
From: |
Oleh Krehel |
Subject: |
[elpa] master 99698e6 035/167: ivy.el (ivy-dispatching-call): Add and bind to "C-M-o" |
Date: |
Tue, 08 Dec 2015 10:49:44 +0000 |
branch: master
commit 99698e68f02ddcc400fca63a282a099317e42b0a
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-dispatching-call): Add and bind to "C-M-o"
* ivy.el (ivy-minibuffer-map): Update.
(ivy-read-action): New command.
(ivy-dispatching-done): Update.
* ivy-hydra.el (hydra-ivy): Bind `ivy-read-action' to "a".
Re #254
---
ivy-hydra.el | 3 ++-
ivy.el | 32 ++++++++++++++++++++++++--------
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/ivy-hydra.el b/ivy-hydra.el
index 152812b..84b592d 100644
--- a/ivy-hydra.el
+++ b/ivy-hydra.el
@@ -49,7 +49,7 @@
"
^^^^^^ ^Yes^ ^No^ ^Maybe^ ^Action^
^^^^^^^^^^^^^^---------------------------------------------------
-^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\"
\"off\") _w_/_s_: %s(ivy-action-name)
+^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\"
\"off\") _w_/_s_/_a_: %s(ivy-action-name)
_h_ ^+^ _l_ _d_one _o_ops _m_: matcher %s(if (eq ivy--regex-function
'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate:
%`truncate-lines
"
@@ -74,6 +74,7 @@ _h_ ^+^ _l_ _d_one _o_ops _m_: matcher %s(if (eq
ivy--regex-function 'i
("<" ivy-minibuffer-shrink)
("w" ivy-prev-action)
("s" ivy-next-action)
+ ("a" ivy-read-action)
("t" (setq truncate-lines (not truncate-lines))))
(provide 'ivy-hydra)
diff --git a/ivy.el b/ivy.el
index e06c3dd..a841a4b 100644
--- a/ivy.el
+++ b/ivy.el
@@ -157,6 +157,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse
order."
(define-key map (kbd "M-i") 'ivy-insert-current)
(define-key map (kbd "C-o") 'hydra-ivy/body)
(define-key map (kbd "M-o") 'ivy-dispatching-done)
+ (define-key map (kbd "C-M-o") 'ivy-dispatching-call)
(define-key map (kbd "C-k") 'ivy-kill-line)
(define-key map (kbd "S-SPC") 'ivy-restrict-to-matches)
(define-key map (kbd "M-w") 'ivy-kill-ring-save)
@@ -302,12 +303,11 @@ When non-nil, it should contain one %d.")
(insert ivy-text)
(ivy--exhibit))))
-(defun ivy-dispatching-done ()
- "Select one of the available actions and call `ivy-done'."
+(defun ivy-read-action ()
+ "Change the action to one of the available ones."
(interactive)
(let ((actions (ivy-state-action ivy-last)))
- (if (null (ivy--actionp actions))
- (ivy-done)
+ (unless (null (ivy--actionp actions))
(let* ((hint (concat ivy--current
"\n"
(mapconcat
@@ -321,14 +321,30 @@ When non-nil, it should contain one %d.")
"\n")
"\n"))
(key (string (read-key hint)))
- (action (assoc key (cdr actions))))
+ (action-idx (cl-position-if
+ (lambda (x) (equal (car x) key))
+ (cdr actions))))
(cond ((string= key ""))
- ((null action)
+ ((null action-idx)
(error "%s is not bound" key))
(t
(message "")
- (ivy-set-action (nth 1 action))
- (ivy-done)))))))
+ (setcar actions (1+ action-idx))
+ (ivy-set-action actions)))))))
+
+(defun ivy-dispatching-done ()
+ "Select one of the available actions and call `ivy-done'."
+ (interactive)
+ (ivy-read-action)
+ (ivy-done))
+
+(defun ivy-dispatching-call ()
+ "Select one of the available actions and call `ivy-call'."
+ (interactive)
+ (let ((actions (copy-sequence (ivy-state-action ivy-last))))
+ (ivy-read-action)
+ (ivy-call)
+ (ivy-set-action actions)))
(defun ivy-build-tramp-name (x)
"Reconstruct X into a path.
- [elpa] master 6956311 027/167: Adjust ivy-state-preselect for file name completion, (continued)
- [elpa] master 6956311 027/167: Adjust ivy-state-preselect for file name completion, Oleh Krehel, 2015/12/08
- [elpa] master 6f4d46b 034/167: Fix preselect for input "^", Oleh Krehel, 2015/12/08
- [elpa] master ef189f1 030/167: ivy.el (ivy-count-format): Extend customize choices, Oleh Krehel, 2015/12/08
- [elpa] master e722d6a 046/167: swiper.el (swiper-mc): Add and bind to "C-7", Oleh Krehel, 2015/12/08
- [elpa] master 3a3b052 036/167: swiper.el: Add a lot of avy declares, Oleh Krehel, 2015/12/08
- [elpa] master 3699fa9 041/167: Don't reset the match to first if the current one still works, Oleh Krehel, 2015/12/08
- [elpa] master 877648a 045/167: ivy.el (ivy-case-fold-search): New defvar, Oleh Krehel, 2015/12/08
- [elpa] master 340318d 044/167: ivy-count-format must be an empty string instead of nil, Oleh Krehel, 2015/12/08
- [elpa] master 9cc75eb 050/167: Adjust the swiper regexp builder for the display change, Oleh Krehel, 2015/12/08
- [elpa] master 85682ee 048/167: Fix "C-x h" selection and "C-b" bug, Oleh Krehel, 2015/12/08
- [elpa] master 99698e6 035/167: ivy.el (ivy-dispatching-call): Add and bind to "C-M-o",
Oleh Krehel <=
- [elpa] master 0630395 043/167: Fix the count when git-grep for "->foo", Oleh Krehel, 2015/12/08
- [elpa] master 4045349 032/167: ivy.el (ivy-use-virtual-buffers): Update docstring, Oleh Krehel, 2015/12/08
- [elpa] master f9df75e 037/167: ivy.el (ivy-index-functions-alist): New variable, Oleh Krehel, 2015/12/08
- [elpa] master 6e3c692 029/167: Fix ivy-state-preselect for file name completion, Oleh Krehel, 2015/12/08
- [elpa] master c69b4b6 033/167: ivy.el (ivy-last): Update docstring, Oleh Krehel, 2015/12/08
- [elpa] master b6d476a 042/167: ivy.el (ivy--recompute-index): Fixup, Oleh Krehel, 2015/12/08
- [elpa] master 83f704b 039/167: ivy-hydra.el (hydra-ivy): Make the docstring a rectangle, Oleh Krehel, 2015/12/08
- [elpa] master b06daca 040/167: ivy.el (ivy-virtual-abbreviate): New defcustom, Oleh Krehel, 2015/12/08
- [elpa] master c99956a 047/167: Fix window selection in counsel-locate, Oleh Krehel, 2015/12/08
- [elpa] master fa0d04c 038/167: Move setq ivy--index to ivy--recompute-index, Oleh Krehel, 2015/12/08