1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

Fix :match function for the key widget

* lisp/wid-edit.el (key): Calling key-valid-p directly doesn't work,
because the :match function is called with the widget and the value as
arguments (bug#54049).
This commit is contained in:
Mauro Aranda 2022-02-19 13:33:05 +01:00 committed by Lars Ingebrigtsen
parent 9fff6388b4
commit 8ccf9b5276

View File

@ -3532,13 +3532,17 @@ It reads a directory name from an editable text field."
(define-widget 'key 'editable-field
"A key sequence."
:prompt-value 'widget-field-prompt-value
:match 'key-valid-p
:match #'widget-key-valid-p
:format "%{%t%}: %v"
:validate 'widget-key-validate
:keymap widget-key-sequence-map
:help-echo "C-q: insert KEY, EVENT, or CODE; RET: enter value"
:tag "Key")
(defun widget-key-valid-p (_widget value)
"Non-nil if VALUE is a valid value for the key widget WIDGET."
(key-valid-p value))
(defun widget-key-validate (widget)
(unless (and (stringp (widget-value widget))
(key-valid-p (widget-value widget)))