all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#54049: 29.0.50; Wrong :match function for the new key widget
@ 2022-02-17 23:01 Mauro Aranda
  2022-02-17 23:06 ` Mauro Aranda
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Aranda @ 2022-02-17 23:01 UTC (permalink / raw)
  To: 54049

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#54049: 29.0.50; Wrong :match function for the new key widget
  2022-02-17 23:01 bug#54049: 29.0.50; Wrong :match function for the new key widget Mauro Aranda
@ 2022-02-17 23:06 ` Mauro Aranda
  2022-02-19 12:33   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Aranda @ 2022-02-17 23:06 UTC (permalink / raw)
  To: 54049

[-- Attachment #1: Type: text/plain, Size: 53 bytes --]

tags 54049 patch
quit


I attach a patch to fix it.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch --]
[-- Type: text/x-patch, Size: 1260 bytes --]

From 322032305e97bfef37cac0fa7a908f11e2be6896 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#54049: 29.0.50; Wrong :match function for the new key widget
  2022-02-17 23:06 ` Mauro Aranda
@ 2022-02-19 12:33   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-19 12:33 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 54049

Mauro Aranda <maurooaranda@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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-19 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-17 23:01 bug#54049: 29.0.50; Wrong :match function for the new key widget Mauro Aranda
2022-02-17 23:06 ` Mauro Aranda
2022-02-19 12:33   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.