[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bind-map 40ed95d4d5 80/97: Add bindings keyword
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bind-map 40ed95d4d5 80/97: Add bindings keyword |
Date: |
Thu, 20 Jan 2022 07:59:26 -0500 (EST) |
branch: elpa/bind-map
commit 40ed95d4d57192ed0c472e637778e98643ba9afa
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>
Add bindings keyword
---
bind-map.el | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/bind-map.el b/bind-map.el
index c6a4a330c6..7eeb5bcbe6 100644
--- a/bind-map.el
+++ b/bind-map.el
@@ -252,7 +252,12 @@ unspecified the bindings are global.
:prefix-cmd COMMAND-NAME
-Declare a prefix command for MAP named COMMAND-NAME."
+Declare a prefix command for MAP named COMMAND-NAME.
+
+:bindings \(KEY1 BINDING1 KEY2 BINDING2 ...\)
+
+Bind keys when declaring the map. This is optional, but added as
+a convenience."
(let* ((root-map (intern (format "%s-root-map" map)))
(active-var (intern (format "%s-active" map)))
(prefix-cmd (or (plist-get args :prefix-cmd)
@@ -273,7 +278,8 @@ mode maps. Set up by bind-map.el." map))
(evil-states (or (plist-get args :evil-states)
bind-map-default-evil-states))
(minor-modes (plist-get args :minor-modes))
- (major-modes (plist-get args :major-modes)))
+ (major-modes (plist-get args :major-modes))
+ (bindings (plist-get args :bindings)))
(append
'(progn)
@@ -358,7 +364,11 @@ mode maps. Set up by bind-map.el." map))
(push (list ',override-mode state key ',prefix-cmd)
bind-map-evil-local-bindings))
(evil-global-set-key state key ',prefix-cmd)))
- (evil-normalize-keymaps)))))))))
+ (evil-normalize-keymaps))))))
+
+ (when bindings
+ `((bind-map-set-keys ,map
+ ,@bindings))))))
(put 'bind-map 'lisp-indent-function 'defun)
(defun bind-map--get-prop (keyword args parent-args)
@@ -379,7 +389,8 @@ and :evil-states. All others must be declared explicitly."
(declare (indent defun))
(let* ((parent-args (symbol-plist parent))
(minor-modes (plist-get args :minor-modes))
- (major-modes (plist-get args :major-modes)))
+ (major-modes (plist-get args :major-modes))
+ (bindings (plist-get args :bindings)))
`(progn
(if (and (null ',minor-modes)
(null ',major-modes))
@@ -390,6 +401,7 @@ reference to :major-modes or :minor-modes")
:override-mode-name ,(plist-get args :override-mode-name)
:minor-modes ,minor-modes
:major-modes ,major-modes
+ :bindings ,bindings
,@(bind-map--get-prop :override-minor-modes args parent-args)
,@(bind-map--get-prop :keys args parent-args)
,@(bind-map--get-prop :evil-keys args parent-args)
- [nongnu] elpa/bind-map 9599acb5ab 35/97: Silence warning about defvar-local, (continued)
- [nongnu] elpa/bind-map 9599acb5ab 35/97: Silence warning about defvar-local, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 662dea907c 51/97: Suppress make-local warnings from compiler, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 9a676378fe 54/97: Simplify major-mode activation, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map e239bbdaef 44/97: Always use global evil maps, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map af26966c9a 57/97: Make macro expansion prettier, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 393879d260 58/97: Satisfy compiler, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 2fafc10f7d 45/97: Rename a var and a function and tweak a docstring, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map e94572b50b 74/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 00b7778826 68/97: Fix minor-mode tests, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 9ae3e9b113 72/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 40ed95d4d5 80/97: Add bindings keyword,
ELPA Syncer <=
- [nongnu] elpa/bind-map 6f84c0254f 78/97: Increment version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map c335674139 60/97: Add files for travis, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 89747f7240 75/97: Fix evil-local-mode-hook logic, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 76b8e2ab6c 85/97: Add tests for inheritance, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 6ba28e31aa 83/97: Revert change to prefix-cmd handling, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map fe76f92777 91/97: Add default keys and default evil-keys, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 26a3b5571d 88/97: Make return val consistent in bind-map, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map bf4181e3a4 95/97: Add types to defcustoms, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 510a24138d 97/97: Merge pull request #6 from skangas/bump-version, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 21f972e52d 08/97: Clarify some parts of README, ELPA Syncer, 2022/01/20