diff options
| author | Justin Burkett | 2024-02-08 21:36:45 -0500 |
|---|---|---|
| committer | Justin Burkett | 2024-02-08 21:36:45 -0500 |
| commit | f2eae30c62a347dade351c9d39a34258b9fd094d (patch) | |
| tree | 81de75b907647ad0d4388204f046db341f8197a0 | |
| parent | bf1cf8147b7ff5087e7a7d771784fb393878ce0c (diff) | |
| download | emacs-f2eae30c62a347dade351c9d39a34258b9fd094d.tar.gz emacs-f2eae30c62a347dade351c9d39a34258b9fd094d.zip | |
Format first sentences of docstrings.
Ensure a complete sentence (at least a phrase with a period at the end) that
fits on one line.
| -rw-r--r-- | which-key.el | 279 |
1 files changed, 136 insertions, 143 deletions
diff --git a/which-key.el b/which-key.el index 4a19d1622f6..cf0c723f4fe 100644 --- a/which-key.el +++ b/which-key.el | |||
| @@ -66,11 +66,10 @@ recommended | |||
| 66 | :type 'float) | 66 | :type 'float) |
| 67 | 67 | ||
| 68 | (defcustom which-key-idle-secondary-delay nil | 68 | (defcustom which-key-idle-secondary-delay nil |
| 69 | "Once the which-key buffer shows once for a key sequence reduce | 69 | "Seconds to wait for which-key to pop up after initial display. |
| 70 | the idle time to this amount (in seconds). This makes it possible | 70 | This makes it possible to shorten the delay for subsequent popups |
| 71 | to shorten the delay for subsequent popups in the same key | 71 | in the same key sequence. The default is for this value to be |
| 72 | sequence. The default is for this value to be nil, which disables | 72 | nil, which disables this behavior." |
| 73 | this behavior." | ||
| 74 | :group 'which-key | 73 | :group 'which-key |
| 75 | :type '(choice float (const :tag "Disabled" nil))) | 74 | :type '(choice float (const :tag "Disabled" nil))) |
| 76 | 75 | ||
| @@ -106,8 +105,7 @@ before. Truncation is done using `which-key-ellipsis'." | |||
| 106 | :type 'integer) | 105 | :type 'integer) |
| 107 | 106 | ||
| 108 | (defcustom which-key-add-column-padding 0 | 107 | (defcustom which-key-add-column-padding 0 |
| 109 | "Additional padding (number of spaces) to add to the left of | 108 | "Additional spaces to add to the left of each key column." |
| 110 | each key column." | ||
| 111 | :group 'which-key | 109 | :group 'which-key |
| 112 | :type 'integer) | 110 | :type 'integer) |
| 113 | 111 | ||
| @@ -134,9 +132,9 @@ of the which-key popup." | |||
| 134 | 132 | ||
| 135 | (defcustom which-key-separator | 133 | (defcustom which-key-separator |
| 136 | (if which-key-dont-use-unicode " : " " → ") | 134 | (if which-key-dont-use-unicode " : " " → ") |
| 137 | "Separator to use between key and description. Default is \" → | 135 | "Separator to use between key and description. |
| 138 | \", unless `which-key-dont-use-unicode' is non nil, in which case | 136 | Default is \" → \", unless `which-key-dont-use-unicode' is non |
| 139 | the default is \" : \"." | 137 | nil, in which case the default is \" : \"." |
| 140 | :group 'which-key | 138 | :group 'which-key |
| 141 | :type 'string) | 139 | :type 'string) |
| 142 | 140 | ||
| @@ -150,14 +148,15 @@ string to truncate without using any ellipsis." | |||
| 150 | :type 'string) | 148 | :type 'string) |
| 151 | 149 | ||
| 152 | (defcustom which-key-prefix-prefix "+" | 150 | (defcustom which-key-prefix-prefix "+" |
| 153 | "String to insert in front of prefix commands (i.e., commands | 151 | "Prefix string to indicate a key bound to a keymap. |
| 154 | that represent a sub-map). Default is \"+\"." | 152 | Default is \"+\"." |
| 155 | :group 'which-key | 153 | :group 'which-key |
| 156 | :type 'string) | 154 | :type 'string) |
| 157 | 155 | ||
| 158 | (defcustom which-key-compute-remaps nil | 156 | (defcustom which-key-compute-remaps nil |
| 159 | "If non-nil, show remapped command if a command has been | 157 | "If non-nil, show remapped commands. |
| 160 | remapped given the currently active keymaps." | 158 | This applies to commands that have been remapped given the |
| 159 | currently active keymaps." | ||
| 161 | :group 'which-key | 160 | :group 'which-key |
| 162 | :type 'boolean) | 161 | :type 'boolean) |
| 163 | 162 | ||
| @@ -168,9 +167,8 @@ remapped given the currently active keymaps." | |||
| 168 | '((("<left>") . ("←")) | 167 | '((("<left>") . ("←")) |
| 169 | (("<right>") . ("→")))) | 168 | (("<right>") . ("→")))) |
| 170 | (("<\\([[:alnum:]-]+\\)>") . ("\\1")))) | 169 | (("<\\([[:alnum:]-]+\\)>") . ("\\1")))) |
| 171 | "Association list to determine how to manipulate descriptions | 170 | "ALIST for manipulating display of binding descriptions. |
| 172 | of key bindings in the which-key popup. Each element of the list | 171 | Each element of the list is a nested cons cell with the format |
| 173 | is a nested cons cell with the format | ||
| 174 | 172 | ||
| 175 | \(MATCH CONS . REPLACEMENT\). | 173 | \(MATCH CONS . REPLACEMENT\). |
| 176 | 174 | ||
| @@ -207,20 +205,21 @@ non-nil value." | |||
| 207 | (choice string (const nil))))) | 205 | (choice string (const nil))))) |
| 208 | 206 | ||
| 209 | (defcustom which-key-allow-multiple-replacements nil | 207 | (defcustom which-key-allow-multiple-replacements nil |
| 210 | "Allow a key binding to match and be modified by multiple | 208 | "Allow a key binding to be modified by multiple elements. |
| 211 | elements in `which-key-replacement-alist' if non-nil. When nil, | 209 | When non-nil, this allows a single key binding to match multiple |
| 212 | only the first match is used to perform replacements from | 210 | patterns in `which-key-replacement-alist'. When nil, only the |
| 211 | first match is used to perform replacements from | ||
| 213 | `which-key-replacement-alist'." | 212 | `which-key-replacement-alist'." |
| 214 | :group 'which-key | 213 | :group 'which-key |
| 215 | :type 'boolean) | 214 | :type 'boolean) |
| 216 | 215 | ||
| 217 | (defcustom which-key-show-docstrings nil | 216 | (defcustom which-key-show-docstrings nil |
| 218 | "If non-nil, show each command's docstring next to the command | 217 | "If non-nil, show each command's docstring in the which-key popup. |
| 219 | in the which-key buffer. This will only display the docstring up | 218 | This will only display the docstring up to the first line |
| 220 | to the first line break. If you set this variable to the symbol | 219 | break. If you set this variable to the symbol docstring-only, |
| 221 | docstring-only, then the command's name with be omitted. You | 220 | then the command's name with be omitted. You probably also want |
| 222 | probably also want to adjust `which-key-max-description-length' | 221 | to adjust `which-key-max-description-length' at the same time if |
| 223 | at the same time if you use this feature." | 222 | you use this feature." |
| 224 | :group 'which-key | 223 | :group 'which-key |
| 225 | :type '(radio | 224 | :type '(radio |
| 226 | (const :tag "Do not show docstrings" nil) | 225 | (const :tag "Do not show docstrings" nil) |
| @@ -228,9 +227,9 @@ at the same time if you use this feature." | |||
| 228 | (const :tag "Replace command name with docstring" docstring-only))) | 227 | (const :tag "Replace command name with docstring" docstring-only))) |
| 229 | 228 | ||
| 230 | (defcustom which-key-highlighted-command-list '() | 229 | (defcustom which-key-highlighted-command-list '() |
| 231 | "A list of strings and/or cons cells used to highlight certain | 230 | "Rules used to highlight certain commands. |
| 232 | commands. If the element is a string, assume it is a regexp | 231 | If the element is a string, assume it is a regexp pattern for |
| 233 | pattern for matching command names and use | 232 | matching command names and use |
| 234 | `which-key-highlighted-command-face' for any matching names. If | 233 | `which-key-highlighted-command-face' for any matching names. If |
| 235 | the element is a cons cell, it should take the form (regexp . | 234 | the element is a cons cell, it should take the form (regexp . |
| 236 | face to apply)." | 235 | face to apply)." |
| @@ -238,9 +237,9 @@ face to apply)." | |||
| 238 | :type '(repeat (choice string (cons regexp face)))) | 237 | :type '(repeat (choice string (cons regexp face)))) |
| 239 | 238 | ||
| 240 | (defcustom which-key-special-keys '() | 239 | (defcustom which-key-special-keys '() |
| 241 | "These keys will automatically be truncated to one character | 240 | "These keys will automatically be truncated to one character. |
| 242 | and have `which-key-special-key-face' applied to them. This is | 241 | They also have `which-key-special-key-face' applied to them. This |
| 243 | disabled by default. Try this to see the effect. | 242 | is disabled by default. An example configuration is |
| 244 | 243 | ||
| 245 | \(setq which-key-special-keys \\='(\"SPC\" \"TAB\" \"RET\" \"ESC\" \"DEL\")\)" | 244 | \(setq which-key-special-keys \\='(\"SPC\" \"TAB\" \"RET\" \"ESC\" \"DEL\")\)" |
| 246 | :group 'which-key | 245 | :group 'which-key |
| @@ -252,7 +251,7 @@ disabled by default. Try this to see the effect. | |||
| 252 | :type 'string) | 251 | :type 'string) |
| 253 | 252 | ||
| 254 | (defcustom which-key-show-prefix 'echo | 253 | (defcustom which-key-show-prefix 'echo |
| 255 | "Whether to and where to display the current prefix sequence | 254 | "Whether to and where to display the current prefix sequence. |
| 256 | Possible choices are echo for echo area (the default), left, top | 255 | Possible choices are echo for echo area (the default), left, top |
| 257 | and nil. Nil turns the feature off." | 256 | and nil. Nil turns the feature off." |
| 258 | :group 'which-key | 257 | :group 'which-key |
| @@ -277,8 +276,8 @@ and nil. Nil turns the feature off." | |||
| 277 | :type 'integer) | 276 | :type 'integer) |
| 278 | 277 | ||
| 279 | (defcustom which-key-max-display-columns nil | 278 | (defcustom which-key-max-display-columns nil |
| 280 | "Maximum number of columns to display in the which-key buffer | 279 | "Maximum number of columns to display in the which-key buffer. |
| 281 | nil means don't impose a maximum." | 280 | A value of nil means don't impose a maximum." |
| 282 | :group 'which-key | 281 | :group 'which-key |
| 283 | :type '(choice integer (const :tag "Unbounded" nil))) | 282 | :type '(choice integer (const :tag "Unbounded" nil))) |
| 284 | 283 | ||
| @@ -297,9 +296,9 @@ location is tried." | |||
| 297 | (const (bottom right)))) | 296 | (const (bottom right)))) |
| 298 | 297 | ||
| 299 | (defcustom which-key-side-window-slot 0 | 298 | (defcustom which-key-side-window-slot 0 |
| 300 | "The `slot' to use for `display-buffer-in-side-window' when | 299 | "The `slot' to use for `display-buffer-in-side-window'. |
| 301 | `which-key-popup-type' is `side-window'. Quoting from the | 300 | This applies when `which-key-popup-type' is `side-window'. |
| 302 | docstring of `display-buffer-in-side-window', | 301 | Quoting from the docstring of `display-buffer-in-side-window', |
| 303 | 302 | ||
| 304 | `slot' if non-nil, specifies the window slot where to display | 303 | `slot' if non-nil, specifies the window slot where to display |
| 305 | BUFFER. A value of zero or nil means use the middle slot on the | 304 | BUFFER. A value of zero or nil means use the middle slot on the |
| @@ -311,14 +310,14 @@ the right of) the middle slot. The default is zero." | |||
| 311 | :type 'integer) | 310 | :type 'integer) |
| 312 | 311 | ||
| 313 | (defcustom which-key-side-window-max-width 0.333 | 312 | (defcustom which-key-side-window-max-width 0.333 |
| 314 | "Maximum width of which-key popup when type is side-window | 313 | "Maximum width of which-key popup when type is side-window. |
| 315 | This variable can also be a number between 0 and 1. In that case, | 314 | This variable can also be a number between 0 and 1. In that case, |
| 316 | it denotes a percentage out of the frame's width." | 315 | it denotes a percentage out of the frame's width." |
| 317 | :group 'which-key | 316 | :group 'which-key |
| 318 | :type 'float) | 317 | :type 'float) |
| 319 | 318 | ||
| 320 | (defcustom which-key-side-window-max-height 0.25 | 319 | (defcustom which-key-side-window-max-height 0.25 |
| 321 | "Maximum height of which-key popup when type is side-window | 320 | "Maximum height of which-key popup when type is side-window. |
| 322 | This variable can also be a number between 0 and 1. In that case, it denotes | 321 | This variable can also be a number between 0 and 1. In that case, it denotes |
| 323 | a percentage out of the frame's height." | 322 | a percentage out of the frame's height." |
| 324 | :group 'which-key | 323 | :group 'which-key |
| @@ -335,9 +334,9 @@ a percentage out of the frame's height." | |||
| 335 | :type 'integer) | 334 | :type 'integer) |
| 336 | 335 | ||
| 337 | (defcustom which-key-allow-imprecise-window-fit (not (display-graphic-p)) | 336 | (defcustom which-key-allow-imprecise-window-fit (not (display-graphic-p)) |
| 338 | "If non-nil allow which-key to use a less intensive method of | 337 | "Allow which-key to use a simpler method for resizing the popup. |
| 339 | fitting the popup window to the buffer. If you are noticing lag | 338 | If you are noticing lag when the which-key popup displays turning |
| 340 | when the which-key popup displays turning this on may help. | 339 | this on may help. |
| 341 | 340 | ||
| 342 | See https://github.com/justbur/emacs-which-key/issues/130 | 341 | See https://github.com/justbur/emacs-which-key/issues/130 |
| 343 | and https://github.com/justbur/emacs-which-key/issues/225." | 342 | and https://github.com/justbur/emacs-which-key/issues/225." |
| @@ -351,8 +350,9 @@ and https://github.com/justbur/emacs-which-key/issues/225." | |||
| 351 | (const :tag "No" nil))) | 350 | (const :tag "No" nil))) |
| 352 | 351 | ||
| 353 | (defcustom which-key-sort-order 'which-key-key-order | 352 | (defcustom which-key-sort-order 'which-key-key-order |
| 354 | "If nil, do not resort the output from | 353 | "Order in which the key bindings are sorted. |
| 355 | `describe-buffer-bindings' which groups by mode. Ordering options | 354 | If nil, do not resort the output from `describe-buffer-bindings' |
| 355 | which groups by mode. Ordering options | ||
| 356 | are | 356 | are |
| 357 | 357 | ||
| 358 | 1. `which-key-key-order': by key (default) | 358 | 1. `which-key-key-order': by key (default) |
| @@ -371,9 +371,9 @@ information." | |||
| 371 | (function-item which-key-local-then-key-order))) | 371 | (function-item which-key-local-then-key-order))) |
| 372 | 372 | ||
| 373 | (defcustom which-key-sort-uppercase-first t | 373 | (defcustom which-key-sort-uppercase-first t |
| 374 | "If non-nil, uppercase comes before lowercase in sorting | 374 | "If non-nil, uppercase comes before lowercase in sorting. |
| 375 | function chosen in `which-key-sort-order'. Otherwise, the order | 375 | This applies to the function chosen in |
| 376 | is reversed." | 376 | `which-key-sort-order'. Otherwise, the order is reversed." |
| 377 | :group 'which-key | 377 | :group 'which-key |
| 378 | :type 'boolean) | 378 | :type 'boolean) |
| 379 | 379 | ||
| @@ -383,8 +383,8 @@ is reversed." | |||
| 383 | :type '(repeat string)) | 383 | :type '(repeat string)) |
| 384 | 384 | ||
| 385 | (defcustom which-key-paging-key "<f5>" | 385 | (defcustom which-key-paging-key "<f5>" |
| 386 | "Key to use for changing pages. Bound after each of the | 386 | "Key to use for changing pages. |
| 387 | prefixes in `which-key-paging-prefixes'" | 387 | Bound after each of the prefixes in `which-key-paging-prefixes'" |
| 388 | :group 'which-key | 388 | :group 'which-key |
| 389 | :type 'string) | 389 | :type 'string) |
| 390 | 390 | ||
| @@ -400,18 +400,18 @@ prefixes in `which-key-paging-prefixes'" | |||
| 400 | ;; :type '(repeat symbol)) | 400 | ;; :type '(repeat symbol)) |
| 401 | 401 | ||
| 402 | (defcustom which-key-use-C-h-commands t | 402 | (defcustom which-key-use-C-h-commands t |
| 403 | "Use C-h (or whatever `help-char' is set to) for paging if | 403 | "Use C-h (`help-char') for paging if non-nil. |
| 404 | non-nil. Normally C-h after a prefix calls | 404 | Normally `help-char' after a prefix calls |
| 405 | `describe-prefix-bindings'. This changes that command to a | 405 | `describe-prefix-bindings'. This changes that command to a |
| 406 | which-key paging command when which-key-mode is active." | 406 | which-key paging command when which-key-mode is active." |
| 407 | :group 'which-key | 407 | :group 'which-key |
| 408 | :type 'boolean) | 408 | :type 'boolean) |
| 409 | 409 | ||
| 410 | (defcustom which-key-show-early-on-C-h nil | 410 | (defcustom which-key-show-early-on-C-h nil |
| 411 | "Show the which-key buffer before if C-h (or whatever | 411 | "Allow C-h (`help-char') to trigger which-key popup before timer. |
| 412 | `help-char' is set to) is pressed in the middle of a prefix | 412 | Show the which-key buffer if `help-char' is pressed in the middle |
| 413 | before the which-key buffer would normally be triggered through | 413 | of a prefix before the which-key buffer would normally be |
| 414 | the idle delay. If combined with the following settings, | 414 | triggered by the time. If combined with the following settings, |
| 415 | which-key will effectively only show when triggered \"manually\" | 415 | which-key will effectively only show when triggered \"manually\" |
| 416 | using C-h. | 416 | using C-h. |
| 417 | 417 | ||
| @@ -429,10 +429,12 @@ Note that `which-key-idle-delay' should be set before turning on | |||
| 429 | :type 'boolean) | 429 | :type 'boolean) |
| 430 | 430 | ||
| 431 | (defcustom which-key-preserve-window-configuration nil | 431 | (defcustom which-key-preserve-window-configuration nil |
| 432 | "If non-nil, save window configuration before which-key buffer is shown | 432 | "Save and restore window configuration around which-key popup display. |
| 433 | and restore it after which-key buffer is hidden. It prevents which-key from | 433 | If non-nil, save window configuration before which-key buffer is |
| 434 | changing window position of visible buffers. | 434 | shown and restore it after which-key buffer is hidden. It |
| 435 | Only takken into account when popup type is side-window." | 435 | prevents which-key from changing window position of visible |
| 436 | buffers. Only takken into account when popup type is | ||
| 437 | side-window." | ||
| 436 | :group | 438 | :group |
| 437 | 'which-key | 439 | 'which-key |
| 438 | :type 'boolean) | 440 | :type 'boolean) |
| @@ -453,8 +455,8 @@ Only takken into account when popup type is side-window." | |||
| 453 | which-key-separator "abort" | 455 | which-key-separator "abort" |
| 454 | " 1..9" | 456 | " 1..9" |
| 455 | which-key-separator "digit-arg") | 457 | which-key-separator "digit-arg") |
| 456 | "Prompt to display when invoking `which-key-C-h-map'. This string | 458 | "Prompt to display when invoking `which-key-C-h-map'. |
| 457 | is fed into `substitute-command-keys'") | 459 | This string is fed into `substitute-command-keys'") |
| 458 | 460 | ||
| 459 | (defvar which-key-C-h-map | 461 | (defvar which-key-C-h-map |
| 460 | (let ((map (make-sparse-keymap))) | 462 | (let ((map (make-sparse-keymap))) |
| @@ -506,7 +508,8 @@ See http://www.gnu.org/software/emacs/manual/html_node/emacs/Modifier-Keys.html" | |||
| 506 | :type 'boolean) | 508 | :type 'boolean) |
| 507 | 509 | ||
| 508 | (defcustom which-key-delay-functions nil | 510 | (defcustom which-key-delay-functions nil |
| 509 | "A list of functions that may decide whether to delay the | 511 | "List of functions that may delay the which-key popup. |
| 512 | A list of functions that may decide whether to delay the | ||
| 510 | which-key popup based on the current incomplete key | 513 | which-key popup based on the current incomplete key |
| 511 | sequence. Each function in the list is run with two arguments, | 514 | sequence. Each function in the list is run with two arguments, |
| 512 | the current key sequence as produced by `key-description' and the | 515 | the current key sequence as produced by `key-description' and the |
| @@ -529,11 +532,10 @@ key sequences is what is produced by `key-description'." | |||
| 529 | :type '(repeat regexp)) | 532 | :type '(repeat regexp)) |
| 530 | 533 | ||
| 531 | (defcustom which-key-inhibit-regexps nil | 534 | (defcustom which-key-inhibit-regexps nil |
| 532 | "Similar to `which-key-allow-regexps', a list of regexp strings | 535 | "A list of regexp strings to use to filter key sequences. |
| 533 | to use to filter key sequences. When non-nil, for a key sequence | 536 | When non-nil, for a key sequence to trigger the which-key popup |
| 534 | to trigger the which-key popup it cannot match one of the regexps | 537 | it cannot match one of the regexps in this list. The format of |
| 535 | in this list. The format of the key sequences is what is produced | 538 | the key sequences is what is produced by `key-description'." |
| 536 | by `key-description'." | ||
| 537 | :group 'which-key | 539 | :group 'which-key |
| 538 | :type '(repeat regexp)) | 540 | :type '(repeat regexp)) |
| 539 | 541 | ||
| @@ -613,7 +615,7 @@ and it matches a string in `which-key-highlighted-command-list'." | |||
| 613 | ;;;; Custom popup | 615 | ;;;; Custom popup |
| 614 | 616 | ||
| 615 | (defcustom which-key-custom-popup-max-dimensions-function nil | 617 | (defcustom which-key-custom-popup-max-dimensions-function nil |
| 616 | "Variable to hold a custom max-dimensions function. | 618 | "Set a custom max-dimensions function. |
| 617 | Will be passed the width of the active window and is expected to | 619 | Will be passed the width of the active window and is expected to |
| 618 | return the maximum height in lines and width in characters of the | 620 | return the maximum height in lines and width in characters of the |
| 619 | which-key popup in the form a cons cell (height . width)." | 621 | which-key popup in the form a cons cell (height . width)." |
| @@ -621,13 +623,13 @@ which-key popup in the form a cons cell (height . width)." | |||
| 621 | :type '(choice function (const nil))) | 623 | :type '(choice function (const nil))) |
| 622 | 624 | ||
| 623 | (defcustom which-key-custom-hide-popup-function nil | 625 | (defcustom which-key-custom-hide-popup-function nil |
| 624 | "Variable to hold a custom hide-popup function. | 626 | "Set a custom hide-popup function. |
| 625 | It takes no arguments and the return value is ignored." | 627 | It takes no arguments and the return value is ignored." |
| 626 | :group 'which-key | 628 | :group 'which-key |
| 627 | :type '(choice function (const nil))) | 629 | :type '(choice function (const nil))) |
| 628 | 630 | ||
| 629 | (defcustom which-key-custom-show-popup-function nil | 631 | (defcustom which-key-custom-show-popup-function nil |
| 630 | "Variable to hold a custom show-popup function. | 632 | "Set a custom show-popup function. |
| 631 | Will be passed the required dimensions in the form (height . | 633 | Will be passed the required dimensions in the form (height . |
| 632 | width) in lines and characters respectively. The return value is | 634 | width) in lines and characters respectively. The return value is |
| 633 | ignored." | 635 | ignored." |
| @@ -640,15 +642,16 @@ ignored." | |||
| 640 | :type 'string) | 642 | :type 'string) |
| 641 | 643 | ||
| 642 | (defvar which-key-inhibit nil | 644 | (defvar which-key-inhibit nil |
| 643 | "Prevent which-key from popping up momentarily by setting this | 645 | "Prevent which-key from popping up momentarily. |
| 644 | to a non-nil value for the execution of a command. Like this | 646 | This can be used by setting this to a non-nil value for the |
| 647 | execution of a command, as in | ||
| 645 | 648 | ||
| 646 | \(let \(\(which-key-inhibit t\)\) | 649 | \(let \(\(which-key-inhibit t\)\) |
| 647 | ...\)") | 650 | ...\)") |
| 648 | 651 | ||
| 649 | (defvar which-key-keymap-history nil | 652 | (defvar which-key-keymap-history nil |
| 650 | "History of keymap selections in functions like | 653 | "History of keymap selections. |
| 651 | `which-key-show-keymap'.") | 654 | Used in functions like `which-key-show-keymap'.") |
| 652 | 655 | ||
| 653 | ;;; Internal Vars | 656 | ;;; Internal Vars |
| 654 | 657 | ||
| @@ -775,22 +778,21 @@ operators." | |||
| 775 | :type 'boolean) | 778 | :type 'boolean) |
| 776 | 779 | ||
| 777 | (defcustom which-key-show-operator-state-maps nil | 780 | (defcustom which-key-show-operator-state-maps nil |
| 778 | "Experimental: Try to show the right keys following an evil | 781 | "Show the keys following an evil command that reads a motion. |
| 779 | command that reads a motion, such as \"y\", \"d\" and \"c\" from | 782 | These are commands typically mapped to keys such as \"y\", \"d\" |
| 780 | normal state. This is experimental, because there might be some | 783 | and \"c\" from normal state. This is experimental, because there |
| 781 | valid keys missing and it might be showing some invalid keys." | 784 | might be some valid keys missing and it might be showing some |
| 785 | invalid keys." | ||
| 782 | :group 'which-key | 786 | :group 'which-key |
| 783 | :type 'boolean) | 787 | :type 'boolean) |
| 784 | 788 | ||
| 785 | ;;;; God-mode | 789 | ;;;; God-mode |
| 786 | 790 | ||
| 787 | (defvar which-key--god-mode-support-enabled nil | 791 | (defvar which-key--god-mode-support-enabled nil |
| 788 | "Support god-mode if non-nil. This is experimental, | 792 | "Support god-mode if non-nil.") |
| 789 | so you need to explicitly opt-in for now. Please report any | ||
| 790 | problems at github.") | ||
| 791 | 793 | ||
| 792 | (defvar which-key--god-mode-key-string nil | 794 | (defvar which-key--god-mode-key-string nil |
| 793 | "Holds key string to use for god-mode support.") | 795 | "String to use for god-mode support.") |
| 794 | 796 | ||
| 795 | (defun which-key--god-mode-lookup-command-advice (orig-fun arg1 &rest args) | 797 | (defun which-key--god-mode-lookup-command-advice (orig-fun arg1 &rest args) |
| 796 | (setq which-key--god-mode-key-string arg1) | 798 | (setq which-key--god-mode-key-string arg1) |
| @@ -873,8 +875,8 @@ disable support." | |||
| 873 | (run-hooks 'which-key-init-buffer-hook)))) | 875 | (run-hooks 'which-key-init-buffer-hook)))) |
| 874 | 876 | ||
| 875 | (defun which-key--setup-echo-keystrokes () | 877 | (defun which-key--setup-echo-keystrokes () |
| 876 | "Reduce `echo-keystrokes' if necessary (it will interfere if | 878 | "Reduce `echo-keystrokes' if necessary. |
| 877 | it's set too high)." | 879 | It will interfere if set too high." |
| 878 | (when (and echo-keystrokes | 880 | (when (and echo-keystrokes |
| 879 | (> (abs (- echo-keystrokes which-key-echo-keystrokes)) 0.000001)) | 881 | (> (abs (- echo-keystrokes which-key-echo-keystrokes)) 0.000001)) |
| 880 | (if (> which-key-idle-delay which-key-echo-keystrokes) | 882 | (if (> which-key-idle-delay which-key-echo-keystrokes) |
| @@ -883,7 +885,8 @@ it's set too high)." | |||
| 883 | echo-keystrokes which-key-echo-keystrokes)))) | 885 | echo-keystrokes which-key-echo-keystrokes)))) |
| 884 | 886 | ||
| 885 | (defun which-key-remove-default-unicode-chars () | 887 | (defun which-key-remove-default-unicode-chars () |
| 886 | "Use of `which-key-dont-use-unicode' is preferred to this | 888 | "Remove default unicode chars from settings. |
| 889 | Use of `which-key-dont-use-unicode' is preferred to this | ||
| 887 | function, but it's included here in case someone cannot set that | 890 | function, but it's included here in case someone cannot set that |
| 888 | variable early enough in their configuration, if they are using a | 891 | variable early enough in their configuration, if they are using a |
| 889 | starter kit for example." | 892 | starter kit for example." |
| @@ -894,7 +897,7 @@ starter kit for example." | |||
| 894 | 897 | ||
| 895 | ;;;###autoload | 898 | ;;;###autoload |
| 896 | (defun which-key-setup-side-window-right () | 899 | (defun which-key-setup-side-window-right () |
| 897 | "Apply suggested settings for side-window that opens on right." | 900 | "Set up side-window on right." |
| 898 | (interactive) | 901 | (interactive) |
| 899 | (setq which-key-popup-type 'side-window | 902 | (setq which-key-popup-type 'side-window |
| 900 | which-key-side-window-location 'right | 903 | which-key-side-window-location 'right |
| @@ -902,8 +905,8 @@ starter kit for example." | |||
| 902 | 905 | ||
| 903 | ;;;###autoload | 906 | ;;;###autoload |
| 904 | (defun which-key-setup-side-window-right-bottom () | 907 | (defun which-key-setup-side-window-right-bottom () |
| 905 | "Apply suggested settings for side-window that opens on right | 908 | "Set up side-window on right if space allows. |
| 906 | if there is space and the bottom otherwise." | 909 | Otherwise, use bottom." |
| 907 | (interactive) | 910 | (interactive) |
| 908 | (setq which-key-popup-type 'side-window | 911 | (setq which-key-popup-type 'side-window |
| 909 | which-key-side-window-location '(right bottom) | 912 | which-key-side-window-location '(right bottom) |
| @@ -911,7 +914,7 @@ if there is space and the bottom otherwise." | |||
| 911 | 914 | ||
| 912 | ;;;###autoload | 915 | ;;;###autoload |
| 913 | (defun which-key-setup-side-window-bottom () | 916 | (defun which-key-setup-side-window-bottom () |
| 914 | "Apply suggested settings for side-window that opens on bottom." | 917 | "Set up side-window that opens on bottom." |
| 915 | (interactive) | 918 | (interactive) |
| 916 | (which-key--setup-echo-keystrokes) | 919 | (which-key--setup-echo-keystrokes) |
| 917 | (setq which-key-popup-type 'side-window | 920 | (setq which-key-popup-type 'side-window |
| @@ -920,7 +923,7 @@ if there is space and the bottom otherwise." | |||
| 920 | 923 | ||
| 921 | ;;;###autoload | 924 | ;;;###autoload |
| 922 | (defun which-key-setup-minibuffer () | 925 | (defun which-key-setup-minibuffer () |
| 923 | "Apply suggested settings for minibuffer. | 926 | "Set up minibuffer display. |
| 924 | Do not use this setup if you use the paging commands. Instead use | 927 | Do not use this setup if you use the paging commands. Instead use |
| 925 | `which-key-setup-side-window-bottom', which is nearly identical | 928 | `which-key-setup-side-window-bottom', which is nearly identical |
| 926 | but more functional." | 929 | but more functional." |
| @@ -1049,7 +1052,7 @@ If AT-ROOT is non-nil the binding is also placed at the root of MAP." | |||
| 1049 | ;;; Functions for computing window sizes | 1052 | ;;; Functions for computing window sizes |
| 1050 | 1053 | ||
| 1051 | (defun which-key--text-width-to-total (text-width) | 1054 | (defun which-key--text-width-to-total (text-width) |
| 1052 | "Convert window text-width to window total-width. | 1055 | "Convert window TEXT-WIDTH to window total-width. |
| 1053 | TEXT-WIDTH is the desired text width of the window. The function | 1056 | TEXT-WIDTH is the desired text width of the window. The function |
| 1054 | calculates what total width is required for a window in the | 1057 | calculates what total width is required for a window in the |
| 1055 | selected to have a text-width of TEXT-WIDTH columns. The | 1058 | selected to have a text-width of TEXT-WIDTH columns. The |
| @@ -1065,7 +1068,7 @@ width as the frame." | |||
| 1065 | 3))) | 1068 | 3))) |
| 1066 | 1069 | ||
| 1067 | (defun which-key--total-width-to-text (total-width) | 1070 | (defun which-key--total-width-to-text (total-width) |
| 1068 | "Convert window total-width to window text-width. | 1071 | "Convert window TOTAL-WIDTH to window text-width. |
| 1069 | TOTAL-WIDTH is the desired total width of the window. The function calculates | 1072 | TOTAL-WIDTH is the desired total width of the window. The function calculates |
| 1070 | what text width fits such a window. The calculation considers possible fringes | 1073 | what text width fits such a window. The calculation considers possible fringes |
| 1071 | and scroll bars. This function assumes that the desired window has the same | 1074 | and scroll bars. This function assumes that the desired window has the same |
| @@ -1135,8 +1138,7 @@ total height." | |||
| 1135 | (which-key--hide-popup-ignore-command))) | 1138 | (which-key--hide-popup-ignore-command))) |
| 1136 | 1139 | ||
| 1137 | (defun which-key--hide-popup-ignore-command () | 1140 | (defun which-key--hide-popup-ignore-command () |
| 1138 | "Version of `which-key--hide-popup' without the check of | 1141 | "`which-key--hide-popup' without the check of `real-this-command'." |
| 1139 | `real-this-command'." | ||
| 1140 | (cl-case which-key-popup-type | 1142 | (cl-case which-key-popup-type |
| 1141 | ;; Not necessary to hide minibuffer | 1143 | ;; Not necessary to hide minibuffer |
| 1142 | ;; (minibuffer (which-key--hide-buffer-minibuffer)) | 1144 | ;; (minibuffer (which-key--hide-buffer-minibuffer)) |
| @@ -1288,7 +1290,8 @@ call signature in different emacs versions" | |||
| 1288 | ;;; Max dimension of available window functions | 1290 | ;;; Max dimension of available window functions |
| 1289 | 1291 | ||
| 1290 | (defun which-key--popup-max-dimensions () | 1292 | (defun which-key--popup-max-dimensions () |
| 1291 | "Dimesion functions should return the maximum possible (height | 1293 | "Return maximum dimension available for popup. |
| 1294 | Dimesion functions should return the maximum possible (height | ||
| 1292 | . width) of the intended popup. SELECTED-WINDOW-WIDTH is the | 1295 | . width) of the intended popup. SELECTED-WINDOW-WIDTH is the |
| 1293 | width of currently active window, not the which-key buffer | 1296 | width of currently active window, not the which-key buffer |
| 1294 | window." | 1297 | window." |
| @@ -1312,8 +1315,9 @@ Measured in lines and characters respectively." | |||
| 1312 | (max 0 (- (frame-text-cols) which-key-unicode-correction)))) | 1315 | (max 0 (- (frame-text-cols) which-key-unicode-correction)))) |
| 1313 | 1316 | ||
| 1314 | (defun which-key--side-window-max-dimensions () | 1317 | (defun which-key--side-window-max-dimensions () |
| 1315 | "Return max-dimensions of the side-window popup (height . | 1318 | "Return max-dimensions of the side-window popup. |
| 1316 | width) in lines and characters respectively." | 1319 | The return value should be (height . width) in lines and |
| 1320 | characters respectively." | ||
| 1317 | (cons | 1321 | (cons |
| 1318 | ;; height | 1322 | ;; height |
| 1319 | (if (member which-key-side-window-location '(left right)) | 1323 | (if (member which-key-side-window-location '(left right)) |
| @@ -1336,8 +1340,9 @@ width) in lines and characters respectively." | |||
| 1336 | which-key-unicode-correction)))) | 1340 | which-key-unicode-correction)))) |
| 1337 | 1341 | ||
| 1338 | (defun which-key--frame-max-dimensions () | 1342 | (defun which-key--frame-max-dimensions () |
| 1339 | "Return max-dimensions of the frame popup (height . | 1343 | "Return max-dimensions of the frame popup. |
| 1340 | width) in lines and characters respectively." | 1344 | The return value should be (height . width) in lines and |
| 1345 | characters respectively." | ||
| 1341 | (cons which-key-frame-max-height which-key-frame-max-width)) | 1346 | (cons which-key-frame-max-height which-key-frame-max-width)) |
| 1342 | 1347 | ||
| 1343 | ;;; Sorting functions | 1348 | ;;; Sorting functions |
| @@ -1363,8 +1368,8 @@ width) in lines and characters respectively." | |||
| 1363 | (t (string-lessp a b))))) | 1368 | (t (string-lessp a b))))) |
| 1364 | 1369 | ||
| 1365 | (defun which-key--key-description< (a b &optional alpha) | 1370 | (defun which-key--key-description< (a b &optional alpha) |
| 1366 | "Sorting function used for `which-key-key-order' and | 1371 | "Key sorting function. |
| 1367 | `which-key-key-order-alpha'." | 1372 | Used for `which-key-key-order' and `which-key-key-order-alpha'." |
| 1368 | (save-match-data | 1373 | (save-match-data |
| 1369 | (let* ((a (which-key--extract-key a)) | 1374 | (let* ((a (which-key--extract-key a)) |
| 1370 | (b (which-key--extract-key b)) | 1375 | (b (which-key--extract-key b)) |
| @@ -1435,9 +1440,8 @@ Uses `string-lessp' after applying lowercase." | |||
| 1435 | (keymapp (intern description)))) | 1440 | (keymapp (intern description)))) |
| 1436 | 1441 | ||
| 1437 | (defun which-key-prefix-then-key-order (acons bcons) | 1442 | (defun which-key-prefix-then-key-order (acons bcons) |
| 1438 | "Order first by whether A and/or B is a prefix with no prefix | 1443 | "Order prefixes before non-prefixes. |
| 1439 | coming before a prefix. Within these categories order using | 1444 | Within these categories order using `which-key-key-order'." |
| 1440 | `which-key-key-order'." | ||
| 1441 | (let ((apref? (which-key--group-p (cdr acons))) | 1445 | (let ((apref? (which-key--group-p (cdr acons))) |
| 1442 | (bpref? (which-key--group-p (cdr bcons)))) | 1446 | (bpref? (which-key--group-p (cdr bcons)))) |
| 1443 | (if (not (eq apref? bpref?)) | 1447 | (if (not (eq apref? bpref?)) |
| @@ -1445,9 +1449,8 @@ coming before a prefix. Within these categories order using | |||
| 1445 | (which-key-key-order acons bcons)))) | 1449 | (which-key-key-order acons bcons)))) |
| 1446 | 1450 | ||
| 1447 | (defun which-key-prefix-then-key-order-reverse (acons bcons) | 1451 | (defun which-key-prefix-then-key-order-reverse (acons bcons) |
| 1448 | "Order first by whether A and/or B is a prefix with prefix | 1452 | "Order prefixes before non-prefixes. |
| 1449 | coming before a prefix. Within these categories order using | 1453 | Within these categories order using `which-key-key-order'." |
| 1450 | `which-key-key-order'." | ||
| 1451 | (let ((apref? (which-key--group-p (cdr acons))) | 1454 | (let ((apref? (which-key--group-p (cdr acons))) |
| 1452 | (bpref? (which-key--group-p (cdr bcons)))) | 1455 | (bpref? (which-key--group-p (cdr bcons)))) |
| 1453 | (if (not (eq apref? bpref?)) | 1456 | (if (not (eq apref? bpref?)) |
| @@ -1455,9 +1458,8 @@ coming before a prefix. Within these categories order using | |||
| 1455 | (which-key-key-order acons bcons)))) | 1458 | (which-key-key-order acons bcons)))) |
| 1456 | 1459 | ||
| 1457 | (defun which-key-local-then-key-order (acons bcons) | 1460 | (defun which-key-local-then-key-order (acons bcons) |
| 1458 | "Order first by whether A and/or B is a local binding with | 1461 | "Order local bindings before non-local ones. |
| 1459 | local bindings coming first. Within these categories order using | 1462 | Within these categories order using `which-key-key-order'." |
| 1460 | `which-key-key-order'." | ||
| 1461 | (let ((aloc? (which-key--local-binding-p acons)) | 1463 | (let ((aloc? (which-key--local-binding-p acons)) |
| 1462 | (bloc? (which-key--local-binding-p bcons))) | 1464 | (bloc? (which-key--local-binding-p bcons))) |
| 1463 | (if (not (eq aloc? bloc?)) | 1465 | (if (not (eq aloc? bloc?)) |
| @@ -1662,10 +1664,10 @@ cell" el))))) | |||
| 1662 | 1664 | ||
| 1663 | (defun which-key--propertize-description | 1665 | (defun which-key--propertize-description |
| 1664 | (description group local hl-face &optional original-description) | 1666 | (description group local hl-face &optional original-description) |
| 1665 | "Add face to DESCRIPTION where the face chosen depends on | 1667 | "Add face to DESCRIPTION. |
| 1666 | whether the description represents a group or a command. Also | 1668 | The face chosen depends on whether the description represents a |
| 1667 | make some minor adjustments to the description string, like | 1669 | group or a command. Also make some minor adjustments to the |
| 1668 | removing a \"group:\" prefix. | 1670 | description string, like removing a \"group:\" prefix. |
| 1669 | 1671 | ||
| 1670 | ORIGINAL-DESCRIPTION is the description given by | 1672 | ORIGINAL-DESCRIPTION is the description given by |
| 1671 | `describe-buffer-bindings'." | 1673 | `describe-buffer-bindings'." |
| @@ -1736,7 +1738,8 @@ return the docstring." | |||
| 1736 | (format "%s %s" current docstring))))) | 1738 | (format "%s %s" current docstring))))) |
| 1737 | 1739 | ||
| 1738 | (defun which-key--format-and-replace (unformatted &optional preserve-full-key) | 1740 | (defun which-key--format-and-replace (unformatted &optional preserve-full-key) |
| 1739 | "Take a list of (key . desc) cons cells in UNFORMATTED, add | 1741 | "Make list of key bindings with separators and descriptions. |
| 1742 | Take a list of (key . desc) cons cells in UNFORMATTED, add | ||
| 1740 | faces and perform replacements according to the three replacement | 1743 | faces and perform replacements according to the three replacement |
| 1741 | alists. Returns a list (key separator description)." | 1744 | alists. Returns a list (key separator description)." |
| 1742 | (let ((sep-w-face | 1745 | (let ((sep-w-face |
| @@ -1774,8 +1777,7 @@ alists. Returns a list (key separator description)." | |||
| 1774 | 1777 | ||
| 1775 | (defun which-key--compute-binding (binding) | 1778 | (defun which-key--compute-binding (binding) |
| 1776 | "Replace BINDING with remapped binding if it exists. | 1779 | "Replace BINDING with remapped binding if it exists. |
| 1777 | 1780 | Requires `which-key-compute-remaps' to be non-nil." | |
| 1778 | Requires `which-key-compute-remaps' to be non-nil" | ||
| 1779 | (let (remap) | 1781 | (let (remap) |
| 1780 | (if (and which-key-compute-remaps | 1782 | (if (and which-key-compute-remaps |
| 1781 | (setq remap (command-remapping binding))) | 1783 | (setq remap (command-remapping binding))) |
| @@ -1909,14 +1911,14 @@ non-nil, then bindings are collected recursively for all prefixes." | |||
| 1909 | (mapconcat (lambda (row) (mapconcat #'identity row " ")) rows "\n"))) | 1911 | (mapconcat (lambda (row) (mapconcat #'identity row " ")) rows "\n"))) |
| 1910 | 1912 | ||
| 1911 | (defsubst which-key--max-len (keys index &optional initial-value) | 1913 | (defsubst which-key--max-len (keys index &optional initial-value) |
| 1912 | "Internal function for finding the max length of the INDEX | 1914 | "Find the max length of the INDEX element in each of KEYS." |
| 1913 | element in each list element of KEYS." | ||
| 1914 | (cl-reduce | 1915 | (cl-reduce |
| 1915 | (lambda (x y) (max x (which-key--string-width (nth index y)))) | 1916 | (lambda (x y) (max x (which-key--string-width (nth index y)))) |
| 1916 | keys :initial-value (if initial-value initial-value 0))) | 1917 | keys :initial-value (if initial-value initial-value 0))) |
| 1917 | 1918 | ||
| 1918 | (defun which-key--pad-column (col-keys avl-width) | 1919 | (defun which-key--pad-column (col-keys avl-width) |
| 1919 | "Take a column of (key separator description) COL-KEYS, | 1920 | "Pad cells of COL-KEYS to AVL-WIDTH. |
| 1921 | Take a column of (key separator description) COL-KEYS, | ||
| 1920 | calculate the max width in the column and pad all cells out to | 1922 | calculate the max width in the column and pad all cells out to |
| 1921 | that width." | 1923 | that width." |
| 1922 | (let* ((col-key-width (+ which-key-add-column-padding | 1924 | (let* ((col-key-width (+ which-key-add-column-padding |
| @@ -2111,8 +2113,8 @@ max-lines max-width avl-lines avl-width (which-key--pages-height result)) | |||
| 2111 | (_ (format " %s" prefix-arg)))))))) | 2113 | (_ (format " %s" prefix-arg)))))))) |
| 2112 | 2114 | ||
| 2113 | (defun which-key--full-prefix (prefix-keys &optional -prefix-arg dont-prop-keys) | 2115 | (defun which-key--full-prefix (prefix-keys &optional -prefix-arg dont-prop-keys) |
| 2114 | "Return a description of the full key sequence up to now, | 2116 | "Return a description of the full key sequence up to now. |
| 2115 | including prefix arguments." | 2117 | Include prefix arguments." |
| 2116 | (let* ((left (eq which-key-show-prefix 'left)) | 2118 | (let* ((left (eq which-key-show-prefix 'left)) |
| 2117 | (prefix-arg (if -prefix-arg -prefix-arg prefix-arg)) | 2119 | (prefix-arg (if -prefix-arg -prefix-arg prefix-arg)) |
| 2118 | (str (concat | 2120 | (str (concat |
| @@ -2137,9 +2139,9 @@ including prefix arguments." | |||
| 2137 | map))) | 2139 | map))) |
| 2138 | 2140 | ||
| 2139 | (defun which-key--process-page (pages-obj) | 2141 | (defun which-key--process-page (pages-obj) |
| 2140 | "Add information to the basic list of key bindings, including | 2142 | "Add information to the basic list of key bindings. |
| 2141 | if applicable the current prefix, the name of the current prefix, | 2143 | Include, if applicable, the current prefix, the name of the current |
| 2142 | and a page count." | 2144 | prefix, and a page count." |
| 2143 | (let* ((page (car (which-key--pages-pages pages-obj))) | 2145 | (let* ((page (car (which-key--pages-pages pages-obj))) |
| 2144 | (height (which-key--pages-height pages-obj)) | 2146 | (height (which-key--pages-height pages-obj)) |
| 2145 | (n-pages (which-key--pages-num-pages pages-obj)) | 2147 | (n-pages (which-key--pages-num-pages pages-obj)) |
| @@ -2285,8 +2287,7 @@ Usually this is `describe-prefix-bindings'." | |||
| 2285 | 2287 | ||
| 2286 | ;;;###autoload | 2288 | ;;;###autoload |
| 2287 | (defun which-key-show-next-page-no-cycle () | 2289 | (defun which-key-show-next-page-no-cycle () |
| 2288 | "Show next page of keys unless on the last page, in which case | 2290 | "Show next page of keys or `which-key-show-standard-help'." |
| 2289 | call `which-key-show-standard-help'." | ||
| 2290 | (interactive) | 2291 | (interactive) |
| 2291 | (let ((which-key-inhibit t)) | 2292 | (let ((which-key-inhibit t)) |
| 2292 | (if (which-key--on-last-page) | 2293 | (if (which-key--on-last-page) |
| @@ -2295,8 +2296,7 @@ call `which-key-show-standard-help'." | |||
| 2295 | 2296 | ||
| 2296 | ;;;###autoload | 2297 | ;;;###autoload |
| 2297 | (defun which-key-show-previous-page-no-cycle () | 2298 | (defun which-key-show-previous-page-no-cycle () |
| 2298 | "Show previous page of keys unless on the first page, in which | 2299 | "Show previous page of keys if one exists." |
| 2299 | case do nothing." | ||
| 2300 | (interactive) | 2300 | (interactive) |
| 2301 | (let ((which-key-inhibit t)) | 2301 | (let ((which-key-inhibit t)) |
| 2302 | (unless (which-key--on-first-page) | 2302 | (unless (which-key--on-first-page) |
| @@ -2304,16 +2304,14 @@ case do nothing." | |||
| 2304 | 2304 | ||
| 2305 | ;;;###autoload | 2305 | ;;;###autoload |
| 2306 | (defun which-key-show-next-page-cycle (&optional _) | 2306 | (defun which-key-show-next-page-cycle (&optional _) |
| 2307 | "Show the next page of keys, cycling from end to beginning | 2307 | "Show the next page of keys, cycling from end to beginning." |
| 2308 | after last page." | ||
| 2309 | (interactive) | 2308 | (interactive) |
| 2310 | (let ((which-key-inhibit t)) | 2309 | (let ((which-key-inhibit t)) |
| 2311 | (which-key-turn-page 1))) | 2310 | (which-key-turn-page 1))) |
| 2312 | 2311 | ||
| 2313 | ;;;###autoload | 2312 | ;;;###autoload |
| 2314 | (defun which-key-show-previous-page-cycle (&optional _) | 2313 | (defun which-key-show-previous-page-cycle (&optional _) |
| 2315 | "Show the previous page of keys, cycling from beginning to end | 2314 | "Show the previous page of keys, cycling from beginning to end." |
| 2316 | after first page." | ||
| 2317 | (interactive) | 2315 | (interactive) |
| 2318 | (let ((which-key-inhibit t)) | 2316 | (let ((which-key-inhibit t)) |
| 2319 | (which-key-turn-page -1))) | 2317 | (which-key-turn-page -1))) |
| @@ -2327,7 +2325,6 @@ after first page." | |||
| 2327 | ;;;###autoload | 2325 | ;;;###autoload |
| 2328 | (defun which-key-show-major-mode (&optional all) | 2326 | (defun which-key-show-major-mode (&optional all) |
| 2329 | "Show top-level bindings in the map of the current major mode. | 2327 | "Show top-level bindings in the map of the current major mode. |
| 2330 | |||
| 2331 | This function will also detect evil bindings made using | 2328 | This function will also detect evil bindings made using |
| 2332 | `evil-define-key' in this map. These bindings will depend on the | 2329 | `evil-define-key' in this map. These bindings will depend on the |
| 2333 | current evil state. " | 2330 | current evil state. " |
| @@ -2344,7 +2341,6 @@ current evil state. " | |||
| 2344 | ;;;###autoload | 2341 | ;;;###autoload |
| 2345 | (defun which-key-show-full-major-mode () | 2342 | (defun which-key-show-full-major-mode () |
| 2346 | "Show all bindings in the map of the current major mode. | 2343 | "Show all bindings in the map of the current major mode. |
| 2347 | |||
| 2348 | This function will also detect evil bindings made using | 2344 | This function will also detect evil bindings made using |
| 2349 | `evil-define-key' in this map. These bindings will depend on the | 2345 | `evil-define-key' in this map. These bindings will depend on the |
| 2350 | current evil state. " | 2346 | current evil state. " |
| @@ -2354,7 +2350,6 @@ current evil state. " | |||
| 2354 | ;;;###autoload | 2350 | ;;;###autoload |
| 2355 | (defun which-key-dump-bindings (prefix buffer-name) | 2351 | (defun which-key-dump-bindings (prefix buffer-name) |
| 2356 | "Dump bindings from PREFIX into buffer named BUFFER-NAME. | 2352 | "Dump bindings from PREFIX into buffer named BUFFER-NAME. |
| 2357 | |||
| 2358 | PREFIX should be a string suitable for `kbd'." | 2353 | PREFIX should be a string suitable for `kbd'." |
| 2359 | (interactive "sPrefix: \nB") | 2354 | (interactive "sPrefix: \nB") |
| 2360 | (let* ((buffer (get-buffer-create buffer-name)) | 2355 | (let* ((buffer (get-buffer-create buffer-name)) |
| @@ -2409,9 +2404,9 @@ PREFIX should be a string suitable for `kbd'." | |||
| 2409 | 2404 | ||
| 2410 | ;;;###autoload | 2405 | ;;;###autoload |
| 2411 | (defun which-key-C-h-dispatch () | 2406 | (defun which-key-C-h-dispatch () |
| 2412 | "Dispatch C-h commands by looking up key in | 2407 | "Dispatch C-h commands by looking up key in `which-key-C-h-map'. |
| 2413 | `which-key-C-h-map'. This command is always accessible (from any | 2408 | This command is always accessible (from any prefix) if |
| 2414 | prefix) if `which-key-use-C-h-commands' is non nil." | 2409 | `which-key-use-C-h-commands' is non nil." |
| 2415 | (interactive) | 2410 | (interactive) |
| 2416 | (cond ((and (not (which-key--popup-showing-p)) | 2411 | (cond ((and (not (which-key--popup-showing-p)) |
| 2417 | which-key-show-early-on-C-h) | 2412 | which-key-show-early-on-C-h) |
| @@ -2460,7 +2455,6 @@ prefix) if `which-key-use-C-h-commands' is non nil." | |||
| 2460 | (defun which-key--try-2-side-windows | 2455 | (defun which-key--try-2-side-windows |
| 2461 | (bindings prefix-keys prefix-title loc1 loc2 &rest _ignore) | 2456 | (bindings prefix-keys prefix-title loc1 loc2 &rest _ignore) |
| 2462 | "Try to show BINDINGS (PAGE-N) in LOC1 first. | 2457 | "Try to show BINDINGS (PAGE-N) in LOC1 first. |
| 2463 | |||
| 2464 | Only if no bindings fit fallback to LOC2." | 2458 | Only if no bindings fit fallback to LOC2." |
| 2465 | (let (pages1) | 2459 | (let (pages1) |
| 2466 | (let ((which-key-side-window-location loc1) | 2460 | (let ((which-key-side-window-location loc1) |
| @@ -2655,8 +2649,7 @@ Finally, show the buffer." | |||
| 2655 | this-command-keys)) | 2649 | this-command-keys)) |
| 2656 | 2650 | ||
| 2657 | (defun which-key--update () | 2651 | (defun which-key--update () |
| 2658 | "Function run by timer to possibly trigger | 2652 | "Function run by timer to possibly trigger `which-key--create-buffer-and-show'." |
| 2659 | `which-key--create-buffer-and-show'." | ||
| 2660 | (let ((prefix-keys (which-key--this-command-keys)) | 2653 | (let ((prefix-keys (which-key--this-command-keys)) |
| 2661 | delay-time) | 2654 | delay-time) |
| 2662 | (cond ((and (> (length prefix-keys) 0) | 2655 | (cond ((and (> (length prefix-keys) 0) |