Bind TAB and <backtab> on buttons
* lisp/button.el (button-map): Inherit from 'button-buffer-map'.
This commit is contained in:
parent
dcbef9045f
commit
b381929c91
2 changed files with 24 additions and 22 deletions
7
etc/NEWS
7
etc/NEWS
|
@ -123,6 +123,13 @@ of 'user-emacs-directory'.
|
|||
|
||||
* Incompatible changes in Emacs 29.1
|
||||
|
||||
---
|
||||
** 'TAB' and '<backtab>' is now bound in 'button-map'.
|
||||
This means that if you're standing on a button, 'TAB' will take you to
|
||||
the next button, even if the mode has bound it to something else.
|
||||
This also means that 'TAB' on a button in an 'outline-minor-mode'
|
||||
heading will move point instead of collapsing the outline.
|
||||
|
||||
---
|
||||
** 'Info-default-directory-list' is no longer populated at Emacs startup.
|
||||
If you have code in your init file that removes directories from
|
||||
|
|
|
@ -55,29 +55,24 @@
|
|||
"Default face used for buttons."
|
||||
:group 'basic-faces)
|
||||
|
||||
(defvar button-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
;; The following definition needs to avoid using escape sequences that
|
||||
;; might get converted to ^M when building loaddefs.el
|
||||
(define-key map [(control ?m)] 'push-button)
|
||||
(define-key map [mouse-2] 'push-button)
|
||||
(define-key map [follow-link] 'mouse-face)
|
||||
;; FIXME: You'd think that for keymaps coming from text-properties on the
|
||||
;; mode-line or header-line, the `mode-line' or `header-line' prefix
|
||||
;; shouldn't be necessary!
|
||||
(define-key map [mode-line mouse-2] 'push-button)
|
||||
(define-key map [header-line mouse-2] 'push-button)
|
||||
map)
|
||||
"Keymap used by buttons.")
|
||||
(defvar-keymap button-buffer-map
|
||||
:doc "Keymap useful for buffers containing buttons.
|
||||
Mode-specific keymaps may want to use this as their parent keymap."
|
||||
"TAB" #'forward-button
|
||||
"C-TAB" #'backward-button
|
||||
"<backtab>" #'backward-button)
|
||||
|
||||
(defvar button-buffer-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map [?\t] 'forward-button)
|
||||
(define-key map "\e\t" 'backward-button)
|
||||
(define-key map [backtab] 'backward-button)
|
||||
map)
|
||||
"Keymap useful for buffers containing buttons.
|
||||
Mode-specific keymaps may want to use this as their parent keymap.")
|
||||
(defvar-keymap button-map
|
||||
:doc "Keymap used by buttons."
|
||||
:parent button-buffer-map
|
||||
"RET" #'push-button
|
||||
"<mouse-2>" #'push-button
|
||||
"<follow-link>" 'mouse-face
|
||||
;; FIXME: You'd think that for keymaps coming from text-properties on the
|
||||
;; mode-line or header-line, the `mode-line' or `header-line' prefix
|
||||
;; shouldn't be necessary!
|
||||
"<mode-line> <mouse-2>" #'push-button
|
||||
"<header-line> <mouse-2>" #'push-button)
|
||||
|
||||
(define-minor-mode button-mode
|
||||
"A minor mode for navigating to buttons with the TAB key."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue