diff options
| author | Justin Burkett | 2021-06-21 15:57:40 -0400 |
|---|---|---|
| committer | Justin Burkett | 2021-06-21 15:57:40 -0400 |
| commit | 300c098be55d78d5d94da59da0280a8a56cc3792 (patch) | |
| tree | 9de72d7ee00f2eabe8ecd778cc9ca4b0e9af7a8c | |
| parent | 8b707ef6c51808e944f8056b546ceb168a445079 (diff) | |
| download | emacs-300c098be55d78d5d94da59da0280a8a56cc3792.tar.gz emacs-300c098be55d78d5d94da59da0280a8a56cc3792.zip | |
Update README
| -rw-r--r-- | README.org | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/README.org b/README.org index 3064466a558..2280f704acf 100644 --- a/README.org +++ b/README.org | |||
| @@ -3,6 +3,11 @@ | |||
| 3 | [[http://stable.melpa.org/#/which-key][file:http://stable.melpa.org/packages/which-key-badge.svg]] | 3 | [[http://stable.melpa.org/#/which-key][file:http://stable.melpa.org/packages/which-key-badge.svg]] |
| 4 | 4 | ||
| 5 | ** Recent Changes | 5 | ** Recent Changes |
| 6 | *** 2021-06-21: Add support for menu-item bindings | ||
| 7 | =which-key= will now detect and compute the result of =menu-item= | ||
| 8 | bindings. As a consequence of reworking the internals, | ||
| 9 | =which-key-enable-extended-define-key= is now obsolete (the associated | ||
| 10 | behavior is supported by default). | ||
| 6 | 11 | ||
| 7 | *** 2020-08-28: Added =which-key-add-keymap-based-replacements= | 12 | *** 2020-08-28: Added =which-key-add-keymap-based-replacements= |
| 8 | This function provides an alternative interface allowing replacements to be | 13 | This function provides an alternative interface allowing replacements to be |
| @@ -34,6 +39,7 @@ | |||
| 34 | ** Table of Contents :TOC_3: | 39 | ** Table of Contents :TOC_3: |
| 35 | - [[#which-key][which-key]] | 40 | - [[#which-key][which-key]] |
| 36 | - [[#recent-changes][Recent Changes]] | 41 | - [[#recent-changes][Recent Changes]] |
| 42 | - [[#2021-06-21-add-support-for-menu-item-bindings][2021-06-21: Add support for menu-item bindings]] | ||
| 37 | - [[#2020-08-28-added-which-key-add-keymap-based-replacements][2020-08-28: Added =which-key-add-keymap-based-replacements=]] | 43 | - [[#2020-08-28-added-which-key-add-keymap-based-replacements][2020-08-28: Added =which-key-add-keymap-based-replacements=]] |
| 38 | - [[#2019-08-01-added-which-key-show-early-on-c-h][2019-08-01: Added =which-key-show-early-on-C-h=]] | 44 | - [[#2019-08-01-added-which-key-show-early-on-c-h][2019-08-01: Added =which-key-show-early-on-C-h=]] |
| 39 | - [[#2017-12-13-added-which-key-enable-extended-define-key][2017-12-13: Added =which-key-enable-extended-define-key=]] | 45 | - [[#2017-12-13-added-which-key-enable-extended-define-key][2017-12-13: Added =which-key-enable-extended-define-key=]] |
| @@ -275,30 +281,26 @@ | |||
| 275 | "f" '("foo" . long-command-name-foo) | 281 | "f" '("foo" . long-command-name-foo) |
| 276 | ;; or | 282 | ;; or |
| 277 | ;; "f" "foo" (see the docstring) | 283 | ;; "f" "foo" (see the docstring) |
| 278 | "b" '("bar-prefix") | 284 | "b" '("bar-prefix" . (keymap)) |
| 279 | ;; or | 285 | ;; or |
| 280 | ;; "b" "bar-prefix" (see the docstring) | 286 | ;; "b" "bar-prefix" (see the docstring) |
| 281 | ) | 287 | ) |
| 282 | #+END_SRC | 288 | #+END_SRC |
| 283 | 289 | ||
| 284 | uses =define-key= to add two bindings and tells which-key to use the string | 290 | uses =define-key= to add two bindings and tells which-key to use the string |
| 285 | "foo" in place of "command-foo" and the string "bar-prefix" for | 291 | "foo" in place of "command-foo" and the string "bar-prefix" for an empty |
| 286 | some-prefix-map. Note that =which-key-add-keymap-based-replacements= will | 292 | prefix map. =which-key-add-keymap-based-replacements= uses =define-key= to |
| 287 | not bind a command, so =define-key= must still be used. | 293 | bind (or rebind) the command, and you may also use =define-key= directly as |
| 288 | 294 | follows. | |
| 289 | Alternatively, you may set =which-key-enable-extended-define-key= to =t= | ||
| 290 | before loading which-key and accomplish the same effect using only | ||
| 291 | =define-key= as follows. | ||
| 292 | 295 | ||
| 293 | #+BEGIN_SRC emacs-lisp | 296 | #+BEGIN_SRC emacs-lisp |
| 294 | (define-key some-map "f" '("foo" . command-foo)) | 297 | (define-key some-map "f" '("foo" . command-foo)) |
| 295 | (define-key some-map "b" '("bar-prefix")) | 298 | (define-key some-map "b" '("bar-prefix" . (keymap))) |
| 296 | #+END_SRC | 299 | #+END_SRC |
| 297 | 300 | ||
| 298 | The option =which-key-enable-extended-define-key= advises =define-key= to | 301 | Here =define-key= uses the natively supported =(NAME . COMMAND)= notation |
| 299 | allow which-key to use the =(NAME . COMMAND)= notation to simultaneously | 302 | to simultaneously define a command and give that command a name. Since many |
| 300 | define a command and give that command a name using =define-key=. Since | 303 | key-binding utilities use =define-key= internally, this functionality |
| 301 | many key-binding utilities use =define-key= internally, this functionality | ||
| 302 | should be available with your favorite method of defining keys as well. | 304 | should be available with your favorite method of defining keys as well. |
| 303 | 305 | ||
| 304 | There are other methods of telling which-key to replace command names, | 306 | There are other methods of telling which-key to replace command names, |