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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54049 in the body.
You can then email your comments to 54049 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#54049; Package emacs. (Thu, 17 Feb 2022 23:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mauro Aranda <maurooaranda <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 17 Feb 2022 23:03:02 GMT) Full text and rfc822 format available.

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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Wrong :match function for the new key widget
Date: Thu, 17 Feb 2022 20:01:55 -0300
1. emacs -Q
2. Type the following into the *scratch* buffer:
(defcustom foo "C-c a"
  "..."
  :type 'key)
3. C-x C-e
4. M-x customize-option RET foo
5. Emacs signals:
widget-apply: Wrong number of arguments: (1 . 1), 2

The widget manual says:
‘:match’
     Should be a function called with two arguments, the widget and an
     external value, and should return non-‘nil’ if the widget can
     represent the specified value.

So using key-valid-p as the :match function isn't correct.


In GNU Emacs 29.0.50 (build 53, i686-pc-linux-gnu, GTK+ Version 2.24.32, cairo version 1.16.0)
 of 2022-02-17 built on tbb-desktop
Repository revision: 246f627a4125d8b3ae5e88748a439f3f594340b5
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Ubuntu 18.04.6 LTS

Configured using:
 'configure --with-mailutils --with-xml2 --with-dbus'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG MODULES
NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK2 ZLIB

Important settings:
  value of $LC_MONETARY: es_AR.UTF-8
  value of $LC_NUMERIC: es_AR.UTF-8
  value of $LC_TIME: es_AR.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config gnus-util text-property-search time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
thingatpt help-fns radix-tree help-mode seq gv subr-x byte-opt bytecomp
byte-compile cconv cus-edit pp cus-start cus-load wid-edit cl-loaddefs
cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 8 65273 6487)
 (symbols 24 7499 1)
 (strings 16 20834 2224)
 (string-bytes 1 622909)
 (vectors 8 12824)
 (vector-slots 4 181213 32426)
 (floats 8 27 34)
 (intervals 28 229 6)
 (buffers 564 12))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54049; Package emacs. (Thu, 17 Feb 2022 23:07:01 GMT) Full text and rfc822 format available.

Message #8 received at 54049 <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


Added tag(s) patch. Request was from Mauro Aranda <maurooaranda <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 17 Feb 2022 23:07:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54049; Package emacs. (Sat, 19 Feb 2022 12:34:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 54049 <at> debbugs.gnu.org
Subject: Re: bug#54049: 29.0.50; Wrong :match function for the new key widget
Date: Sat, 19 Feb 2022 13:33:16 +0100
Mauro Aranda <maurooaranda <at> gmail.com> writes:

> * 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)

Thanks; pushed to Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 54049 <at> debbugs.gnu.org and Mauro Aranda <maurooaranda <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 19 Feb 2022 12:34:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 20 Mar 2022 11:24:06 GMT) Full text and rfc822 format available.

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.