[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 1095e42 298/395: ivy.el (ivy-alt-done-functio
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 1095e42 298/395: ivy.el (ivy-alt-done-functions-alist): Add |
Date: |
Thu, 25 Feb 2021 08:32:24 -0500 (EST) |
branch: externals/ivy-hydra
commit 1095e42abf66bb2a555f8ae5293895c1936ba544
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
ivy.el (ivy-alt-done-functions-alist): Add
---
counsel.el | 2 ++
ivy.el | 48 +++++++++++++++++++++++++++++++-----------------
2 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/counsel.el b/counsel.el
index d056608..e0e2391 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2117,6 +2117,7 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
'counsel-find-file))
(ivy-configure 'counsel-find-file
+ :alt-done-fn #'ivy--directory-done
:occur #'counsel-find-file-occur
:display-transformer-fn #'ivy-read-file-transformer)
@@ -2354,6 +2355,7 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
'counsel-dired)))
(ivy-configure 'counsel-dired
+ :alt-done-fn #'ivy--directory-done
:display-transformer-fn #'ivy-read-file-transformer)
;;** `counsel-recentf'
diff --git a/ivy.el b/ivy.el
index 2025fc0..9d2640d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -908,6 +908,12 @@ Is is a cons cell, related to
`tramp-get-completion-function'."
(declare-function Info-read-node-name-1 "info")
(declare-function tramp-get-completion-function "tramp")
+(defcustom ivy-alt-done-functions-alist nil
+ "Customize what `ivy-alt-done' does per-collection."
+ :type '(alist
+ :key-type symbol
+ :value-type function))
+
(defun ivy-alt-done (&optional arg)
"Exit the minibuffer with the selected candidate.
When ARG is t, exit with current text, ignoring the candidates.
@@ -916,22 +922,23 @@ directory, continue completion from within that directory
instead
of exiting. This function is otherwise like `ivy-done'."
(interactive "P")
(setq ivy-current-prefix-arg current-prefix-arg)
- (cond ((or arg
- (ivy--prompt-selected-p))
- (ivy-immediate-done))
- (ivy--directory
- (ivy--directory-done))
- ((eq (ivy-state-collection ivy-last) #'Info-read-node-name-1)
- (if (member (ivy-state-current ivy-last) '("(./)" "(../)"))
- (ivy-quit-and-run
- (ivy-read "Go to file: " #'read-file-name-internal
- :action (lambda (x)
- (Info-find-node
- (expand-file-name x ivy--directory)
- "Top"))))
- (ivy-done)))
- (t
- (ivy-done))))
+ (let (alt-done-fn)
+ (cond ((or arg (ivy--prompt-selected-p))
+ (ivy-immediate-done))
+ ((setq alt-done-fn (ivy-alist-setting ivy-alt-done-functions-alist))
+ (funcall alt-done-fn))
+ (t
+ (ivy-done)))))
+
+(defun ivy--info-alt-done ()
+ (if (member (ivy-state-current ivy-last) '("(./)" "(../)"))
+ (ivy-quit-and-run
+ (ivy-read "Go to file: " #'read-file-name-internal
+ :action (lambda (x)
+ (Info-find-node
+ (expand-file-name x ivy--directory)
+ "Top"))))
+ (ivy-done)))
(defvar ivy-auto-select-single-candidate nil
"When non-nil, auto-select the candidate if it is the only one.
@@ -1854,6 +1861,7 @@ An :init is a function with no arguments.
format-fn
display-fn
display-transformer-fn
+ alt-done-fn
more-chars
grep-p
exit-codes)
@@ -1881,6 +1889,8 @@ An :init is a function with no arguments.
(ivy--alist-set 'ivy-display-functions-alist caller display-fn))
(when display-transformer-fn
(ivy-set-display-transformer caller display-transformer-fn))
+ (when alt-done-fn
+ (ivy--alist-set 'ivy-alt-done-functions-alist caller alt-done-fn))
(when more-chars
(ivy--alist-set 'ivy-more-chars-alist caller more-chars))
(when grep-p
@@ -5207,11 +5217,15 @@ make decisions based on the whole marked list."
(ivy-configure 'read-file-name-internal
:sort-fn #'ivy-sort-file-function-default
- :display-transformer-fn #'ivy-read-file-transformer)
+ :display-transformer-fn #'ivy-read-file-transformer
+ :alt-done-fn #'ivy--directory-done)
(ivy-configure 'internal-complete-buffer
:display-transformer-fn #'ivy-switch-buffer-transformer)
+(ivy-configure 'Info-read-node-name-1
+ :alt-done-fn #'ivy--info-alt-done)
+
(provide 'ivy)
;;; ivy.el ends here
- [elpa] externals/ivy-hydra c1a61dc 084/395: ivy-test.el (ivy-empty-directory-open): Test opening empty directory, (continued)
- [elpa] externals/ivy-hydra c1a61dc 084/395: ivy-test.el (ivy-empty-directory-open): Test opening empty directory, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 316d4dd 232/395: counsel-kmacro: Create actions for cycling the ring and setting a saved counter value., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 38c90e8 196/395: ivy.el (ivy-switch-buffer-transformer): Move ivy-remote logic here, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra fff899a 237/395: counsel.el (counsel--sync-sentinel-on-exit): Try not to reset index to 0, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a2c86c0 273/395: ivy.el (ivy-completion-in-region): Fixup, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra da0b272 281/395: ivy.el (ivy--call-marked): Handle alists, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a37ec22 279/395: Revert "ivy.el (ivy--update-minibuffer): don't filter while there's input", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 05d892d 282/395: counsel-grep/ag/rg/pt: use subprocess instead of shell command, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b173441 326/395: Fix for ivy-immediate-done with counsel-M-x, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d539306 307/395: Revert "ivy.el (ivy-display-style): Remove", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1095e42 298/395: ivy.el (ivy-alt-done-functions-alist): Add,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 7774867 335/395: Guard against null Org heading, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7b9391f 320/395: ivy-avy.el: Fix typo, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6bfada5 359/395: ivy.el: Use ivy--completing-fname-p more, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7e4c567 350/395: Makefile: Make plain.el load counsel instead of here, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5db2513 341/395: Recognize remote executables in Emacs >= 27.1., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 92c91ca 342/395: counsel.el (counsel-org-capture): Display descriptions from prefix keys, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra accc0fe 339/395: counsel.el (counsel-compile--probe-make-targets): fail more gracefully, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 215bb22 348/395: ivy.el (ivy-configure): Only change a value if it was not modified by the user, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4894b65 329/395: ivy-avy.el: Don't overwrite existing ivy-minibuffer-map binding, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8783d92 321/395: ivy.el: Remove most minibuffer-only commands from the counsel-M-x list, Basil L. Contovounesios, 2021/02/25