[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/frog-menu 60ed0a5 15/43: Support passing only actions,
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/frog-menu 60ed0a5 15/43: Support passing only actions, too |
Date: |
Sun, 24 Mar 2019 05:14:45 -0400 (EDT) |
branch: externals/frog-menu
commit 60ed0a5e76cb38d61e599250444f484e6357de48
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Support passing only actions, too
---
frog-menu.el | 60 ++++++++++++++++++++++++++++++++++--------------------------
1 file changed, 34 insertions(+), 26 deletions(-)
diff --git a/frog-menu.el b/frog-menu.el
index 1b8400b..12d1435 100644
--- a/frog-menu.el
+++ b/frog-menu.el
@@ -200,12 +200,13 @@ PROMPT, STRINGS and ACTIONS are the args from
`frog-menu-read'.
Fills the buffer with a grid of STRINGS followed by PROMPT and
ACTIONS."
- (insert
- (frog-menu--grid-format
- strings
- (funcall frog-menu-grid-column-function)
- (funcall frog-menu-grid-width-function)))
- (insert "\n\n")
+ (when strings
+ (insert
+ (frog-menu--grid-format
+ strings
+ (funcall frog-menu-grid-column-function)
+ (funcall frog-menu-grid-width-function)))
+ (insert "\n\n"))
(insert (frog-menu--prompt-format prompt actions))
;; padding for avy char
(goto-char (point-min))
@@ -313,7 +314,9 @@ positions containing the candidates and default to
‘point-min’ and
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
- (push (cons (point) w) candidates)
+ (when (eq (get-char-property (point) 'face)
+ 'frog-menu-candidate-face)
+ (push (cons (point) w) candidates))
(goto-char
(or (next-single-property-change
(point) 'face)
@@ -369,25 +372,30 @@ argument of `frog-menu-read'. BUFFER is the menu buffer
which
gets hidden after the query."
;; uses a global keymap var to pass info to avy handler
(frog-menu--init-avy-action-map actions)
- (let* ((avy-keys frog-menu-avy-keys)
- (avy-handler-function #'frog-menu--posframe-ace-handler)
- (avy-pre-action #'ignore)
- (avy-all-windows nil)
- (avy-style 'pre)
- (avy-action #'identity)
- (pos (avy--process
- candidates
- (avy--style-fn avy-style))))
- (cond ((number-or-marker-p pos)
- ;; string
- (with-current-buffer buffer
- (let* ((start pos)
- (end (or (next-single-property-change start 'face)
- (point-max))))
- (buffer-substring start end))))
- ((commandp pos)
- ;; action
- (call-interactively pos)))))
+ (if candidates
+ (let* ((avy-keys frog-menu-avy-keys)
+ (avy-single-candidate-jump nil)
+ (avy-handler-function #'frog-menu--posframe-ace-handler)
+ (avy-pre-action #'ignore)
+ (avy-all-windows nil)
+ (avy-style 'pre)
+ (avy-action #'identity)
+ (pos (avy--process
+ candidates
+ (avy--style-fn avy-style))))
+ (cond ((number-or-marker-p pos)
+ ;; string
+ (with-current-buffer buffer
+ (let* ((start pos)
+ (end (or (next-single-property-change start 'face)
+ (point-max))))
+ (buffer-substring start end))))
+ ((commandp pos)
+ ;; action
+ (call-interactively pos))))
+ (let ((cmd (lookup-key frog-menu--avy-action-map (vector (read-char)))))
+ (when (commandp cmd)
+ (call-interactively cmd)))))
;; * Entry point
- [elpa] externals/frog-menu 625165e 40/43: Add autoload cookie for frog-menu-read, (continued)
- [elpa] externals/frog-menu 625165e 40/43: Add autoload cookie for frog-menu-read, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 6596627 20/43: Add prompt face, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 0d4d9f2 25/43: Update description for new frog-menu-type avy-side-window, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 6bf85da 32/43: Rephrase description, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 0ba3279 36/43: add face for posframe menu action keybindings, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu f45005d 42/43: Merge branch 'master' of github.com:clemera/frog-menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 9c382dc 08/43: Improve description, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu fbe8f88 10/43: Fix adding padding for avy char, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu b73b59a 11/43: Mention avy-menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 7f403de 12/43: Link to ace-popup-menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 60ed0a5 15/43: Support passing only actions, too,
Clemens Radermacher <=
- [elpa] externals/frog-menu e2307a0 19/43: Add actions face, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 8b7213d 27/43: Merge branch 'master' of github.com:clemera/frog-menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 2a29f34 29/43: Add usage description for flyspell-correct, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 37ad44b 21/43: Refactor and add new menu type for non graphical displays, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 6abd002 34/43: Use own avy style function and allow padding, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 3d84ba3 38/43: allow flexible way to customize posframe parameters, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 6373133 37/43: Merge pull request #2 from waymondo/master, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 173aea7 41/43: Add more padding to the right of menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 75f5243 39/43: Merge pull request #3 from waymondo/posframe-parameters, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu cd5dd46 43/43: Checkdoc fixes, Clemens Radermacher, 2019/03/24