[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4e07e6f 048/399: ivy.el (ivy-make-magic-action): Add docst
From: |
Oleh Krehel |
Subject: |
[elpa] master 4e07e6f 048/399: ivy.el (ivy-make-magic-action): Add docstring to the generated lambda |
Date: |
Sat, 20 Jul 2019 14:56:46 -0400 (EDT) |
branch: master
commit 4e07e6f738b93a5b3e97af990975df527bd67893
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-make-magic-action): Add docstring to the generated lambda
Fixes #1956
---
counsel.el | 2 +-
ivy.el | 23 ++++++++++++++++-------
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/counsel.el b/counsel.el
index a1e43f6..349762b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1757,7 +1757,7 @@ currently checked out."
(define-key map (kbd "C-DEL") 'counsel-up-directory)
(define-key map (kbd "C-<backspace>") 'counsel-up-directory)
(define-key map (kbd "C-M-y") 'counsel-yank-directory)
- (define-key map (kbd "`") (ivy-make-magic-action "b"))
+ (define-key map (kbd "`") (ivy-make-magic-action 'counsel-find-file "b"))
map))
(defun counsel-yank-directory ()
diff --git a/ivy.el b/ivy.el
index 261075c..ce26c1d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2855,17 +2855,26 @@ Possible choices are
'ivy-magic-slash-non-match-cd-selected,
(ivy--cd-maybe))
(insert last-input-event)))
-(defun ivy-make-magic-action (key)
+(defun ivy-make-magic-action (caller key)
"Return a command that does the equivalent of `ivy-read-action' and KEY.
This happens only when the input is empty.
The intention is to bind the result to keys that are typically
bound to `self-insert-command'."
- (lambda (&optional arg)
- (interactive "p")
- (if (string= "" ivy-text)
- (execute-kbd-macro
- (kbd (concat "M-o " key)))
- (self-insert-command arg))))
+ (let ((alist (assoc key
+ (plist-get
+ ivy--actions-list
+ caller)))
+ (action (nth 1 alist))
+ (doc (concat (nth 2 alist)
+ "\n\n"
+ (documentation action))))
+ `(lambda (&optional arg)
+ ,doc
+ (interactive "p")
+ (if (string= "" ivy-text)
+ (execute-kbd-macro
+ (kbd (concat "M-o " key)))
+ (self-insert-command arg)))))
(defcustom ivy-magic-tilde t
"When non-nil, ~ will move home when selecting files.
- [elpa] master ce0c39e 076/399: counsel.el (counsel--git-root): Rename, (continued)
- [elpa] master ce0c39e 076/399: counsel.el (counsel--git-root): Rename, Oleh Krehel, 2019/07/20
- [elpa] master a37d4e3 072/399: counsel.el (counsel-compile): fix breakage to subdir recursion, Oleh Krehel, 2019/07/20
- [elpa] master 86c904f 077/399: counsel.el (counsel-compile-root-functions): Change priority, Oleh Krehel, 2019/07/20
- [elpa] master c2788de 082/399: counsel.el (counsel--switch-buffer-update-fn): if to cond, Oleh Krehel, 2019/07/20
- [elpa] master 1439e8d 064/399: counsel.el: Simplify compile build dir collection, Oleh Krehel, 2019/07/20
- [elpa] master 7e8a362 068/399: counsel.el (counsel--get-make-targets): Clean up, Oleh Krehel, 2019/07/20
- [elpa] master d64b268 074/399: counsel.el (counsel-compile): counsel--get-build-subdirs, Oleh Krehel, 2019/07/20
- [elpa] master 6f0f32f 084/399: counsel.el (counsel-git-grep-count-function): Promote to defcustom, Oleh Krehel, 2019/07/20
- [elpa] master 25336fd 075/399: counsel.el (counsel-compile): counsel-compile-local-builds, Oleh Krehel, 2019/07/20
- [elpa] master db905cc 088/399: counsel.el (counsel-compile-phony-pattern): Use plain regex, Oleh Krehel, 2019/07/20
- [elpa] master 4e07e6f 048/399: ivy.el (ivy-make-magic-action): Add docstring to the generated lambda,
Oleh Krehel <=
- [elpa] master 8a40934 062/399: counsel.el: Clean up compile candidates list, Oleh Krehel, 2019/07/20
- [elpa] master 0c30e3f 063/399: counsel.el: Minor compile history cleanup, Oleh Krehel, 2019/07/20
- [elpa] master 114ae96 070/399: counsel.el: Find project root more flexibly, Oleh Krehel, 2019/07/20
- [elpa] master 5aa263c 079/399: counsel.el (counsel-compile-make-pattern): Fix regex, Oleh Krehel, 2019/07/20
- [elpa] master cc50da2 080/399: counsel.el (counsel-dired-jump-args): Fix -type d, Oleh Krehel, 2019/07/20
- [elpa] master a473519 086/399: Fix error in ivy-make-magic-action, Oleh Krehel, 2019/07/20
- [elpa] master 9ce9e4e 090/399: counsel.el (counsel-compile-phony-pattern): Fixup, Oleh Krehel, 2019/07/20
- [elpa] master 1046fc7 095/399: ivy.el (ivy-avy): Use non-obsolete avy-process, Oleh Krehel, 2019/07/20
- [elpa] master 27add46 092/399: Anchor pcre lookaround patterns to bol, Oleh Krehel, 2019/07/20
- [elpa] master 3e1e905 083/399: Fix virtual buffers in counsel-switch-buffer, Oleh Krehel, 2019/07/20