1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

Remove buttons when disabling 'button-mode'

* lisp/button.el (button-mode): Remove all buttons when disabling.
* doc/lispref/display.texi (Button Buffer Commands): Document
the change.  (Bug#73175)
This commit is contained in:
Robert Pluim 2024-09-25 16:52:57 +02:00
parent 08ee074a6f
commit e631a3f306
3 changed files with 15 additions and 3 deletions

View File

@ -8053,6 +8053,7 @@ These are commands and functions for locating and operating on
buttons in an Emacs buffer. buttons in an Emacs buffer.
@cindex buffer-button-map @cindex buffer-button-map
@findex button-mode
@code{push-button} is the command that a user uses to actually push @code{push-button} is the command that a user uses to actually push
a button, and is bound by default in the button itself to @key{RET} a button, and is bound by default in the button itself to @key{RET}
and to @key{mouse-2} using a local keymap in the button's overlay or and to @key{mouse-2} using a local keymap in the button's overlay or
@ -8063,7 +8064,8 @@ additionally available in the keymap stored in
@code{button-buffer-map} as a parent keymap for its keymap. @code{button-buffer-map} as a parent keymap for its keymap.
Alternatively, the @code{button-mode} can be switched on for much the 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 same effect: It's a minor mode that does nothing else than install
@code{button-buffer-map} as a minor mode keymap. @code{button-buffer-map} as a minor mode keymap (note that disabling
@code{button-mode} will remove all the buttons in the current buffer).
If the button has a non-@code{nil} @code{follow-link} property, and 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 @code{mouse-1-click-follows-link} is set, a quick @key{mouse-1} click

View File

@ -228,6 +228,9 @@ response.
*** New function 'unbuttonize-region'. *** New function 'unbuttonize-region'.
It removes all the buttons in the specified region. It removes all the buttons in the specified region.
+++
*** Disabling 'button-mode' now removes all buttons in the current buffer.
** Eshell ** Eshell
--- ---

View File

@ -80,8 +80,15 @@ Mode-specific keymaps may want to use this as their parent keymap."
"<touchscreen-down>" #'push-button) "<touchscreen-down>" #'push-button)
(define-minor-mode button-mode (define-minor-mode button-mode
"A minor mode for navigating to buttons with the TAB key." "A minor mode for navigating to buttons with the TAB key.
:keymap button-buffer-map)
Disabling the mode will remove all buttons in the current buffer."
:keymap button-buffer-map
(when (not button-mode)
(save-excursion
(save-restriction
(widen)
(unbuttonize-region (point-min) (point-max))))))
;; Default properties for buttons. ;; Default properties for buttons.
(put 'default-button 'face 'button) (put 'default-button 'face 'button)