diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index f877a6a5a27..e19354ec107 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -8053,6 +8053,7 @@ These are commands and functions for locating and operating on 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 @@ -8063,7 +8064,8 @@ additionally available in the keymap stored in @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 diff --git a/etc/NEWS b/etc/NEWS index 3d77612f304..c2919169bbf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -228,6 +228,9 @@ response. *** 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 --- diff --git a/lisp/button.el b/lisp/button.el index de6ea8d966c..1a732bee98b 100644 --- a/lisp/button.el +++ b/lisp/button.el @@ -80,8 +80,15 @@ Mode-specific keymaps may want to use this as their parent keymap." "" #'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)