buttons in an Emacs buffer.
@cindex buffer-button-map
+@findex button-mode
@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}
and to @key{mouse-2} using a local keymap in the button's overlay or
@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.
+@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
@code{mouse-1-click-follows-link} is set, a quick @key{mouse-1} click
*** New function 'unbuttonize-region'.
It removes all the buttons in the specified region.
++++
+*** Disabling 'button-mode' now removes all buttons in the current buffer.
+
** Eshell
---
"<touchscreen-down>" #'push-button)
(define-minor-mode button-mode
- "A minor mode for navigating to buttons with the TAB key."
- :keymap button-buffer-map)
+ "A minor mode for navigating to buttons with the TAB key.
+
+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.
(put 'default-button 'face 'button)