GNU bug report logs - #54049
29.0.50; Wrong :match function for the new key widget

Previous Next

Package: emacs;

Reported by: Mauro Aranda <maurooaranda <at> gmail.com>

Date: Thu, 17 Feb 2022 23:03:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #10 received at control <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: 54049 <at> debbugs.gnu.org
Subject: Re: bug#54049: 29.0.50; Wrong :match function for the new key widget
Date: Thu, 17 Feb 2022 20:06:32 -0300
[Message part 1 (text/plain, inline)]
tags 54049 patch
quit


I attach a patch to fix it.

[0001-Fix-match-function-for-the-key-widget.patch (text/x-patch, inline)]
From 322032305e97bfef37cac0fa7a908f11e2be6896 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda <at> gmail.com>
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


This bug report was last modified 3 years and 153 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.