[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/embark da14427766: Support :filter for menu-items, simp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/embark da14427766: Support :filter for menu-items, simplify logic |
Date: |
Mon, 27 Feb 2023 03:57:46 -0500 (EST) |
branch: externals/embark
commit da144277663d761a22e0425117528b19b4fd43ba
Author: Omar Antolín Camarena <omar.antolin@gmail.com>
Commit: Omar Antolín Camarena <omar.antolin@gmail.com>
Support :filter for menu-items, simplify logic
---
embark.el | 38 +++++++++++---------------------------
1 file changed, 11 insertions(+), 27 deletions(-)
diff --git a/embark.el b/embark.el
index 50c9fe6659..af326eb36e 100644
--- a/embark.el
+++ b/embark.el
@@ -1217,7 +1217,7 @@ first line of the documentation string; otherwise use the
word
;; We cannot use the completion annotators in this case.
(defun embark--function-doc (sym)
"Documentation string of function SYM."
- (let ((vstr (and (keymapp sym) (boundp sym)
+ (let ((vstr (and (symbolp sym) (keymapp sym) (boundp sym)
(eq (symbol-function sym) (symbol-value sym))
(documentation-property sym 'variable-documentation))))
(when-let (str (or (ignore-errors (documentation sym)) vstr))
@@ -1243,35 +1243,19 @@ the tye of the current target."
The keybindings are returned in their order of appearance.
If NESTED is non-nil subkeymaps are not flattened."
(let* ((commands
- (cl-loop for (key . cmd) in (embark--all-bindings keymap nested)
- for name = (embark--command-name cmd)
- unless (or
- ;; skip which-key pseudo keys and other invalid
pairs
- (and (not (keymapp cmd))
- (not (functionp cmd))
- (consp cmd)
- (not (or (eq (car cmd) 'menu-item)
- (stringp (car cmd)))))
- (memq cmd '(embark-keymap-help
- negative-argument digit-argument)))
- collect (list name
- (cond
- ((and (not (symbolp cmd)) (keymapp cmd))
- 'keymap)
- ((and (consp cmd) (stringp (car cmd)))
- (cdr cmd))
- ((and (consp cmd) (eq (car cmd) 'menu-item))
- (caddr cmd))
- (t cmd))
- key
+ (cl-loop for (key . def) in (embark--all-bindings keymap nested)
+ for name = (embark--command-name def)
+ for cmd = (keymap--menu-item-binding def)
+ unless (memq cmd '(nil embark-keymap-help
+ negative-argument digit-argument))
+ collect (list name cmd key
(concat
- (if (and (consp cmd)
- (eq (car cmd) 'menu-item))
+ (if (eq (car-safe def) 'menu-item)
"menu-item"
(key-description key))))))
(width (cl-loop for (_name _cmd _key desc) in commands
maximize (length desc)))
- (def)
+ (default)
(candidates
(cl-loop for item in commands
for (name cmd key desc) = item
@@ -1287,9 +1271,9 @@ If NESTED is non-nil subkeymaps are not flattened."
name)
'embark-command cmd)
when (equal key [13])
- do (setq def formatted)
+ do (setq default formatted)
collect (cons formatted item))))
- (cons candidates def)))
+ (cons candidates default)))
(defun embark--with-category (category candidates)
"Return completion table for CANDIDATES of CATEGORY with sorting disabled."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/embark da14427766: Support :filter for menu-items, simplify logic,
ELPA Syncer <=