[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bind-map b187069313 22/97: Add short versions for single m
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bind-map b187069313 22/97: Add short versions for single major/minor mode |
Date: |
Thu, 20 Jan 2022 07:59:11 -0500 (EST) |
branch: elpa/bind-map
commit b1870693135b76efa849a86f3af942dc2e55340b
Author: justbur <justin@burkett.cc>
Commit: justbur <justin@burkett.cc>
Add short versions for single major/minor mode
---
bind-map.el | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/bind-map.el b/bind-map.el
index 5eab7c7fb1..15c5c5bb43 100644
--- a/bind-map.el
+++ b/bind-map.el
@@ -175,6 +175,48 @@ Declare a prefix command for MAP named COMMAND-NAME."
',evil-states nil ',evil-keys (quote prefix)))))))
(put 'bind-map 'lisp-indent-function 'defun)
+;;;###autoload
+(defmacro bind-map-for-major-mode (major-mode &rest args)
+ "Short version of `bind-map' if you want to bind a map for a
+single major mode. MAJOR-MODE is the unquoted symbol representing
+a major mode. This macro makes the call
+
+(bind-map MAJOR-MODE-bm-map
+ :major-modes (MAJOR-MODE)
+ ARGS)
+
+where ARGS should include :keys or :evil-keys. The name of the
+generated keymap is returned, which is always the name of the
+major mode with -bm-map appended."
+ (let ((map-name (intern (format "%s-bm-map" major-mode))))
+ `(progn
+ (bind-map ,map-name
+ :major-modes (,major-mode)
+ ,@args)
+ ',map-name)))
+(put 'bind-map-for-major-mode 'lisp-indent-function 'defun)
+
+;;;###autoload
+(defmacro bind-map-for-minor-mode (minor-mode &rest args)
+ "Short version of `bind-map' if you want to bind a map for a
+single minor mode. MINOR-MODE is the unquoted symbol representing
+a minor mode. This macro makes the call
+
+(bind-map MINOR-MODE-bm-map
+ :minor-modes (MINOR-MODE)
+ ARGS)
+
+where ARGS should include :keys or :evil-keys. The name of the
+generated keymap is returned, which is always the name of the
+minor mode with -bm-map appended."
+ (let ((map-name (intern (format "%s-bm-map" minor-mode))))
+ `(progn
+ (bind-map ,map-name
+ :minor-modes (,minor-mode)
+ ,@args)
+ ',map-name)))
+(put 'bind-map-for-minor-mode 'lisp-indent-function 'defun)
+
(defun bind-map-evil-define-key (states maps keys def)
"Version of `evil-define-key' that binds DEF across multiple STATES,
MAPS, and KEYS."
- [nongnu] elpa/bind-map d47be94d23 63/97: Don't try to bind keys that are nil or "", (continued)
- [nongnu] elpa/bind-map d47be94d23 63/97: Don't try to bind keys that are nil or "", ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map ebc4c9fb11 34/97: Remove bind-map-kbd hack, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 8ec4516db2 48/97: Remove use of evil-define-key, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map c182707793 41/97: Remove unnecessary helper functions and reorg, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map b0b9e18947 66/97: Revert last commit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map f51d4b0c0d 79/97: Add bind-map-for-modes-derived, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 21b7ba7eca 30/97: Fix some docstrings, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map cc1db8958c 64/97: Version 0.1, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 988f14eb77 65/97: Use evil-define-minor-mode-key for minor-mode keys, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 292794739c 71/97: Fix incorrect check of override mode in local hook, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map b187069313 22/97: Add short versions for single major/minor mode,
ELPA Syncer <=
- [nongnu] elpa/bind-map d45971cd40 46/97: Use minor mode for overriding behavior, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 8d6b489feb 50/97: Add some basic tests, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 24d453a1e8 55/97: Call evil-normalize-maps for evil-keys, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map b47b98455f 87/97: Simplify macro exp. for bind-mapfor-mode-inherit, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 078c522f6e 93/97: Fix Makefile, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map ffe5e63617 92/97: Version 1.1.0, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 46438e30c8 02/97: README formatting, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map f835ed39fe 06/97: Minor changes, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map 8dea8e8f91 10/97: Grammatical fix in README, ELPA Syncer, 2022/01/20
- [nongnu] elpa/bind-map e5647f14cf 11/97: Clarify modes in README, ELPA Syncer, 2022/01/20