[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-posframe 661b22f 1/7: * ivy-posframe.el (ivy-posfra
From: |
Feng Shu |
Subject: |
[elpa] externals/ivy-posframe 661b22f 1/7: * ivy-posframe.el (ivy-posframe-read-action): Rewrite. |
Date: |
Sat, 3 Oct 2020 08:23:47 -0400 (EDT) |
branch: externals/ivy-posframe
commit 661b22fc0b146b0e6efff32ebab9ddbae2a3cc3f
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
* ivy-posframe.el (ivy-posframe-read-action): Rewrite.
---
ivy-posframe.el | 64 ++++++++++++++++++++++++++++-----------------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/ivy-posframe.el b/ivy-posframe.el
index d3586a8..207a00a 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -328,44 +328,44 @@ This variable is useful for `ivy-posframe-read-action' .")
(ivy-done)))
(defun ivy-posframe-read-action ()
- "Change the action to one of the available ones.
-
-Return nil for `minibuffer-keyboard-quit' or wrong key during the
-selection, non-nil otherwise."
+ "ivy-posframe version `ivy-read-action'"
(interactive)
- (let* ((actions (ivy-state-action ivy-last))
+ (let* ((ivy-read-action-function #'ivy-posframe-read-action-by-key)
(caller (ivy-state-caller ivy-last))
(display-function
(or ivy--display-function
(cdr (or (assq caller ivy-display-functions-alist)
(assq t ivy-display-functions-alist))))))
- (if (not (ivy--actionp actions))
- t
- (let* ((hint (funcall ivy-read-action-format-function (cdr actions)))
- (resize-mini-windows t)
- (key "")
- action-idx)
- (while (and (setq action-idx (cl-position-if
- (lambda (x)
- (string-prefix-p key (car x)))
- (cdr actions)))
- (not (string= key (car (nth action-idx (cdr actions))))))
- (setq key (concat key (string
- (read-key
- (if (functionp display-function)
- (let ((ivy-posframe--ignore-prompt t))
- (funcall display-function hint)
- "Please type a key: ")
- hint))))))
- (cond ((member key '("" ""))
- nil)
- ((null action-idx)
- (message "%s is not bound" key)
- nil)
- (t
- (message "")
- (setcar actions (1+ action-idx))
- (ivy-set-action actions)))))))
+ (call-interactively #'ivy-read-action)))
+
+(defun ivy-posframe-read-action-by-key (actions)
+ (let* ((set-message-function nil)
+ (hint (funcall ivy-read-action-format-function (cdr actions)))
+ (resize-mini-windows t)
+ (key "")
+ action-idx)
+ (while (and (setq action-idx (cl-position-if
+ (lambda (x)
+ (string-prefix-p key (car x)))
+ (cdr actions)))
+ (not (string= key (car (nth action-idx (cdr actions))))))
+ (setq key (concat key (string
+ (read-key
+ (if (functionp display-function)
+ (let ((ivy-posframe--ignore-prompt t))
+ (funcall display-function hint)
+ "Please type a key: ")
+ hint))))))
+ (ivy-shrink-after-dispatching)
+ (cond ((member key '("ESC" "C-g"))
+ nil)
+ ((null action-idx)
+ (message "%s is not bound" key)
+ nil)
+ (t
+ (message "")
+ (setcar actions (1+ action-idx))
+ (ivy-set-action actions)))))
(defun ivy-posframe--window ()
"Return the posframe window displaying `ivy-posframe-buffer'."
- [elpa] externals/ivy-posframe updated (d539ac2 -> 1ca1ffb), Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 1ca1ffb 7/7: * ivy-posframe.el (ivy-posframe-read-action-by-key): Add comment., Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 8626284 5/7: * ivy-posframe.el: Update year, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 90fdb34 4/7: Update docstring., Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 7fc4574 2/7: Rewrite ivy-posframe--swiper-avy-candidate, Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 44af982 3/7: ivy-posframe-swiper-avy: Rewrite., Feng Shu, 2020/10/03
- [elpa] externals/ivy-posframe 661b22f 1/7: * ivy-posframe.el (ivy-posframe-read-action): Rewrite.,
Feng Shu <=
- [elpa] externals/ivy-posframe eeee753 6/7: * ivy-posframe.el (ivy-posframe--swiper-avy-candidates): Add comment about change., Feng Shu, 2020/10/03