[elpa] externals/frog-menu 6898f09 04/12: Fix example
branch: externals/frog-menu commit 6898f09cb101305b3ed6887d9f2ea95f8cb2a315 Author: Clemens Radermacher Commit: Clemens Radermacher Fix example --- README.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.org b/README.org index 42befb4..70699dd 100644 --- a/README.org +++ b/README.org @@ -115,5 +115,5 @@ And here is yet another example I use to navigate the menubar: (interactive) (run-hooks 'menu-bar-update-hook) (setq tmm-table-undef nil) - (frog-tmm-prompt (tmm-get-keybind [menu-bar]) mode-name)) + (frog-tmm-prompt (tmm-get-keybind [menu-bar]) (or mode mode-name))) #+end_src
[elpa] externals/frog-menu ac85040 07/12: Add posframe border option as suggested by #7
branch: externals/frog-menu commit ac850400ad12700be8e74a9c95396ae4720ede5e Author: Clemens Radermacher Commit: Clemens Radermacher Add posframe border option as suggested by #7 --- frog-menu.el | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frog-menu.el b/frog-menu.el index 880edfa..a8e38b6 100644 --- a/frog-menu.el +++ b/frog-menu.el @@ -167,6 +167,10 @@ exits through an error." "If non-nil use padding between avy hints and candidates." :type 'boolean) +(defcustom frog-menu-posframe-border-width 1 + "Border width to use for the posframe `frog-menu' creates." + :type 'integer) + (defcustom frog-menu-posframe-parameters nil "Explicit frame parameters to be used by the posframe `frog-menu' creates." :type 'list) @@ -465,7 +469,7 @@ Returns window of displayed buffer." (posframe-show buf :poshandler(or display-option #'posframe-poshandler-point-bottom-left-corner) - :internal-border-width 1 + :internal-border-width frog-menu-posframe-border-width :background-color (face-attribute 'frog-menu-posframe-background-face :background)
[elpa] externals/frog-menu ec633cd 02/12: Update example
branch: externals/frog-menu commit ec633cd67e794b931030426689e43521ec5011d8 Author: Clemens Radermacher Commit: Clemens Radermacher Update example --- README.org | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index a406b13..dc31a0d 100644 --- a/README.org +++ b/README.org @@ -77,22 +77,30 @@ Afterwards calling =M-x flyspell-correct-wrapper= will prompt you with a And here is yet another example I use to navigate the menubar: #+begin_src elisp +(defun tmm-init-km-list+ (menu) + (setq tmm-km-list nil) + (map-keymap (lambda (k v) (tmm-get-keymap (cons k v))) menu) + (setq tmm-km-list (nreverse tmm-km-list)) + ;; filter unenabled items + (setq tmm-km-list +(cl-remove-if + (lambda (item) + (eq (cddr item) 'ignore)) tmm-km-list))) + (defun frog-tmm () "Adapted from `counsel-tmm'." (interactive) - (require 'tmm) (run-hooks 'menu-bar-update-hook) (setq tmm-table-undef nil) (frog-tmm-prompt (tmm-get-keybind [menu-bar]))) + (defun frog-tmm-prompt (menu) "Adapted from `counsel-tmm-prompt'." (let (out choice chosen-string) -(setq tmm-km-list nil) -(map-keymap (lambda (k v) (tmm-get-keymap (cons k v))) menu) -(setq tmm-km-list (nreverse tmm-km-list)) +(setq tmm-km-list (tmm-init-km-list+ menu)) (setq out (frog-menu-read "Menu: " (mapcar #'car tmm-km-list))) (setq choice (cdr (assoc out tmm-km-list))) (setq chosen-string (car choice))
[elpa] externals/frog-menu 4ef6586 09/12: Give frog-menu-posframe-background-face a default background color
branch: externals/frog-menu commit 4ef6586df7dc7b135e35d9edbc14fe3458fe4070 Author: Clemens Radermacher Commit: Clemens Radermacher Give frog-menu-posframe-background-face a default background color --- frog-menu.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frog-menu.el b/frog-menu.el index 512dd64..731c505 100644 --- a/frog-menu.el +++ b/frog-menu.el @@ -261,7 +261,7 @@ for this.") "Face used for menu action keybindings.") (defface frog-menu-posframe-background-face - '((t (:inherit default))) + '((t :background "old lace")) "Face used for the background color of the posframe.") (defvar frog-menu--buffer " *frog-menu-menu*"
[elpa] externals/frog-menu 06d5f17 03/12: Add mode menu entry command for example
branch: externals/frog-menu commit 06d5f175d4dc82c182cd4215985872a37a697677 Author: Clemens Radermacher Commit: Clemens Radermacher Add mode menu entry command for example --- README.org | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/README.org b/README.org index dc31a0d..42befb4 100644 --- a/README.org +++ b/README.org @@ -87,21 +87,13 @@ And here is yet another example I use to navigate the menubar: (lambda (item) (eq (cddr item) 'ignore)) tmm-km-list))) -(defun frog-tmm () - "Adapted from `counsel-tmm'." - (interactive) - (run-hooks 'menu-bar-update-hook) - (setq tmm-table-undef nil) - (frog-tmm-prompt (tmm-get-keybind [menu-bar]))) - - -(defun frog-tmm-prompt (menu) +(defun frog-tmm-prompt (menu &optional item) "Adapted from `counsel-tmm-prompt'." (let (out choice chosen-string) (setq tmm-km-list (tmm-init-km-list+ menu)) -(setq out (frog-menu-read "Menu: " (mapcar #'car tmm-km-list))) +(setq out (or item (frog-menu-read "Menu: " (mapcar #'car tmm-km-list (setq choice (cdr (assoc out tmm-km-list))) (setq chosen-string (car choice)) (setq choice (cdr choice)) @@ -110,4 +102,18 @@ And here is yet another example I use to navigate the menubar: ((and choice chosen-string) (setq last-command-event chosen-string) (call-interactively choice) + +(defun frog-tmm () + "Adapted from `counsel-tmm'." + (interactive) + (run-hooks 'menu-bar-update-hook) + (setq tmm-table-undef nil) + (frog-tmm-prompt (tmm-get-keybind [menu-bar]))) + +(defun frog-tmm-mode (&optional mode) + "Adapted from `counsel-tmm'." + (interactive) + (run-hooks 'menu-bar-update-hook) + (setq tmm-table-undef nil) + (frog-tmm-prompt (tmm-get-keybind [menu-bar]) mode-name)) #+end_src
[elpa] externals/frog-menu updated (927ff01 -> 3d99c10)
clemera pushed a change to branch externals/frog-menu. from 927ff01 Merge branch 'master' into externals/frog-menu new 1bcc95f Add menubar example new ec633cd Update example new 06d5f17 Add mode menu entry command for example new 6898f09 Fix example new 0430a4f Update example new 9b2fd00 Require tmm for example new ac85040 Add posframe border option as suggested by #7 new 94c99cf Add support for all collection formats of completing-read new 4ef6586 Give frog-menu-posframe-background-face a default background color new 94a24ff Fix hash collection types new d8e9325 Fix compiler errors new 3d99c10 Bump version Summary of changes: README.org | 43 frog-menu.el | 72 +--- 2 files changed, 102 insertions(+), 13 deletions(-)
[elpa] externals/frog-menu 3d99c10 12/12: Bump version
branch: externals/frog-menu commit 3d99c10eb472b5f7fe761bb3f329fe10971ea903 Author: Clemens Radermacher Commit: Clemens Radermacher Bump version --- frog-menu.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frog-menu.el b/frog-menu.el index dbd26bb..dad0a0f 100644 --- a/frog-menu.el +++ b/frog-menu.el @@ -4,7 +4,7 @@ ;; Author: Clemens Radermacher ;; URL: https://github.com/clemera/frog-menu -;; Version: 0.2.10 +;; Version: 0.2.11 ;; Package-Requires: ((emacs "26") (avy "0.4") (posframe "0.4")) ;; Keywords: convenience
[elpa] externals/frog-menu d8e9325 11/12: Fix compiler errors
branch: externals/frog-menu commit d8e9325f317cd0af2be42b8e3bdc945b262c7435 Author: Clemens Radermacher Commit: Clemens Radermacher Fix compiler errors --- frog-menu.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frog-menu.el b/frog-menu.el index e010b5d..dbd26bb 100644 --- a/frog-menu.el +++ b/frog-menu.el @@ -688,9 +688,9 @@ COLLECTION and PREDICATE should have the format as specified by (lambda (key val) (unless (and predicate (funcall predicate key val)) -(push (if (symbolp el) - (symbol-name el) - el) +(push (if (symbolp key) + (symbol-name key) + key) strings))) collection) (nreverse strings)))
[elpa] externals/frog-menu 9b2fd00 06/12: Require tmm for example
branch: externals/frog-menu commit 9b2fd001e09dd60702527a8cfdc8d96c0dc7ff4d Author: Clemens Radermacher Commit: Clemens Radermacher Require tmm for example --- README.org | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.org b/README.org index ecbfec3..ee265dc 100644 --- a/README.org +++ b/README.org @@ -77,6 +77,8 @@ Afterwards calling =M-x flyspell-correct-wrapper= will prompt you with a And here is yet another example I use to navigate the menubar: #+begin_src elisp +(require 'tmm) + (defun tmm-init-km-list+ (menu) (setq tmm-km-list nil) (map-keymap (lambda (k v) (tmm-get-keymap (cons k v))) menu)
[elpa] externals/frog-menu 0430a4f 05/12: Update example
branch: externals/frog-menu commit 0430a4f17f5471cf07b3dccfac758577016c14f7 Author: Clemens Radermacher Commit: Clemens Radermacher Update example --- README.org | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.org b/README.org index 70699dd..ecbfec3 100644 --- a/README.org +++ b/README.org @@ -87,13 +87,13 @@ And here is yet another example I use to navigate the menubar: (lambda (item) (eq (cddr item) 'ignore)) tmm-km-list))) -(defun frog-tmm-prompt (menu &optional item) +(defun frog-tmm-prompt (menu &optional entry) "Adapted from `counsel-tmm-prompt'." (let (out choice chosen-string) (setq tmm-km-list (tmm-init-km-list+ menu)) -(setq out (or item (frog-menu-read "Menu: " (mapcar #'car tmm-km-list +(setq out (or entry (frog-menu-read "Menu: " (mapcar #'car tmm-km-list (setq choice (cdr (assoc out tmm-km-list))) (setq chosen-string (car choice)) (setq choice (cdr choice)) @@ -103,17 +103,15 @@ And here is yet another example I use to navigate the menubar: (setq last-command-event chosen-string) (call-interactively choice) -(defun frog-tmm () +(defun frog-tmm (&optional entry) "Adapted from `counsel-tmm'." (interactive) (run-hooks 'menu-bar-update-hook) (setq tmm-table-undef nil) - (frog-tmm-prompt (tmm-get-keybind [menu-bar]))) + (frog-tmm-prompt (tmm-get-keybind [menu-bar]) entry)) -(defun frog-tmm-mode (&optional mode) +(defun frog-tmm-mode () "Adapted from `counsel-tmm'." (interactive) - (run-hooks 'menu-bar-update-hook) - (setq tmm-table-undef nil) - (frog-tmm-prompt (tmm-get-keybind [menu-bar]) (or mode mode-name))) + (frog-tmm mode-name)) #+end_src
[elpa] externals/frog-menu 94c99cf 08/12: Add support for all collection formats of completing-read
branch: externals/frog-menu commit 94c99cfd647c71e8e46c82de8dd8a282d44c9efc Author: Clemens Radermacher Commit: Clemens Radermacher Add support for all collection formats of completing-read --- frog-menu.el | 61 ++-- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/frog-menu.el b/frog-menu.el index a8e38b6..512dd64 100644 --- a/frog-menu.el +++ b/frog-menu.el @@ -641,27 +641,68 @@ COLLECTION are the arguments from `frog-menu-read'." (replace-regexp-in-string "\\(: ?\\)?\\'" ": " prompt)) collection args)) -(defun frog-menu-completing-read-function (prompt collection &rest _) +(defun frog-menu-completing-read-function (prompt collection predicate &rest _) "Can be used as `completing-read-function'. -For now all arguments other than PROMPT and COLLECTION are -ignored. COLLECTION has to use a format `frog-menu-read' can -understand." - (frog-menu-read prompt collection)) +PROMPT, COLLECTION and PREDICATE are of format as specified by +`completing-read'." + (let ((strings (frog-menu--collection-to-strings collection predicate))) +(frog-menu-read prompt strings))) ;;;###autoload (defun frog-menu-call (cmds &optional prompt) "Read a command from CMDS and execute it. -CMDS is a list of command symbols to choose from. If PROMPT is -given it should be a string with prompt information for the -user." - (let ((cmd (intern-soft (frog-menu-read (or prompt "") - (mapcar #'symbol-name cmds) +CMDS is of format as specified by `completing-read' +collections. If PROMPT is given it should be a string with prompt +information for the user." + (let ((cmd (intern-soft (frog-menu-read + (or prompt "") + (frog-menu--collection-to-strings cmds) (command-execute cmd))) +(defun frog-menu--collection-to-strings (collection &optional predicate) + "Return list of strings representing COLLECTION. +COLLECTION and PREDICATE should have the format as specified by +`completing-read'." + (cond ((functionp collection) + (let ((cands (funcall collection "" predicate t))) + (if (stringp (car-safe cands)) + (copy-sequence cands) + (mapcar #'symbol-name cands +((listp collection) + (let ((strings ())) + (dolist (el collection (nreverse strings)) + (unless (and predicate + (funcall predicate el)) + (let ((cand (or (car-safe el) el))) + (push (if (symbolp cand) + (symbol-name cand) + cand) + strings)) +((hash-table-p collection) + (let ((strings ())) + (maphash +(lambda (key val) + (unless (and predicate + (funcall predicate key val)) +(push (if (symbolp el) + (symbol-name el) + el) + strings + (nreverse strings))) +((vectorp collection) + (let ((strings ())) + (mapatoms +(lambda (el) + (unless (and predicate + (funcall predicate el)) +(push (symbol-name el) strings + (nreverse strings) + + ;;;###autoload (defun frog-menu-read (prompt collection &optional actions) "Read from a menu of variable `frog-menu-type'.
[elpa] externals/frog-menu 1bcc95f 01/12: Add menubar example
branch: externals/frog-menu commit 1bcc95fbeb5a7bba498ec3d0689656a1e5483d0b Author: Clemens Radermacher Commit: Clemens Radermacher Add menubar example --- README.org | 29 + 1 file changed, 29 insertions(+) diff --git a/README.org b/README.org index e8fc72f..a406b13 100644 --- a/README.org +++ b/README.org @@ -74,3 +74,32 @@ of (command . word) to be used by `flyspell-do-correct'." Afterwards calling =M-x flyspell-correct-wrapper= will prompt you with a =frog-menu=. +And here is yet another example I use to navigate the menubar: + +#+begin_src elisp +(defun frog-tmm () + "Adapted from `counsel-tmm'." + (interactive) + (require 'tmm) + (run-hooks 'menu-bar-update-hook) + (setq tmm-table-undef nil) + (frog-tmm-prompt (tmm-get-keybind [menu-bar]))) + +(defun frog-tmm-prompt (menu) + "Adapted from `counsel-tmm-prompt'." + (let (out +choice +chosen-string) +(setq tmm-km-list nil) +(map-keymap (lambda (k v) (tmm-get-keymap (cons k v))) menu) +(setq tmm-km-list (nreverse tmm-km-list)) +(setq out (frog-menu-read "Menu: " (mapcar #'car tmm-km-list))) +(setq choice (cdr (assoc out tmm-km-list))) +(setq chosen-string (car choice)) +(setq choice (cdr choice)) +(cond ((keymapp choice) + (frog-tmm-prompt choice)) + ((and choice chosen-string) + (setq last-command-event chosen-string) + (call-interactively choice) +#+end_src
[elpa] externals/frog-menu 94a24ff 10/12: Fix hash collection types
branch: externals/frog-menu commit 94a24ffcadcb2f6aa360b0cc724fa0b897b1f777 Author: Clemens Radermacher Commit: Clemens Radermacher Fix hash collection types --- frog-menu.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frog-menu.el b/frog-menu.el index 731c505..e010b5d 100644 --- a/frog-menu.el +++ b/frog-menu.el @@ -691,7 +691,8 @@ COLLECTION and PREDICATE should have the format as specified by (push (if (symbolp el) (symbol-name el) el) - strings + strings))) +collection) (nreverse strings))) ((vectorp collection) (let ((strings ()))