]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix :match function for the key widget
authorMauro Aranda <maurooaranda@gmail.com>
Sat, 19 Feb 2022 12:33:05 +0000 (13:33 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 19 Feb 2022 12:33:32 +0000 (13:33 +0100)
* 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).

lisp/wid-edit.el

index f00a524c0c4c1b4c66c1a6b320858b082a5c3df0..29b6e13bc604b04fc1a9248643b1644133e4bce5 100644 (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)))