Subject: Re: bug#54049: 29.0.50; Wrong :match function for the new key widget

From: Mauro Aranda <[email-masked]>
Date: Thu, 17 Feb 2022 20:06:32 -0300

tags 54049 patch
quit

I attach a patch to fix it.

>From 322032305e97bfef37cac0fa7a908f11e2be6896 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <[email-masked]>
Date: Thu, 17 Feb 2022 19:52:19 -0300
Subject: [PATCH] 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)
---
 lisp/wid-edit.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index f00a524c0c..29b6e13bc6 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -3532,13 +3532,17 @@ widget-key-prompt-value-history
 (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)))
-- 
2.17.1