From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#64046: 30.0.50; Quoting in customize choice tags Date: Thu, 24 Aug 2023 15:19:32 +0200 Message-ID: <87bkewpogr.fsf@gmx.net> References: <8ca48b5a-1619-8da8-ae3a-6ae96351a19d@gmail.com> <87v8eelh2s.fsf@gmx.net> <87r0p2l5pp.fsf@gmx.net> <27a78233-5758-c03e-e3a2-342d194d1448@gmail.com> <87fs48ppr8.fsf@gmx.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4379"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Ola x Nilsson , 64046@debbugs.gnu.org To: Mauro Aranda Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 24 15:20:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qZAG1-0000sU-W0 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Aug 2023 15:20:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZAFm-0002Gw-57; Thu, 24 Aug 2023 09:20:02 -0400 Original-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 1qZAFj-0002FI-BG for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 09:19:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZAFj-0002xm-3A for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 09:19:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qZAFm-0005YU-CG for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2023 09:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Aug 2023 13:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64046 X-GNU-PR-Package: emacs Original-Received: via spool by 64046-submit@debbugs.gnu.org id=B64046.169288318821328 (code B ref 64046); Thu, 24 Aug 2023 13:20:02 +0000 Original-Received: (at 64046) by debbugs.gnu.org; 24 Aug 2023 13:19:48 +0000 Original-Received: from localhost ([127.0.0.1]:36360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZAFX-0005Xw-U0 for submit@debbugs.gnu.org; Thu, 24 Aug 2023 09:19:48 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:58057) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qZAFW-0005Xi-6F for 64046@debbugs.gnu.org; Thu, 24 Aug 2023 09:19:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1692883173; x=1693487973; i=stephen.berman@gmx.net; bh=s/geuYW01SBf0uQvjcyaIvq7Jg3Z31AAWaUDAtMEFv0=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=bGGf79U2FAtqsYyIkblkwS0NMDeh8oy2Kzsn9xJififTGAG9y0TGlGnSqLeo0+8xZ1bvrNn 2d7CsFlrMHK4F4oiBcyHPFnK4zJ5tIj+FxMYE9hCp3XpG48PSJwUdPVDy9NRKmXQDjRAilV9b BsRtSuPEo9EX2BG3J5F4EPniUdRb6iZ+F1dPJtbY2N83RMEKqRQOXZALrjKt6RcZqCqmI7LK9 2955wHth+1/vcDyl+kveM9ExRpURnn7Yzd8ad5M7erv5GQXltNTl0TVvTP91tN4H1KxXKkmgo 0V6pZcwDiSjqEv1ABPeHhEwjy7JYUQLiWct1vaIGPY3lKB3Kklmg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from strobelfssd ([89.246.37.172]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MCbIx-1qPZrC0yoN-009k81; Thu, 24 Aug 2023 15:19:33 +0200 In-Reply-To: <87fs48ppr8.fsf@gmx.net> (Stephen Berman's message of "Thu, 24 Aug 2023 14:51:39 +0200") X-Provags-ID: V03:K1:FviFTcOpyu9NZfQN8FNhHR6kLTqo3amKU6aycrTt6+qdaDpPEZd YmnoDMloo7ntxmx4ovQjDv4+GsDeBsGCqgg9YeFOI6rnw+iTZdSLSG/7y4a7UrcokK5diHx jFgYpeeVN7qkxOtLBKoDXAUvKE/dANm3hbDc0dBqlJUd3xKgXkkgoO9A+v5NUsZtReRpQXS MX3UasqPsHS4klrDx6dCg== UI-OutboundReport: notjunk:1;M01:P0:kmbWAGZFOn0=;4FwjOnI5MxqSzE4ZX46wksGciCl DCalz6UNCo0KLLWzvXM3pY5vmkYYxSrDe8SNFDojjxekqFe6REZhaag3mLahN+SUoVICOgvJu 9E7dOZ7F9pfcGH0YuCiUq+K9OqjS7PjJEP0U4XIm1mLUr5fDCdy+lA8NdnLIGx1vySZuxUk7j QhkvtpLWtxPR8Ie5Ud7GcNBfEbX1yOc7EAEl/i/3hySZily+rVmMC42EXt1P4jDai4pDYFzok Ghh+c8ia6ilMr/VFKMjvduwSQcLBYh38KLiSfsNn+inm4POx5/hzPa3AfogqTmmj+ht6kkJP8 Evmy1S2KACaDGaNFayHxBlGeqMrWwRSnWCvw9zkdnRCbXA56x7chdk8ff/kuydnbIg5+FgjtJ xkw/rFVHUJebJf/deCTqYwFneyE/XiLmu+H0jG4xZNeimkgyK+f+A9NBsbFUPD90Pn91XRBQ5 NfMt64YWIxIHTq4NAgZI0rDb3sBfKlo3IjMYoQKf6YF6lVUhU1k2mFpaR20bLbWKEf3/K0mFS tSmk2HKmSn94fPfzjWh9dOEG+e4Dz0z5kiooKVhnpIAp9ZHbyaiZJghYanV++mi/1LfVSvzG+ 2YOi+bRxw6NgB9FFZ3wtDStZDO8dQ82rF3RplpWhnppVzycBdrUaXENlWvtb004otYr89QT+s Nc/7+CbALtTXahfmvp+mpo2v3MIyL34ai/HonzLnDiuqJ+clSh3pho2MrpAaS8WxKPjlRauit FEJFUaZaEsz2LalB2LOZfC2Xg5RSJL7XlnJEQiHlq4HOJOHB/+xY4ByfULg+7lF2tVoDsJhK X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268335 Archived-At: --=-=-= Content-Type: text/plain On Thu, 24 Aug 2023 14:51:39 +0200 Stephen Berman wrote: > On Mon, 21 Aug 2023 11:51:36 -0300 Mauro Aranda wrote: > >> Ola x Nilsson writes: > [...] >>> I think I ran into another problem with the change. >>> Using the simple item definitions (described in the docstring), this >>> call >>> >>> (widget-choose "Title" '(("Option1" . "Foo") ("Option 2" . "Bar"))) >>> >>> will fail with >>> >>> (wrong-type-argument (listp "Foo")) >> >> Thanks for reporting this. >> >>> Or did I misunderstand how that mode works? >> >> I think your recipe should work, and it worked before. >> >> Hopefully Stephen can take a look at it. > > Thanks for reporting this regression. The following patch, which tests > for proper-list-p instead of consp, fixes the above case and still > applies substitute-command-keys correctly in the other cases brought up > in this bug: > > diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el > index a70598bb6c9..6b4446a0be8 100644 > --- a/lisp/wid-edit.el > +++ b/lisp/wid-edit.el > @@ -285,7 +285,7 @@ widget-choose > ;; Apply quote substitution to customize choice menu item text, > ;; whether it occurs in a widget buffer or in a popup menu. > (let ((items (mapc (lambda (x) > - (when (consp x) > + (when (proper-list-p x) > (dotimes (i (1- (length x))) > (when (stringp (nth i x)) > (setcar (nthcdr i x) > > > However, if the car and cdr of the simple items are strings containing > grave-style quoting, e.g. as in the following: > > (widget-choose "Title" '(("Use `a'" . "Use `a'") ("Use `b'" . "Use `b'"))) > > and this quoting is supposed to appear on evaluation as curve-style, > then something like the following patch seems to be required: > > diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el > index a70598bb6c9..40d7b5b902c 100644 > --- a/lisp/wid-edit.el > +++ b/lisp/wid-edit.el > @@ -285,12 +285,17 @@ widget-choose > ;; Apply quote substitution to customize choice menu item text, > ;; whether it occurs in a widget buffer or in a popup menu. > (let ((items (mapc (lambda (x) > - (when (consp x) > - (dotimes (i (1- (length x))) > - (when (stringp (nth i x)) > - (setcar (nthcdr i x) > - (substitute-command-keys > - (car (nthcdr i x)))))))) > + (if (proper-list-p x) > + (dotimes (i (1- (length x))) > + (when (stringp (nth i x)) > + (setcar (nthcdr i x) > + (substitute-command-keys > + (car (nthcdr i x)))))) > + ;; ITEMS has simple item definitions. > + (when (and (consp x) (stringp (car x)) > + (stringp (cdr x))) > + (setcar x (substitute-command-keys (car x))) > + (setcdr x (substitute-command-keys (cdr x)))))) > items))) > (cond ((and (< (length items) widget-menu-max-size) > event (display-popup-menus-p)) > > > I don't see any obvious problem with this, but I'm not sure. Right after sending, I found an obvious problem: only one of the car or the cdr might be a string. The following patch accounts for this: --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: widget-choose patch #2 diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index a70598bb6c9..891e98b6de5 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -285,12 +285,18 @@ widget-choose ;; Apply quote substitution to customize choice menu item text, ;; whether it occurs in a widget buffer or in a popup menu. (let ((items (mapc (lambda (x) - (when (consp x) - (dotimes (i (1- (length x))) - (when (stringp (nth i x)) - (setcar (nthcdr i x) - (substitute-command-keys - (car (nthcdr i x)))))))) + (if (proper-list-p x) + (dotimes (i (1- (length x))) + (when (stringp (nth i x)) + (setcar (nthcdr i x) + (substitute-command-keys + (car (nthcdr i x)))))) + ;; ITEMS has simple item definitions. + (when (consp x) + (when (stringp (car x)) + (setcar x (substitute-command-keys (car x)))) + (when (stringp (cdr x)) + (setcdr x (substitute-command-keys (cdr x))))))) items))) (cond ((and (< (length items) widget-menu-max-size) event (display-popup-menus-p)) --=-=-= Content-Type: text/plain Steve Berman --=-=-=--