1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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.
This commit is contained in:
Basil L. Contovounesios 2019-04-07 03:36:47 +01:00
parent 43f4c7ddd2
commit 08235af38c
4 changed files with 88 additions and 6 deletions

View file

@ -1163,8 +1163,9 @@ When not inside a field, signal an error."
(defun widget-at (&optional pos)
"The button or field at POS (default, point)."
(or (get-char-property (or pos (point)) 'button)
(widget-field-at pos)))
(let ((widget (or (get-char-property (or pos (point)) 'button)
(widget-field-at pos))))
(and (widgetp widget) widget)))
;;;###autoload
(defun widget-setup ()