summaryrefslogtreecommitdiff
path: root/lisp/button.el
diff options
context:
space:
mode:
authorBasil L. Contovounesios <contovob@tcd.ie>2019-04-07 03:36:47 +0100
committerBasil L. Contovounesios <contovob@tcd.ie>2019-04-07 03:56:27 +0100
commit08235af38c92e95d8ec9d268916d8910ea50ab2d (patch)
treed065cbd0fcb339ddf2f2fd0b809400a54deb99ef /lisp/button.el
parent43f4c7ddd2077b2e786d069bbb9e2de32f23ffb2 (diff)
downloademacs-08235af38c92e95d8ec9d268916d8910ea50ab2d.tar.gz
Distinguish buttons from widgets (bug#34506)
* lisp/button.el (button-at): * lisp/wid-edit.el (widget-at): Avoid returning a false positive when looking for a button and finding a widget, or vice versa. * test/lisp/button-tests.el: * test/lisp/wid-edit-tests.el: New files.
Diffstat (limited to 'lisp/button.el')
-rw-r--r--lisp/button.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/button.el b/lisp/button.el
index c46f3d9a52b..921e84dfa68 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -382,10 +382,12 @@ Also see `make-text-button'."
If the button at POS is a text property button, the return value
is a marker pointing to POS."
(let ((button (get-char-property pos 'button)))
- (if (or (overlayp button) (null button))
- button
- ;; Must be a text-property button; return a marker pointing to it.
- (copy-marker pos t))))
+ (and button (get-char-property pos 'category)
+ (if (overlayp button)
+ button
+ ;; Must be a text-property button;
+ ;; return a marker pointing to it.
+ (copy-marker pos t)))))
(defun next-button (pos &optional count-current)
"Return the next button after position POS in the current buffer.