From unknown Mon Jun 23 07:52:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63838: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets. Resent-From: Marco Antoniotti Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Jun 2023 11:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63838 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 63838@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168570437625038 (code B ref -1); Fri, 02 Jun 2023 11:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 Jun 2023 11:12:56 +0000 Received: from localhost ([127.0.0.1]:39155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q52iE-0006Vl-RH for submit@debbugs.gnu.org; Fri, 02 Jun 2023 07:12:55 -0400 Received: from lists.gnu.org ([209.51.188.17]:57950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q51Pa-0004AF-Ey for submit@debbugs.gnu.org; Fri, 02 Jun 2023 05:49:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q51PV-0006eY-Nu for bug-gnu-emacs@gnu.org; Fri, 02 Jun 2023 05:49:30 -0400 Received: from mail-yb1-xb2b.google.com ([2607:f8b0:4864:20::b2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q51PQ-0003cV-Gh for bug-gnu-emacs@gnu.org; Fri, 02 Jun 2023 05:49:29 -0400 Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-bacf5b89da7so1996842276.2 for ; Fri, 02 Jun 2023 02:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685699362; x=1688291362; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=jTLfnyfbSv5JFAltc2uxAb8Kj4ejK1tfOrXXFUP+MHE=; b=kWqhzqxjm1aZuhaSyazYXTxZvt+cFAcoeJGUL/INGE7SHmV3xTSULcqWsZ0GQzzYEu sYvu6ahlH7HAKP9ORggcLFrHjvCGbEWxa2bz949uTL3rzs65Z+5XQlR+wCBhR8Ckc8T2 T+Qs1F64k7MD6Fy/9c/eAgDS6ioroFW+DQPv/TDTbQeayi+gUTotwSeVvFa9k4jVinnT DaVWPjDftkxY4+QWQdGHnXZEXhgej1qUQpKSgepIGE/0Gut93gn+tBhHrIXCK8Z9ZD++ Jk3YHdYPLCMrDb1nkAnlyrIl604MI1mG5P5barsMR76Lj+GfsCKEqDLP4flR6sUaCb66 616Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685699362; x=1688291362; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jTLfnyfbSv5JFAltc2uxAb8Kj4ejK1tfOrXXFUP+MHE=; b=EZlf3RByYIGkinhSxv2hSvnzdCtGabJKu5ZsxLNkmtxZ7Ru5Ats9EkoHEAK5KYEBTW ULdX7uJl5QonTnDVduE530ykE7gqIthQ+BtYJVCmyggdoUpwoc0LU5342LdKiR5apcVZ NJaTzmIZvg5xJCHWZnLnhoOFupU0nYukCWJe1nbyyQB3bWz+Y2dkPyz+ZEsDMsGzsH1Y UZOCXU+3zxPaUe3r1XIlT8c5t1Qz8GUb6oZQl5Qy3D9RFbMA6t1AILn7M+k+MQE+xArs dWA6x7odYxAkg943LzfGL21Ydj9lL5uRLBD/ka9k9ALOtuAZvQnSzuwtpxu9LjZDADKy OsCQ== X-Gm-Message-State: AC+VfDxlYbi6BX48xjhMA+BMG1g4EvoDLfTdpDEqgNrWkolqL0NHIDKm utZGN9pL9A+tcGUyctWD3qBmsaK5H7/2Xka4lo0bXLuivf7XXQ== X-Google-Smtp-Source: ACHHUZ5gFj3LhztaPvxhwPlkuzUROJXYD/p/m9GELJePL7gb0cJo2SPFidZ5vEPem9kOirrqNKlgIxcog+StPUvaCWw= X-Received: by 2002:a25:a2c1:0:b0:ba8:89bf:b3e5 with SMTP id c1-20020a25a2c1000000b00ba889bfb3e5mr2376868ybn.10.1685699361995; Fri, 02 Jun 2023 02:49:21 -0700 (PDT) MIME-Version: 1.0 From: Marco Antoniotti Date: Fri, 2 Jun 2023 11:49:10 +0200 Message-ID: Content-Type: multipart/alternative; boundary="000000000000ab80ba05fd227794" Received-SPF: pass client-ip=2607:f8b0:4864:20::b2b; envelope-from=marcoxa@gmail.com; helo=mail-yb1-xb2b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Mailman-Approved-At: Fri, 02 Jun 2023 07:12:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000ab80ba05fd227794 Content-Type: text/plain; charset="UTF-8" Hi The issue is with the following code that tries to use the Widget library. The slots of the widget are actually not necessary to see the problem. (widget-create 'integer :help-echo "Enter an integer..." :notify (lambda (w1 &rest ws) (ignore ws) (message "WIFT: IF: %s" (widget-value w1) )) :size 4 ) If you set up a widget buffer, the field will appear as expected with a 0 as initial value. The problem starts if you try to clear the field and then enter a new value, say by hitting C-k, and the problem is in the :value-to-external functions in the in sexp and restricted-sexp widgets (the number, float and natnum widgets must also be fixed). The library :value-to-external functions eventually do a (read value) where value is the widget value; alas, value can be "" if you edit the field in a pretty standard way, as, as I said above, if you had tried to kill the field line (C-k); this causes the traditional minor demons to fly out of the nose, as a 'End of file during parsing' error gets signaled. After that, the buffer with the widgets is pretty much in a random state. Specializing the widget with a hack like the function below fixes the problem, but a good solution may need some more work to get all the corner cases. Note that setting a "widget buffer" in overwrite mode goes a long way to mitigate these problems: maybe having widget-setup switch to it would be another good thing to do. :value-to-external (lambda (widget value) ;; Lifted, and fixed, from `:value-to-external' in ;; `restricted-sexp'. (unless (stringp value) (display-warning 'widget-bad-default-value (format-message "\nA widget of type %S has a bad default value. value: %S match function: %S match-alternatives: %S" (widget-type widget) value (widget-get widget :match) (widget-get widget :match-alternatives)) :warning)) (if (and (stringp value) (string-equal "" value)) ;; Oooops, we cannot just `read'. (widget-get widget :default-value) (read value)) ) Note: this goes back, at least, to 25.x. Thanks for the attention Marco Antoniotti In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13 built on AVALON Windowing system distributor 'Microsoft Corp.', version 10.0.22621 System Description: Microsoft Windows 10 Pro (v10.0.2009.22621.1778) Configured using: 'configure --with-modules --without-dbus --with-native-compilation --without-compress-install CFLAGS=-O2' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XPM ZLIB (NATIVE_COMP present but libgccjit not available) Important settings: value of $LANG: ENG locale-coding-system: cp1252 Major mode: Fundamental Minor modes in effect: tooltip-mode: t global-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 blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util rmail rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date wombat-theme finder-inf tex-site epg rfc6068 epg-config gnu-elpa-keyring-update slime-autoloads rx info package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win 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 hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 246351 7879) (symbols 48 14548 1) (strings 32 84982 2407) (string-bytes 1 2218067) (vectors 16 24066) (vector-slots 8 414464 16368) (floats 8 28 222) (intervals 56 377 9) (buffers 992 12)) -- Marco Antoniotti Somewhere over the Rainbow --000000000000ab80ba05fd227794 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

The issue is with the following code that tries = to use the Widget
library.=C2=A0 The slots of the widget are actually no= t necessary to see the problem.

=C2=A0(widget-create 'integer
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 :help-echo "Ent= er an integer..."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 :notify (lambda (w1 &rest ws)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 (ignore w= s)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 (message "WIFT: IF: %s"
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (widget-value w1)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0=C2=A0 ))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 :size 4
=C2=A0 )


If you set u= p a widget buffer, the field will appear as expected with a 0 as initial va= lue.=C2=A0 The problem starts if you try to clear the field and then enter = a new value, say by hitting C-k, and the problem is in the :value-t= o-external functions in the in sexp and restricted-sexp widgets (the number, float and natnum widgets must also be fixed).

=
The library :value-to-external functions eventually do a (read= value) where value is = the widget value; alas, value = can be "" if you edi= t the field in a pretty standard way, as, as I said above, if you had tried= to kill the field line (C-k);= this causes the traditional minor demons to fly out of the nose, as a '= ;End of file during parsing' error gets signaled.=C2=A0 After that, the= buffer with the widgets is pretty much in a random state.
Specializing the widget with a hack like the function below fi= xes the problem, but a
good solution may need some more work to g= et all the corner cases.=C2=A0 Note that setting a "widget buffer"= ; in overwrite mode goes a long way to mitigate these problems: maybe havin= g widget-setup switch to it wo= uld be another good thing to do.

=C2=A0 :value-to-external
=C2=A0 (lambda (widget va= lue)
=C2=A0=C2=A0=C2=A0 ;; Lifted, and fixed, from `:value-to-external&#= 39; in
=C2=A0=C2=A0=C2=A0 ;; `restricted-sexp'.

=C2=A0=C2=A0= =C2=A0 (unless (stringp value)
=C2=A0 =C2=A0=C2=A0=C2=A0 (display-warnin= g
=C2=A0 =C2=A0 =C2=A0=C2=A0 'widget-bad-default-value
=C2=A0 =C2= =A0 =C2=A0=C2=A0 (format-message
=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 "= \nA widget of type %S has a bad default value.
value: %S
match functi= on: %S
match-alternatives: %S"
=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 = (widget-type widget)
=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 value
=C2=A0 = =C2=A0 =C2=A0=C2=A0=C2=A0 (widget-get widget :match)
=C2=A0 =C2=A0 =C2= =A0=C2=A0=C2=A0 (widget-get widget :match-alternatives))
=C2=A0 =C2=A0 = =C2=A0=C2=A0 :warning))
=C2=A0=C2=A0=C2=A0 (if (and (stringp value) (str= ing-equal "" value))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Oooops, we= cannot just `read'.
=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 (widget-get wi= dget :default-value)
=C2=A0 =C2=A0=C2=A0=C2=A0 (read value))
=C2=A0= =C2=A0=C2=A0 )

Note: this goes back, at lea= st, to 25.x.

Thanks for the attention
Marco Antoniotti



<= /div>


In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
=C2=A0of 2022-09-13 b= uilt on AVALON
Windowing system distributor 'Microsoft Corp.', v= ersion 10.0.22621
System Description: Microsoft Windows 10 Pro (v10.0.20= 09.22621.1778)

Configured using:
=C2=A0'configure --with-modu= les --without-dbus --with-native-compilation
=C2=A0--without-compress-in= stall CFLAGS=3D-O2'

Configured features:
ACL GIF GMP GNUTLS H= ARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDU= MPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
XPM ZLIB

(NA= TIVE_COMP present but libgccjit not available)

Important settings:=C2=A0 value of $LANG: ENG
=C2=A0 locale-coding-system: cp1252

= Major mode: Fundamental

Minor modes in effect:
=C2=A0 tooltip-mod= e: t
=C2=A0 global-eldoc-mode: t
=C2=A0 show-paren-mode: t
=C2=A0 = electric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mo= de: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2= =A0 global-font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-= composition-mode: t
=C2=A0 auto-encryption-mode: t
=C2=A0 auto-compre= ssion-mode: t
=C2=A0 buffer-read-only: t
=C2=A0 line-number-mode: t=C2=A0 transient-mark-mode: t

Features:
(shadow sort mail-extr = emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa de= rived gnus-util rmail rmail-loaddefs
text-property-search mm-decode mm-b= odies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendm= ail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date w= ombat-theme finder-inf tex-site
epg rfc6068 epg-config gnu-elpa-keyring-= update slime-autoloads rx info
package browse-url url url-proxy url-priv= acy url-expand url-methods
url-history url-cookie url-domsuf url-util ma= ilcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs= eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv = bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc = paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode m= wheel
dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/comm= on-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list repla= ce
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-b= ar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lockfont-lock syntax font-core term/tty-colors frame minibuffer cl-genericcham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet laokorean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
eur= opean ethiopic indian cyrillic chinese composite emoji-zwj charscript
ch= arprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-p= reloaded nadvice button loaddefs faces cus-face macroexp files
window te= xt-properties overlay sha1 md5 base64 format env code-pages
mule custom = widget hashtable-print-readable backquote threads w32notify
w32 lcms2 mu= lti-tty make-network-process native-compile emacs)

Memory informatio= n:
((conses 16 246351 7879)
=C2=A0(symbols 48 14548 1)
=C2=A0(stri= ngs 32 84982 2407)
=C2=A0(string-bytes 1 2218067)
=C2=A0(vectors 16 2= 4066)
=C2=A0(vector-slots 8 414464 16368)
=C2=A0(floats 8 28 222)
= =C2=A0(intervals 56 377 9)
=C2=A0(buffers 992 12))

=

--
Marco Antoniotti
Somewhere over the Rainbo= w
--000000000000ab80ba05fd227794-- From unknown Mon Jun 23 07:52:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63838: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets. References: In-Reply-To: Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Jul 2023 11:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63838 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Marco Antoniotti Cc: 63838@debbugs.gnu.org Received: via spool by 63838-submit@debbugs.gnu.org id=B63838.168950824332578 (code B ref 63838); Sun, 16 Jul 2023 11:51:02 +0000 Received: (at 63838) by debbugs.gnu.org; 16 Jul 2023 11:50:43 +0000 Received: from localhost ([127.0.0.1]:46975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL0Gx-0008TO-9u for submit@debbugs.gnu.org; Sun, 16 Jul 2023 07:50:43 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]:48384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qL0Gt-0008T9-HJ for 63838@debbugs.gnu.org; Sun, 16 Jul 2023 07:50:41 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1b06da65bdbso2701015fac.1 for <63838@debbugs.gnu.org>; Sun, 16 Jul 2023 04:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689508233; x=1692100233; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=2W4AW/cMS89SKdHvzaPHhwuA0qRpfsgdb/OMEdnHtdg=; b=C/WH72Vdkz4nbuqMrMWPIvLV6lcoOOe0tIhR4ORuDGdGn35ncd3ISewhi6onHESiyX b45zz8BYhZZ53SHKctTNdWbtx3XaGMo9vUnHw80Vey7ZYeNGRjilhUqi9Q6hHwjo4Hi0 gYR8N97WgK0tcjCvlglqok/+NQXQ02lxOtcWxOliNb73w05hLX1LQAijC2jMK+Kxj4rJ xjAVxeJQwsnBF3kdrDoF+ohaVtXvpXySFPOpmq6Y7cmBp79JGg/BsVn3gnJnrPiG0rZU mA53JV25V5ykYk92Vo35gpqPdbWQSRmeAXJOIASSnko14b3mKLfQrKWIb7g5C8RdwKKw 0Q3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689508233; x=1692100233; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=2W4AW/cMS89SKdHvzaPHhwuA0qRpfsgdb/OMEdnHtdg=; b=REcg9Mfyf9TIuOvwGt7DpIMB2SMGpGeILYPmeH+9grCEtMqqFndztu77rRnn9SO3Fi MtiX/ZPFNd/KpPPW29eBdg3Pmwisfp2jRDOHWLzwc+T9oMgaJUAv79cPa9IUQx8fVvBX gc3Diwc2W3hqfDIvMlMX8ci85M/GjEem9dYfnO/9TCu9HXN+cyHsD4T8tlSjxIFUISKH nVhffC99gHK+5gLWRdG+qWrSS90Ih9oT/Y70VjUWeVlQJmsqS3fX08sOG0j85jldfgoH gIjQZDX9DlWze/z0sSNxmedzvr5pXLY1q50Lix0nDGUJvO4Ac+jtLCx6+cGY1j2CUSZu 1Rgw== X-Gm-Message-State: ABy/qLZ2vOkKg4pI/NJS/+JB6M1Iav7tsHaEpYm9hwYH3doSeoPeBVtW n1dCzviIF8vQJvtr6D+cZYk= X-Google-Smtp-Source: APBJJlEWaD7KSYpnAQatCMaWMfnOYhXA2t80NKOBdvEgJ+Rrn2EY/AUlpCGyu30tosm9EW+Bh3MKtg== X-Received: by 2002:a05:6870:b616:b0:1b0:3e54:948 with SMTP id cm22-20020a056870b61600b001b03e540948mr9970376oab.37.1689508233648; Sun, 16 Jul 2023 04:50:33 -0700 (PDT) Received: from [192.168.0.234] ([186.127.128.249]) by smtp.gmail.com with ESMTPSA id p5-20020a056870868500b0019ea8771fb0sm6031836oam.13.2023.07.16.04.50.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Jul 2023 04:50:33 -0700 (PDT) Message-ID: <174623a9-45bf-10d1-8b59-cb5b816026bc@gmail.com> Date: Sun, 16 Jul 2023 08:50:28 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US From: Mauro Aranda Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Marco Antoniotti writes: > Hi Thanks for the bug report! > The issue is with the following code that tries to use the Widget > library.  The slots of the widget are actually not necessary to see the > problem. > >  (widget-create 'integer >                 :help-echo "Enter an integer..." >                 :notify (lambda (w1 &rest ws) >                            (ignore ws) >                            (message "WIFT: IF: %s" >                                     (widget-value w1) >                            )) >                 :size 4 >   ) The :notify value is kind of necessary, right? I mean, the bug doesn't manifest as long as code doesn't try to access the value of a restricted-sexp widget while its empty. > Specializing the widget with a hack like the function below fixes the > problem, but a > good solution may need some more work to get all the corner cases. > Note that setting a "widget buffer" in overwrite mode goes a long way to > mitigate these problems: maybe having widget-setup switch to it would > be another good thing to do. I don't think we want to do that. >  :value-to-external >   (lambda (widget value) >     ;; Lifted, and fixed, from `:value-to-external' in >     ;; `restricted-sexp'. > >     (unless (stringp value) >       (display-warning >        'widget-bad-default-value >        (format-message >         "\nA widget of type %S has a bad default value. > value: %S > match function: %S > match-alternatives: %S" >         (widget-type widget) >         value >         (widget-get widget :match) >         (widget-get widget :match-alternatives)) >        :warning)) >     (if (and (stringp value) (string-equal "" value)) >         ;; Oooops, we cannot just `read'. >         (widget-get widget :default-value) >       (read value)) >     ) I don't think this is a good place to do this.  And there's no :default-value property in the widget library, just :value. I think it'd be much better if we specialize the :value-get function for the restricted-sexp widget, defaulting to return :value when the widget is empty. From unknown Mon Jun 23 07:52:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63838: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets. Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Sep 2023 15:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63838 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 63838@debbugs.gnu.org Cc: Marco Antoniotti Received: via spool by 63838-submit@debbugs.gnu.org id=B63838.169427244919239 (code B ref 63838); Sat, 09 Sep 2023 15:15:01 +0000 Received: (at 63838) by debbugs.gnu.org; 9 Sep 2023 15:14:09 +0000 Received: from localhost ([127.0.0.1]:48263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qezey-00050D-U6 for submit@debbugs.gnu.org; Sat, 09 Sep 2023 11:14:09 -0400 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]:44217) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qezex-0004zn-0J; Sat, 09 Sep 2023 11:14:07 -0400 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3ab2436b57dso2069425b6e.0; Sat, 09 Sep 2023 08:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694272437; x=1694877237; darn=debbugs.gnu.org; h=in-reply-to:references:cc:to:from:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=q0bPI9BSA06a4GfUm+Nz4Vd9vPY8V9L9dTlXDAn8FBo=; b=lHzKaFtKivMbB8SN42Nu+hPAIEhwWLGirBjfMlHfWVoSvfHvvNNlDKCQGjf41qW883 EIJCM/m76nfRY2B5NtbIU7GTfmI16Ij6sSjIxQ0lp6KvAnsqkxhjZBffp8/VaSYsDMJO T1UuUyP0Bs8RqC5YZ4smvsJeCzzgUh3IkKi8Vh2T06bJ1rNWJffkx82tfEzg//Vn6y+l duRq5UgBPLhlmxv1v4XUVoayGKouY4oRuuIaZOqBo6Q7dASdudpeFx0Ym3V/NFaXawJR NP3c97273+9EdK+YIOSLldqHESXnztyF5ta4yat5lXJMnzukfVm+gKcfbctlNivsS3cX JMsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694272437; x=1694877237; h=in-reply-to:references:cc:to:from:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=q0bPI9BSA06a4GfUm+Nz4Vd9vPY8V9L9dTlXDAn8FBo=; b=XBIDVBpdeW9PRZ/CjACttNy0bU78ior1dV50buO73eiTRT7D2FeFMkvUx+7+cbQHf7 FISGYs0B/UEqOxHJq7s9lKHPXB80X+z1MnQGnMHr3Y7fofxPZ6oA8QIeCCGgnjsKQ8EC 58DXr6oicmmfRXdLd3BM1TH8VpSkHKi6tiT97bNye81VJd76cj3DKFqk8jLmcjRekoP8 KgxglzD9YbAvDkOM50eJDvTtoEI+5faCnFqg1WgbRbEmFP1rMYa+Ie3/suj7K5AQCEEs ZKUTAHVXHu3ZMByFLLwQxhtfcy8f1E4QBS1qdJZT57bW3Teo/UHgdXi7xgynb4wdoo/F CtHQ== X-Gm-Message-State: AOJu0YzSckAqr9XEdxKGSIjOZkASV0iXW9hrI9oFBL5oL5fR/hCzDkK7 Z+5m9Zo75iORORxbrR6cEWgYtMSb5+M= X-Google-Smtp-Source: AGHT+IHzbp5voMNn6GkWG1AxoLggJSp9XpU1nVLTKYIcNDhYXp+6h8DQTWS0W/Ikl4iLZqoiYbsiqA== X-Received: by 2002:a05:6808:1919:b0:3a9:c25d:176a with SMTP id bf25-20020a056808191900b003a9c25d176amr8469332oib.36.1694272437610; Sat, 09 Sep 2023 08:13:57 -0700 (PDT) Received: from [192.168.0.234] ([152.168.142.156]) by smtp.gmail.com with ESMTPSA id d12-20020a05680813cc00b00396050dca14sm1696849oiw.28.2023.09.09.08.13.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Sep 2023 08:13:56 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------0VAzpyBDol2bjq1okHQg6J5r" Message-ID: <93b7830c-edd5-3462-bdbd-2fd18c1fdb0f@gmail.com> Date: Sat, 9 Sep 2023 12:13:53 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US From: Mauro Aranda References: <174623a9-45bf-10d1-8b59-cb5b816026bc@gmail.com> In-Reply-To: <174623a9-45bf-10d1-8b59-cb5b816026bc@gmail.com> X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.5 (--) This is a multi-part message in MIME format. --------------0VAzpyBDol2bjq1okHQg6J5r Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit tags 63838 patch quit I attach a patch to handle an empty restricted sexp widget, together with a test. --------------0VAzpyBDol2bjq1okHQg6J5r Content-Type: text/x-patch; charset=UTF-8; name="0001-Avoid-errors-when-a-restricted-sexp-widget-is-empty.patch" Content-Disposition: attachment; filename*0="0001-Avoid-errors-when-a-restricted-sexp-widget-is-empty.pat"; filename*1="ch" Content-Transfer-Encoding: base64 RnJvbSBhNDM4OTljNDA5NzAzYWY0OTY2ZTYxOWE5MmJkYTEyM2U4MDEyMmUwIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBNYXVybyBBcmFuZGEgPG1hdXJvb2FyYW5kYUBnbWFp bC5jb20+CkRhdGU6IFNhdCwgOSBTZXAgMjAyMyAyMTo1OTozMCArMDgwMApTdWJqZWN0OiBb UEFUQ0hdIEF2b2lkIGVycm9ycyB3aGVuIGEgcmVzdHJpY3RlZC1zZXhwIHdpZGdldCBpcyBl bXB0eQoKKiBsaXNwL3dpZC1lZGl0LmVsIChyZXN0cmljdGVkLXNleHApOiBEb24ndCB0cnkg dG8gcmVhZAphbiBlbXB0eSBzdHJpbmcgd2hlbiBjb252ZXJ0aW5nIHRoZSBjdXJyZW50IHZh bHVlIHRvIHRoZQpleHRlcm5hbCBmb3JtYXQuICAoQnVnIzYzODM4KQoKKiB0ZXN0L2xpc3Av d2lkLWVkaXQtdGVzdHMuZWwgKHdpZGdldC10ZXN0LXJlc3RyaWN0ZWQtc2V4cC1lbXB0eS12 YWwpOgpOZXcgdGVzdC4KLS0tCiBsaXNwL3dpZC1lZGl0LmVsICAgICAgICAgICAgfCAgNCAr KystCiB0ZXN0L2xpc3Avd2lkLWVkaXQtdGVzdHMuZWwgfCAxMSArKysrKysrKysrKwogMiBm aWxlcyBjaGFuZ2VkLCAxNCBpbnNlcnRpb25zKCspLCAxIGRlbGV0aW9uKC0pCgpkaWZmIC0t Z2l0IGEvbGlzcC93aWQtZWRpdC5lbCBiL2xpc3Avd2lkLWVkaXQuZWwKaW5kZXggZDE4ZDcy MWY3ZWQuLjc0NDEyNDE0MTEzIDEwMDY0NAotLS0gYS9saXNwL3dpZC1lZGl0LmVsCisrKyBi L2xpc3Avd2lkLWVkaXQuZWwKQEAgLTM2ODEsNyArMzY4MSw5IEBAICdyZXN0cmljdGVkLXNl eHAKICAgICAgICAgICAgICAgICAgICAgICAgICAgOndhcm5pbmcpCiAgICAgICAgICAgICAg ICAgICAgICAgICAgOzsgTWFrZSBzdXJlIHdlIHdpbGwgYHJlYWQnIGEgc3RyaW5nLgogICAg ICAgICAgICAgICAgICAgICAgICAgIChzZXRxIHZhbHVlIChwcmluMS10by1zdHJpbmcgdmFs dWUpKSkKLSAgICAgICAgICAgICAgICAgICAgICAgKHJlYWQgdmFsdWUpKSkKKyAgICAgICAg ICAgICAgICAgICAgICAgKGlmIChzdHJpbmctZW1wdHktcCB2YWx1ZSkKKyAgICAgICAgICAg ICAgICAgICAgICAgICAgIHZhbHVlCisgICAgICAgICAgICAgICAgICAgICAgIChyZWFkIHZh bHVlKSkpKQogCiAoZGVmdW4gd2lkZ2V0LXJlc3RyaWN0ZWQtc2V4cC1tYXRjaCAod2lkZ2V0 IHZhbHVlKQogICAobGV0ICgoYWx0ZXJuYXRpdmVzICh3aWRnZXQtZ2V0IHdpZGdldCA6bWF0 Y2gtYWx0ZXJuYXRpdmVzKSkKZGlmZiAtLWdpdCBhL3Rlc3QvbGlzcC93aWQtZWRpdC10ZXN0 cy5lbCBiL3Rlc3QvbGlzcC93aWQtZWRpdC10ZXN0cy5lbAppbmRleCBlYmZlNzI5YmM5YS4u NjZiZmY0YWQyZTMgMTAwNjQ0Ci0tLSBhL3Rlc3QvbGlzcC93aWQtZWRpdC10ZXN0cy5lbAor KysgYi90ZXN0L2xpc3Avd2lkLWVkaXQtdGVzdHMuZWwKQEAgLTM4MCw0ICszODAsMTUgQEAg d2lkZ2V0LXRlc3QtYWxpc3QtZGVmYXVsdC12YWx1ZS00CiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICA6dmFsdWUgKCgiMSIgLiAxKSAoIjIiIC4gMikpKSkpKQogICAg ICAgKHNob3VsZCAoZXF1YWwgJygoIjEiIC4gMSkgKCIyIiAuIDIpKSAod2lkZ2V0LWRlZmF1 bHQtZ2V0IHcpKSkpKSkKIAorKGVydC1kZWZ0ZXN0IHdpZGdldC10ZXN0LXJlc3RyaWN0ZWQt c2V4cC1lbXB0eS12YWwgKCkKKyAgIlRlc3QgdGhhdCB3ZSBoYW5kbGUgYW4gZW1wdHkgcmVz dHJpY3RlZC1zZXhwIHdpZGdldCBqdXN0IGZpbmUuIgorICAod2l0aC10ZW1wLWJ1ZmZlcgor ICAgIChsZXQgKCh3ICh3aWRnZXQtY3JlYXRlICcocmVzdHJpY3RlZC1zZXhwCisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICA6dmFsdWUgMworICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgOm1hdGNoLWFsdGVybmF0aXZlcyAoaW50ZWdlcnApKSkpKQorICAgICAgKHdp ZGdldC1zZXR1cCkKKyAgICAgICh3aWRnZXQtYmFja3dhcmQgMSkKKyAgICAgIChkZWxldGUt Y2hhciAxKQorICAgICAgKHNob3VsZCAoc3RyaW5nPSAod2lkZ2V0LXZhbHVlIHcpICIiKSkp KSkKKwogOzs7IHdpZC1lZGl0LXRlc3RzLmVsIGVuZHMgaGVyZQotLSAKMi4zNC4xCgo= --------------0VAzpyBDol2bjq1okHQg6J5r-- From unknown Mon Jun 23 07:52:08 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Marco Antoniotti Subject: bug#63838: closed (Re: bug#63838: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets.) Message-ID: References: <83o7i2igmw.fsf@gnu.org> X-Gnu-PR-Message: they-closed 63838 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 63838@debbugs.gnu.org Date: Sat, 16 Sep 2023 09:59:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1694858342-12486-1" This is a multi-part message in MIME format... ------------=_1694858342-12486-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #63838: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets. which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 63838@debbugs.gnu.org. --=20 63838: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D63838 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1694858342-12486-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 63838-done) by debbugs.gnu.org; 16 Sep 2023 09:58:50 +0000 Received: from localhost ([127.0.0.1]:45412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhS4g-0003F1-5m for submit@debbugs.gnu.org; Sat, 16 Sep 2023 05:58:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42228) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhS4e-0003Ep-ME for 63838-done@debbugs.gnu.org; Sat, 16 Sep 2023 05:58:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhS4S-0003zs-9r; Sat, 16 Sep 2023 05:58:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=XcJNIvBdA5dJl+G6RvRp1lfIF1dZd34LdaBi6rZdLJk=; b=TqrXbyjbviGa 4obK0Eun0RpHpL2PR3wvIIasDuyR1DG/dusvcemH3l5mkfFP57jYqPto48Vn2E69sMpQU8Q5Ld1gZ c1oz3pnYb+3HPUCnYtDxuyL1+Gb08MPZ7rAzf+RbyQ93QqYydsYoePOln9gpqjGqElGL4WW19/mdP Rs00O3sVJ/RD/uUECST42lcxlbr/5AZCVdvEglb5jAjKDrAQjOKcQruYjlrm9yGH1PeMCk4gUMk+L IIvBGwGrcm9h+2GGTm0YCqvLEQxLw6mxGJEV5NoyoSNDOTR3sr8nIaWfSesjNfBZTxvsavj6upTPu 3m9PlN9OBVktB9mZBxBdNw==; Date: Sat, 16 Sep 2023 12:58:31 +0300 Message-Id: <83o7i2igmw.fsf@gnu.org> From: Eli Zaretskii To: Mauro Aranda In-Reply-To: <93b7830c-edd5-3462-bdbd-2fd18c1fdb0f@gmail.com> (message from Mauro Aranda on Sat, 9 Sep 2023 12:13:53 -0300) Subject: Re: bug#63838: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets. References: <174623a9-45bf-10d1-8b59-cb5b816026bc@gmail.com> <93b7830c-edd5-3462-bdbd-2fd18c1fdb0f@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 63838-done Cc: marcoxa@gmail.com, 63838-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: Marco Antoniotti > Date: Sat, 9 Sep 2023 12:13:53 -0300 > From: Mauro Aranda > > I attach a patch to handle an empty restricted sexp widget, together > with a test. Thanks, installed on the master branch, and closing the bug. ------------=_1694858342-12486-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 2 Jun 2023 11:12:56 +0000 Received: from localhost ([127.0.0.1]:39155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q52iE-0006Vl-RH for submit@debbugs.gnu.org; Fri, 02 Jun 2023 07:12:55 -0400 Received: from lists.gnu.org ([209.51.188.17]:57950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q51Pa-0004AF-Ey for submit@debbugs.gnu.org; Fri, 02 Jun 2023 05:49:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q51PV-0006eY-Nu for bug-gnu-emacs@gnu.org; Fri, 02 Jun 2023 05:49:30 -0400 Received: from mail-yb1-xb2b.google.com ([2607:f8b0:4864:20::b2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q51PQ-0003cV-Gh for bug-gnu-emacs@gnu.org; Fri, 02 Jun 2023 05:49:29 -0400 Received: by mail-yb1-xb2b.google.com with SMTP id 3f1490d57ef6-bacf5b89da7so1996842276.2 for ; Fri, 02 Jun 2023 02:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685699362; x=1688291362; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=jTLfnyfbSv5JFAltc2uxAb8Kj4ejK1tfOrXXFUP+MHE=; b=kWqhzqxjm1aZuhaSyazYXTxZvt+cFAcoeJGUL/INGE7SHmV3xTSULcqWsZ0GQzzYEu sYvu6ahlH7HAKP9ORggcLFrHjvCGbEWxa2bz949uTL3rzs65Z+5XQlR+wCBhR8Ckc8T2 T+Qs1F64k7MD6Fy/9c/eAgDS6ioroFW+DQPv/TDTbQeayi+gUTotwSeVvFa9k4jVinnT DaVWPjDftkxY4+QWQdGHnXZEXhgej1qUQpKSgepIGE/0Gut93gn+tBhHrIXCK8Z9ZD++ Jk3YHdYPLCMrDb1nkAnlyrIl604MI1mG5P5barsMR76Lj+GfsCKEqDLP4flR6sUaCb66 616Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685699362; x=1688291362; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jTLfnyfbSv5JFAltc2uxAb8Kj4ejK1tfOrXXFUP+MHE=; b=EZlf3RByYIGkinhSxv2hSvnzdCtGabJKu5ZsxLNkmtxZ7Ru5Ats9EkoHEAK5KYEBTW ULdX7uJl5QonTnDVduE530ykE7gqIthQ+BtYJVCmyggdoUpwoc0LU5342LdKiR5apcVZ NJaTzmIZvg5xJCHWZnLnhoOFupU0nYukCWJe1nbyyQB3bWz+Y2dkPyz+ZEsDMsGzsH1Y UZOCXU+3zxPaUe3r1XIlT8c5t1Qz8GUb6oZQl5Qy3D9RFbMA6t1AILn7M+k+MQE+xArs dWA6x7odYxAkg943LzfGL21Ydj9lL5uRLBD/ka9k9ALOtuAZvQnSzuwtpxu9LjZDADKy OsCQ== X-Gm-Message-State: AC+VfDxlYbi6BX48xjhMA+BMG1g4EvoDLfTdpDEqgNrWkolqL0NHIDKm utZGN9pL9A+tcGUyctWD3qBmsaK5H7/2Xka4lo0bXLuivf7XXQ== X-Google-Smtp-Source: ACHHUZ5gFj3LhztaPvxhwPlkuzUROJXYD/p/m9GELJePL7gb0cJo2SPFidZ5vEPem9kOirrqNKlgIxcog+StPUvaCWw= X-Received: by 2002:a25:a2c1:0:b0:ba8:89bf:b3e5 with SMTP id c1-20020a25a2c1000000b00ba889bfb3e5mr2376868ybn.10.1685699361995; Fri, 02 Jun 2023 02:49:21 -0700 (PDT) MIME-Version: 1.0 From: Marco Antoniotti Date: Fri, 2 Jun 2023 11:49:10 +0200 Message-ID: Subject: 28.2; 'wid-edit.el' problems with 'integer' (and 'sexp') widgets. To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="000000000000ab80ba05fd227794" Received-SPF: pass client-ip=2607:f8b0:4864:20::b2b; envelope-from=marcoxa@gmail.com; helo=mail-yb1-xb2b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 02 Jun 2023 07:12:53 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000ab80ba05fd227794 Content-Type: text/plain; charset="UTF-8" Hi The issue is with the following code that tries to use the Widget library. The slots of the widget are actually not necessary to see the problem. (widget-create 'integer :help-echo "Enter an integer..." :notify (lambda (w1 &rest ws) (ignore ws) (message "WIFT: IF: %s" (widget-value w1) )) :size 4 ) If you set up a widget buffer, the field will appear as expected with a 0 as initial value. The problem starts if you try to clear the field and then enter a new value, say by hitting C-k, and the problem is in the :value-to-external functions in the in sexp and restricted-sexp widgets (the number, float and natnum widgets must also be fixed). The library :value-to-external functions eventually do a (read value) where value is the widget value; alas, value can be "" if you edit the field in a pretty standard way, as, as I said above, if you had tried to kill the field line (C-k); this causes the traditional minor demons to fly out of the nose, as a 'End of file during parsing' error gets signaled. After that, the buffer with the widgets is pretty much in a random state. Specializing the widget with a hack like the function below fixes the problem, but a good solution may need some more work to get all the corner cases. Note that setting a "widget buffer" in overwrite mode goes a long way to mitigate these problems: maybe having widget-setup switch to it would be another good thing to do. :value-to-external (lambda (widget value) ;; Lifted, and fixed, from `:value-to-external' in ;; `restricted-sexp'. (unless (stringp value) (display-warning 'widget-bad-default-value (format-message "\nA widget of type %S has a bad default value. value: %S match function: %S match-alternatives: %S" (widget-type widget) value (widget-get widget :match) (widget-get widget :match-alternatives)) :warning)) (if (and (stringp value) (string-equal "" value)) ;; Oooops, we cannot just `read'. (widget-get widget :default-value) (read value)) ) Note: this goes back, at least, to 25.x. Thanks for the attention Marco Antoniotti In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13 built on AVALON Windowing system distributor 'Microsoft Corp.', version 10.0.22621 System Description: Microsoft Windows 10 Pro (v10.0.2009.22621.1778) Configured using: 'configure --with-modules --without-dbus --with-native-compilation --without-compress-install CFLAGS=-O2' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XPM ZLIB (NATIVE_COMP present but libgccjit not available) Important settings: value of $LANG: ENG locale-coding-system: cp1252 Major mode: Fundamental Minor modes in effect: tooltip-mode: t global-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 blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util rmail rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date wombat-theme finder-inf tex-site epg rfc6068 epg-config gnu-elpa-keyring-update slime-autoloads rx info package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win 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 hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 246351 7879) (symbols 48 14548 1) (strings 32 84982 2407) (string-bytes 1 2218067) (vectors 16 24066) (vector-slots 8 414464 16368) (floats 8 28 222) (intervals 56 377 9) (buffers 992 12)) -- Marco Antoniotti Somewhere over the Rainbow --000000000000ab80ba05fd227794 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

The issue is with the following code that tries = to use the Widget
library.=C2=A0 The slots of the widget are actually no= t necessary to see the problem.

=C2=A0(widget-create 'integer
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 :help-echo "Ent= er an integer..."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 :notify (lambda (w1 &rest ws)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 (ignore w= s)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 (message "WIFT: IF: %s"
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (widget-value w1)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0=C2=A0 ))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 :size 4
=C2=A0 )


If you set u= p a widget buffer, the field will appear as expected with a 0 as initial va= lue.=C2=A0 The problem starts if you try to clear the field and then enter = a new value, say by hitting C-k, and the problem is in the :value-t= o-external functions in the in sexp and restricted-sexp widgets (the number, float and natnum widgets must also be fixed).

=
The library :value-to-external functions eventually do a (read= value) where value is = the widget value; alas, value = can be "" if you edi= t the field in a pretty standard way, as, as I said above, if you had tried= to kill the field line (C-k);= this causes the traditional minor demons to fly out of the nose, as a '= ;End of file during parsing' error gets signaled.=C2=A0 After that, the= buffer with the widgets is pretty much in a random state.
Specializing the widget with a hack like the function below fi= xes the problem, but a
good solution may need some more work to g= et all the corner cases.=C2=A0 Note that setting a "widget buffer"= ; in overwrite mode goes a long way to mitigate these problems: maybe havin= g widget-setup switch to it wo= uld be another good thing to do.

=C2=A0 :value-to-external
=C2=A0 (lambda (widget va= lue)
=C2=A0=C2=A0=C2=A0 ;; Lifted, and fixed, from `:value-to-external&#= 39; in
=C2=A0=C2=A0=C2=A0 ;; `restricted-sexp'.

=C2=A0=C2=A0= =C2=A0 (unless (stringp value)
=C2=A0 =C2=A0=C2=A0=C2=A0 (display-warnin= g
=C2=A0 =C2=A0 =C2=A0=C2=A0 'widget-bad-default-value
=C2=A0 =C2= =A0 =C2=A0=C2=A0 (format-message
=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 "= \nA widget of type %S has a bad default value.
value: %S
match functi= on: %S
match-alternatives: %S"
=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 = (widget-type widget)
=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 value
=C2=A0 = =C2=A0 =C2=A0=C2=A0=C2=A0 (widget-get widget :match)
=C2=A0 =C2=A0 =C2= =A0=C2=A0=C2=A0 (widget-get widget :match-alternatives))
=C2=A0 =C2=A0 = =C2=A0=C2=A0 :warning))
=C2=A0=C2=A0=C2=A0 (if (and (stringp value) (str= ing-equal "" value))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Oooops, we= cannot just `read'.
=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 (widget-get wi= dget :default-value)
=C2=A0 =C2=A0=C2=A0=C2=A0 (read value))
=C2=A0= =C2=A0=C2=A0 )

Note: this goes back, at lea= st, to 25.x.

Thanks for the attention
Marco Antoniotti



<= /div>


In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
=C2=A0of 2022-09-13 b= uilt on AVALON
Windowing system distributor 'Microsoft Corp.', v= ersion 10.0.22621
System Description: Microsoft Windows 10 Pro (v10.0.20= 09.22621.1778)

Configured using:
=C2=A0'configure --with-modu= les --without-dbus --with-native-compilation
=C2=A0--without-compress-in= stall CFLAGS=3D-O2'

Configured features:
ACL GIF GMP GNUTLS H= ARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDU= MPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
XPM ZLIB

(NA= TIVE_COMP present but libgccjit not available)

Important settings:=C2=A0 value of $LANG: ENG
=C2=A0 locale-coding-system: cp1252

= Major mode: Fundamental

Minor modes in effect:
=C2=A0 tooltip-mod= e: t
=C2=A0 global-eldoc-mode: t
=C2=A0 show-paren-mode: t
=C2=A0 = electric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mo= de: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2= =A0 global-font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-= composition-mode: t
=C2=A0 auto-encryption-mode: t
=C2=A0 auto-compre= ssion-mode: t
=C2=A0 buffer-read-only: t
=C2=A0 line-number-mode: t=C2=A0 transient-mark-mode: t

Features:
(shadow sort mail-extr = emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa de= rived gnus-util rmail rmail-loaddefs
text-property-search mm-decode mm-b= odies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendm= ail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date w= ombat-theme finder-inf tex-site
epg rfc6068 epg-config gnu-elpa-keyring-= update slime-autoloads rx info
package browse-url url url-proxy url-priv= acy url-expand url-methods
url-history url-cookie url-domsuf url-util ma= ilcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs= eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt gv = bytecomp
byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc = paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode m= wheel
dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/comm= on-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list repla= ce
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-b= ar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lockfont-lock syntax font-core term/tty-colors frame minibuffer cl-genericcham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet laokorean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
eur= opean ethiopic indian cyrillic chinese composite emoji-zwj charscript
ch= arprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-p= reloaded nadvice button loaddefs faces cus-face macroexp files
window te= xt-properties overlay sha1 md5 base64 format env code-pages
mule custom = widget hashtable-print-readable backquote threads w32notify
w32 lcms2 mu= lti-tty make-network-process native-compile emacs)

Memory informatio= n:
((conses 16 246351 7879)
=C2=A0(symbols 48 14548 1)
=C2=A0(stri= ngs 32 84982 2407)
=C2=A0(string-bytes 1 2218067)
=C2=A0(vectors 16 2= 4066)
=C2=A0(vector-slots 8 414464 16368)
=C2=A0(floats 8 28 222)
= =C2=A0(intervals 56 377 9)
=C2=A0(buffers 992 12))

=

--
Marco Antoniotti
Somewhere over the Rainbo= w
--000000000000ab80ba05fd227794-- ------------=_1694858342-12486-1--