[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/leaf fbe9bfb 43/46: Merge pull request #468 from Z572/l
From: |
Stefan Monnier |
Subject: |
[elpa] externals/leaf fbe9bfb 43/46: Merge pull request #468 from Z572/leaf-key-list-mode |
Date: |
Mon, 15 Mar 2021 22:20:47 -0400 (EDT) |
branch: externals/leaf
commit fbe9bfba5ef4c99ee190b259a5e3341dd7a71935
Merge: 39e0359 1ee956d
Author: Naoya Yamashita <conao3@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #468 from Z572/leaf-key-list-mode
Let the leaf-key-describe-bindings with a path
---
leaf-tests.el | 12 ++++++------
leaf.el | 19 ++++++++++++++-----
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/leaf-tests.el b/leaf-tests.el
index ff4f92d..998694a 100644
--- a/leaf-tests.el
+++ b/leaf-tests.el
@@ -2270,37 +2270,37 @@ Example:
(cort-deftest-with-macroexpand leaf/leaf-key
'(((leaf-key "C-M-i" 'flyspell-correct-wrapper)
(let* ((old (lookup-key global-map (kbd "C-M-i")))
- (value `(global-map "C-M-i" flyspell-correct-wrapper ,(and old
(not (numberp old)) old))))
+ (value `(global-map "C-M-i" flyspell-correct-wrapper ,(and old
(not (numberp old)) old) nil)))
(push value leaf-key-bindlist)
(define-key global-map (kbd "C-M-i") 'flyspell-correct-wrapper)))
((leaf-key [remap backward-sentence] 'sh-beginning-of-command)
(let* ((old (lookup-key global-map [remap backward-sentence]))
- (value `(global-map "<remap> <backward-sentence>"
sh-beginning-of-command ,(and old (not (numberp old)) old))))
+ (value `(global-map "<remap> <backward-sentence>"
sh-beginning-of-command ,(and old (not (numberp old)) old) nil)))
(push value leaf-key-bindlist)
(define-key global-map [remap backward-sentence]
'sh-beginning-of-command)))
((leaf-key "C-M-i" 'flyspell-correct-wrapper 'c-mode-map)
(let* ((old (lookup-key c-mode-map (kbd "C-M-i")))
- (value `(c-mode-map "C-M-i" flyspell-correct-wrapper ,(and old
(not (numberp old)) old))))
+ (value `(c-mode-map "C-M-i" flyspell-correct-wrapper ,(and old
(not (numberp old)) old) nil)))
(push value leaf-key-bindlist)
(define-key c-mode-map (kbd "C-M-i") 'flyspell-correct-wrapper)))
((leaf-key [remap backward-sentence] 'sh-beginning-of-command
'shell-mode-map)
(let* ((old (lookup-key shell-mode-map [remap backward-sentence]))
- (value `(shell-mode-map "<remap> <backward-sentence>"
sh-beginning-of-command ,(and old (not (numberp old)) old))))
+ (value `(shell-mode-map "<remap> <backward-sentence>"
sh-beginning-of-command ,(and old (not (numberp old)) old) nil)))
(push value leaf-key-bindlist)
(define-key shell-mode-map [remap backward-sentence]
'sh-beginning-of-command)))
((leaf-key (vector 'key-chord ?i ?j) 'undo nil)
(let* ((old (lookup-key global-map (vector 'key-chord 105 106)))
- (value `(global-map "<key-chord> i j" undo ,(and old (not
(numberp old)) old))))
+ (value `(global-map "<key-chord> i j" undo ,(and old (not
(numberp old)) old) nil)))
(push value leaf-key-bindlist)
(define-key global-map (vector 'key-chord 105 106) 'undo)))
((leaf-key [(control ?x) (control ?f)] 'undo)
(let* ((old (lookup-key global-map [(control 120) (control 102)]))
- (value `(global-map "C-x C-f" undo ,(and old (not (numberp old))
old))))
+ (value `(global-map "C-x C-f" undo ,(and old (not (numberp old))
old) nil)))
(push value leaf-key-bindlist)
(define-key global-map [(control 120) (control 102)] 'undo))))))
diff --git a/leaf.el b/leaf.el
index 933194b..ff45cd1 100644
--- a/leaf.el
+++ b/leaf.el
@@ -5,7 +5,7 @@
;; Author: Naoya Yamashita <conao3@gmail.com>
;; Maintainer: Naoya Yamashita <conao3@gmail.com>
;; Keywords: lisp settings
-;; Version: 4.3.8
+;; Version: 4.3.9
;; URL: https://github.com/conao3/leaf.el
;; Package-Requires: ((emacs "24.1"))
@@ -619,6 +619,12 @@ see `alist-get'."
(when load-file-name
(format " at `%s'" load-file-name))))
+(defun leaf-this-file ()
+ "Return path to this file."
+ (or load-file-name
+ (and (boundp 'byte-compile-current-file) byte-compile-current-file)
+ buffer-file-name))
+
;;;; General functions for leaf
@@ -788,7 +794,7 @@ see `alist-get'."
(defvar leaf-key-bindlist nil
"List of bindings performed by `leaf-key'.
-Elements have the form (MAP KEY CMD ORIGINAL-CMD)")
+Elements have the form (MAP KEY CMD ORIGINAL-CMD PATH)")
(defmacro leaf-key (key command &optional keymap)
"Bind KEY to COMMAND in KEYMAP (`global-map' if not passed).
@@ -817,10 +823,11 @@ For example:
(keymap* (eval keymap))
(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)))))
+ (value ,(list '\` `(,mmap ,mstr ,command* ,',(and old (not
(numberp old)) old) ,path))))
(push value leaf-key-bindlist)
(define-key ,mmap ,(if vecp key `(kbd ,key)) ',command*))))
@@ -909,7 +916,8 @@ BIND must not contain :{{map}}."
(setq tabulated-list-format [("Map" 20 t)
("Key" 20 t)
("Command" 40 t)
- ("Before Command" 0 t)])
+ ("Before Command" 40 t)
+ ("Path" 0 t)])
(setq tabulated-list-entries
(let ((id 0)
(formatfn (lambda (elm)
@@ -922,7 +930,8 @@ BIND must not contain :{{map}}."
(push `(,id [,(funcall formatfn (nth 0 elm))
,(funcall formatfn (nth 1 elm))
,(funcall formatfn (nth 2 elm))
- ,(funcall formatfn (nth 3 elm))])
+ ,(funcall formatfn (nth 3 elm))
+ ,(funcall formatfn (nth 4 elm))])
res))
(nreverse res)))
(setq tabulated-list-sort-key '("Map" . nil))
- [elpa] externals/leaf b1fe4f2 46/46: Merge pull request #481 from Z572/fix-leaf-find-regexp, (continued)
- [elpa] externals/leaf b1fe4f2 46/46: Merge pull request #481 from Z572/fix-leaf-find-regexp, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf b64a2fa 40/46: fix test, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf d6c12f1 33/46: tagged v4.3.7, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf 1db35d4 19/46: format sexp, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf 39e0359 37/46: Merge pull request #480 from conao3/feature#479, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf 1ee956d 42/46: tagged v4.3.9, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf 31e1fac 07/46: Added support to find the leaf block., Stefan Monnier, 2021/03/15
- [elpa] externals/leaf bafd5c5a 18/46: move leaf-find-regexp definition, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf cb35aac 34/46: Merge pull request #478 from conao3/feature#477, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf 2d210be 24/46: expand :leaf-path keyword anytime but set suppress-keywords, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf fbe9bfb 43/46: Merge pull request #468 from Z572/leaf-key-list-mode,
Stefan Monnier <=
- [elpa] externals/leaf 38ef506 45/46: tagged v4.4.0, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf 1695574 11/46: update document, tagged v4.3.4, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf 005481d 28/46: tagged v4.3.6, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf fc8924d 27/46: add just eval-buffer, byte-compile situation, Stefan Monnier, 2021/03/15
- [elpa] externals/leaf fe1003f 39/46: align load-file-name, Stefan Monnier, 2021/03/15