]> git.eshelyaron.com Git - emacs.git/commit
Fix matching of inline choices for the choice widget
authorMauro Aranda <maurooaranda@gmail.com>
Tue, 24 Nov 2020 11:31:18 +0000 (08:31 -0300)
committerMauro Aranda <maurooaranda@gmail.com>
Tue, 24 Nov 2020 11:31:18 +0000 (08:31 -0300)
commitcbd24607d7b7419eb0f639c95185aff13f99c10d
treecd2f4c6df1fa65acb5b4e46943ec5c8071373019
parent5cc570215a30301939a56075035e91aa540513cb
Fix matching of inline choices for the choice widget

A choice widget should be able to match either no inline values or
inline values, upon request.  (Bug#44579)

* lisp/wid-edit.el (choice): New property, :inline-bubbles-p.  A
predicate that returns non-nil if the choice widget can act as an
inline widget.  Document it.
(widget-choice-inline-bubbles-p): New function, for the
:inline-bubbles-p property of the choice widget.
(widget-inline-p): New function.  Use the :inline-bubbles-p property
of the widget, if any.
(widget-match-inline): Use the above to see if the widget can act like
an inline widget.  Document it.
(widget-choice-value-create): Account for the case of a choice widget
that has inline members.
(widget-checklist-add-item, widget-editable-list-value-create)
(widget-group-value-create): Use widget-inline-p rather than just
checking for a non-nil :inline property, allowing these functions to
pass the complete information to widgets like the choice widget to
create their values.

* test/lisp/wid-edit-tests.el (widget-test-choice-match-no-inline)
(widget-test-choice-match-all-inline)
widget-test-choice-match-some-inline): New tests, to check that choice
widgets can match its choices, inline or not.
(widget-test-inline-p): New test, for the new function
widget-inline-p.
(widget-test-repeat-can-handle-choice)
(widget-test-repeat-can-handle-inlinable-choice)
(widget-test-list-can-handle-choice)
(widget-test-list-can-handle-inlinable-choice)
(widget-test-option-can-handle-choice)
(widget-test-option-can-handle-inlinable-choice): New tests.  This
grouping widgets need to be able to create a choice widget regardless
if it has inline choices or not.
lisp/wid-edit.el
test/lisp/wid-edit-tests.el