Make the button navigation commands available via a minor mode

* lisp/button.el (button-mode): New minor mode.

* doc/lispref/display.texi (Button Buffer Commands): Mention it.
This commit is contained in:
Lars Ingebrigtsen 2020-09-09 12:40:36 +02:00
parent 7bd6dd065b
commit 1ee76735a2
3 changed files with 14 additions and 0 deletions

View file

@ -6926,6 +6926,9 @@ such as @code{forward-button} and @code{backward-button} are
additionally available in the keymap stored in
@code{button-buffer-map}; a mode which uses buttons may want to use
@code{button-buffer-map} as a parent keymap for its keymap.
Alternatively, the @code{button-mode} can be switched on for much the
same effect: It's a minor mode that does nothing else than install
@code{button-buffer-map} as a minor mode keymap.
If the button has a non-@code{nil} @code{follow-link} property, and
@code{mouse-1-click-follows-link} is set, a quick @key{mouse-1} click

View file

@ -958,6 +958,13 @@ window after starting). This variable defaults to nil.
** Miscellaneous
+++
*** New minor mode 'button-mode'.
This minor mode does nothing else than install 'button-buffer-map' as
a minor mode map (which binds the TAB/S-TAB key bindings to navigate
to buttons), and can be used in any view-mode-like buffer that has
buttons in it.
---
*** 'icomplete-show-matches-on-no-input' behavior change.
Previously, choosing a different completion with commands like 'C-.'

View file

@ -78,6 +78,10 @@
"Keymap useful for buffers containing buttons.
Mode-specific keymaps may want to use this as their parent keymap.")
(define-minor-mode button-mode
"A minor mode for navigating to buttons with the TAB key."
:keymap button-buffer-map)
;; Default properties for buttons.
(put 'default-button 'face 'button)
(put 'default-button 'mouse-face 'highlight)