[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/leaf b6276d7faa 15/28: Change the expand form of leaf-k
From: |
ELPA Syncer |
Subject: |
[elpa] externals/leaf b6276d7faa 15/28: Change the expand form of leaf-key, when binding to lambda or menu-item |
Date: |
Wed, 19 Jan 2022 18:58:41 -0500 (EST) |
branch: externals/leaf
commit b6276d7faa0ddf423d5fb0c22936152bb795e454
Author: Caowei <igooo.v@gmail.com>
Commit: Caowei <igooo.v@gmail.com>
Change the expand form of leaf-key, when binding to lambda or menu-item
---
leaf-tests.el | 8 +++++++-
leaf.el | 15 +++++----------
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/leaf-tests.el b/leaf-tests.el
index ed3108e5f2..c5b72b11a0 100644
--- a/leaf-tests.el
+++ b/leaf-tests.el
@@ -2454,7 +2454,13 @@ Example:
(let* ((old (lookup-key global-map (kbd "M-s O")))
(value `(global-map "M-s O" *lambda-function* ,(and old (not
(numberp old)) old) nil)))
(leaf-safe-push value leaf-key-bindlist)
- (define-key global-map (kbd "M-s O") (lambda () "color-moccur"
(interactive) (color-moccur))))))))
+ (define-key global-map (kbd "M-s O") '(lambda () "color-moccur"
(interactive) (color-moccur)))))
+
+ ((leaf-key "M-s O" '(menu-item "" nil :filter (lambda (&optional _)
#'other-window)))
+ (let* ((old (lookup-key global-map (kbd "M-s O")))
+ (value `(global-map "M-s O" *menu-item* ,(and old (not (numberp
old)) old) nil)))
+ (leaf-safe-push value leaf-key-bindlist)
+ (define-key global-map (kbd "M-s O") '(menu-item "" nil :filter
(lambda (&optional _) #'other-window))))))))
(when (version< "24.0" emacs-version)
(cort-deftest-with-macroexpand leaf/leaf-key-bind-keymap
diff --git a/leaf.el b/leaf.el
index 83f289bfb3..b4fce2a3e4 100644
--- a/leaf.el
+++ b/leaf.el
@@ -836,9 +836,6 @@ keystrokes. See documentation of `edmacro-mode' for
details.
COMMAND must be an interactive function. lambda form, menu-item,
or the form that returned one of them also be accepted.
-If lambda's docstring in non-nil, shall bind the lambda to the symbol
-using docstring; if not, shall bind the lambda to the symbol
-generated by `gensym'.
KEYMAP, if present, should be a keymap and not a quoted symbol.
For example:
@@ -848,20 +845,18 @@ You can also use [remap COMMAND] as KEY.
For example:
(leaf-key [remap backward-sentence] 'sh-beginning-of-command)"
(let* ((key* (eval key))
- (psucmd (eval command))
- (symbol (if (eq (car-safe psucmd) 'lambda)
- (if (documentation psucmd)
- (make-symbol (documentation psucmd))
- (gensym "cmd-"))))
- (command* (if symbol (progn (fset symbol psucmd) symbol) psucmd))
+ (command* (eval command))
(keymap* (eval keymap))
+ (bindto (cond ((symbolp command*) command*)
+ ((eq (car-safe command*) 'lambda) '*lambda-function*)
+ ((eq (car-safe command*) 'menu-item) '*menu-item*)))
(mmap (or keymap* 'global-map))
(vecp (vectorp key*))
(path (leaf-this-file))
(_mvec (if (vectorp key*) key* (read-kbd-macro key*)))
(mstr (if (stringp key*) key* (key-description key*))))
`(let* ((old (lookup-key ,mmap ,(if vecp key* `(kbd ,key*))))
- (value ,(list '\` `(,mmap ,mstr ,command* ,',(and old (not
(numberp old)) old) ,path))))
+ (value ,(list '\` `(,mmap ,mstr ,bindto ,',(and old (not (numberp
old)) old) ,path))))
(leaf-safe-push value leaf-key-bindlist)
(define-key ,mmap ,(if vecp key* `(kbd ,key*)) ',command*))))
- [elpa] externals/leaf updated (0ccc52bb85 -> 9eb18e8c9c), ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 1f51e90e99 01/28: On :package, save already installed pkgs into selected-packages, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 6f78d67369 12/28: Now :bind can accept lambda form binding. #322, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 7d8f768db5 19/28: Merge pull request #515 from meziberry/p/bind, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 1fd4508d4f 13/28: add testcase, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf a3835be6cc 20/28: Fix typo (isearch-mode-map), ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 3d8684dc2d 22/28: warn at :after when specified nil or any keywords, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf b6276d7faa 15/28: Change the expand form of leaf-key, when binding to lambda or menu-item,
ELPA Syncer <=
- [elpa] externals/leaf 9797d3258d 27/28: Get rid the warning in define minor mode., ELPA Syncer, 2022/01/19
- [elpa] externals/leaf d314af8e9f 26/28: Merge pull request #521 from lorniu/master, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 7460e3c5eb 11/28: Merge pull request #518 from conao3/test, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 2d395ee3d4 24/28: Merge pull request #525 from conao3/warn-after-keyword, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 5ac6ae61e1 04/28: leaf-keys use the BIND-KEYMAP-PKG ranther than :package's value, when 'bind-keymap being non-nil., ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 5469c1b5cf 03/28: Bugfix: leaf-keys-bind-keymap*'s error: number of arguments., ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 9d79978574 05/28: Merge pull request #509 from meziberry/p/leaf-keys-bind-keymap-asterisk, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 749593adae 08/28: tagged v4.5.3, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf 7cc38f9739 23/28: tagged v4.5.5, ELPA Syncer, 2022/01/19
- [elpa] externals/leaf d732e4b88c 07/28: use just `push` instead of using `package--update-selected-packages`, ELPA Syncer, 2022/01/19