[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/which-key 1692a1e54f 1/2: Add an example to README for
From: |
ELPA Syncer |
Subject: |
[elpa] externals/which-key 1692a1e54f 1/2: Add an example to README for keymap binding |
Date: |
Mon, 18 Apr 2022 22:57:56 -0400 (EDT) |
branch: externals/which-key
commit 1692a1e54f690a07292f0ebab53640178044fd5a
Author: Justin Burkett <justin@burkett.cc>
Commit: Justin Burkett <justin@burkett.cc>
Add an example to README for keymap binding
See #338
---
README.org | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
index 994931813d..9d9a4c4a57 100644
--- a/README.org
+++ b/README.org
@@ -278,17 +278,22 @@
example,
#+BEGIN_SRC emacs-lisp
- (define-key some-map "f" '("foo" . command-foo))
- (define-key some-map "b" '("bar-prefix" . (keymap)))
+ (define-key some-map "f" '("foo" . command-foo))
+ (define-key some-map "b" '("bar-prefix" . (keymap)))
+ (setq my-map (make-sparse-keymap))
+ (define-key some-map "b" (cons "bar-prefix" my-map))
#+END_SRC
binds =command-foo= to =f= in =some-map=, but also stores the string "foo"
which which-key will extract to use to describe this command. The second
example binds an empty keymap to =b= in =some-map= and uses "bar-prefix"
to
- describe it. These bindings are accepted by =define-key= natively (i.e.,
- with or without which-key being loaded). Since many key-binding utilities
- use =define-key= internally, this functionality should be available with
- your favorite method of defining keys as well.
+ describe it. The last two lines replicate the functionality of the second
+ line, while assigning the new keymap to the symbol =my-map= (note the use
+ of =cons= to ensure that =my-map= is evaluated for =define-key=). These
+ bindings are accepted by =define-key= natively (i.e., with or without
+ which-key being loaded). Since many key-binding utilities use =define-key=
+ internally, this functionality should be available with your favorite
+ method of defining keys as well.
The second method is to use =which-key-add-keymap-based-replacements=. The
statement
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/which-key 1692a1e54f 1/2: Add an example to README for keymap binding,
ELPA Syncer <=