From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73178: 31.0.50; [PATCH] Improve the widget to customize icon Date: Thu, 09 Jan 2025 09:07:53 +0200 Message-ID: <86ed1c31o6.fsf@gnu.org> References: <53eb31f5-e95d-48c9-a04a-c951a3a057a7@orange.fr> <8cc723b7-c6c5-450d-9832-9039362d63a5@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5984"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73178@debbugs.gnu.org To: da_vid@orange.fr, Mauro Aranda Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 09 08:09:27 2025 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 1tVmfV-0001MG-Ct for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 09 Jan 2025 08:09:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVmf9-0001JX-Ns; Thu, 09 Jan 2025 02:09:03 -0500 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 1tVmf8-0001JO-Me for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 02:09:02 -0500 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 1tVmf8-0002zM-D1 for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 02:09:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=mF3nlXDNjGRi795QTgEq0SnCcXWfm3pBeZNVWj3q4Gs=; b=c2pIZaQbIBvuOzLBT3WOjtXAveV2JVvxBo3NlD/HAJQuhaWPVwbMCy8pTGoMfZjYQCNXwZS6s0fOY/hdl6B5huLX2wl3cWTB/0W9nkmdH6EtvBtf+dBCSzOYTAwgoYMxEn93+PovHt0gYfKUodWk0GgbVgWh+56Jx/rQH37cK4fcENkG7BhJ7Bdq0mh5ijcXJLZoU7hnVtMFVojew++8KQR+dwZZVbZLNfg2FnIOqbV9sdOU/uIyp+9wmoEewbG59vdVTyCNUnqGkOuE2PVFKiD9QK7qwYhAmgrZBWXjwtIIWiIaI7IYx05boV06vf3eHha3sSr8t1LfxT+kxMjEjA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVmf8-00060a-7W for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2025 02:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Jan 2025 07:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73178 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73178-submit@debbugs.gnu.org id=B73178.173640648623025 (code B ref 73178); Thu, 09 Jan 2025 07:09:02 +0000 Original-Received: (at 73178) by debbugs.gnu.org; 9 Jan 2025 07:08:06 +0000 Original-Received: from localhost ([127.0.0.1]:50165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVmeD-0005zI-RC for submit@debbugs.gnu.org; Thu, 09 Jan 2025 02:08:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46756) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVmeB-0005yn-Oy for 73178@debbugs.gnu.org; Thu, 09 Jan 2025 02:08:04 -0500 Original-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 1tVme5-0002ui-Hu; Thu, 09 Jan 2025 02:07:57 -0500 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=mF3nlXDNjGRi795QTgEq0SnCcXWfm3pBeZNVWj3q4Gs=; b=DP+ayYl9vcgk bbyuTVq4prmGW8f4WB/l3rc9WB/qdhmRpZmE7H28M6QSMl1SC/+6Dk/yl0OdXzq1rDcjWyihRe0Hl lTfDg/uf2K+ebF4Otxhsfs0Dj6WBKl5KiqmpZPEAXKONm8SYr1zNvcSZcwJYHqTPwD9QPXKQJLW1y obyZlZ+FiS6vfJZ3q0Wm7ecqfpgP9odsQFuRXZkHcoI1WItbVdFj6BuTvm6iy76oHfF8PQ5yJc4jw xdEc3af6XsO3ZmsDYj/pGYNh4KoXqLDKHEq8BUbkDiB3kORvPKjvBfLy9aVCMMv7l7/691wUzhPp1 1PeNhSX/krLRY+hGJTXc4g==; In-Reply-To: <8cc723b7-c6c5-450d-9832-9039362d63a5@gmail.com> (message from Mauro Aranda on Wed, 8 Jan 2025 10:59:27 -0300) 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:298804 Archived-At: > Date: Wed, 8 Jan 2025 10:59:27 -0300 > Cc: Eli Zaretskii > From: Mauro Aranda > > David Ponce writes: > > > On 11/09/2024 5:19 PM, David Ponce wrote: > >> Attached the correct patch. > >> Sorry > > Should be the good one this time. > > Sorry again. > > > > diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el > > index 3ab5f11532e..fd790b18630 100644 > > --- a/lisp/cus-edit.el > > +++ b/lisp/cus-edit.el > > @@ -5525,6 +5525,53 @@ custom-icon-extended-menu > > "A menu for `custom-icon' widgets. > > Used in `custom-icon-action' to show a menu to the user.") > > > > +(defconst custom-icon--images-sub-type > > + '(list :format "%{%t%}:\n%v\n" > > + :tag "Images" > > + (const :tag "" image) > > + (repeat :tag "Values" > > + (string :tag "Image filename")) > > + (plist :tag "Image attributes"))) > > + > > +(defconst custom-icon--emojis-sub-type > > + '(list :format "%{%t%}:\n%v\n" > > + :tag "Colorful Emojis" > > + (const :tag "" emoji) > > + (repeat :tag "Values" > > + (string :tag "Emoji text")) > > + (plist :tag "Emoji text properties"))) > > + > > +(defconst custom-icon--symbols-sub-type > > + '(list :format "%{%t%}:\n%v\n" > > + :tag "Monochrome Symbols" > > + (const :tag "" symbol) > > + (repeat :tag "Values" > > + (string :tag "Symbol text")) > > + (plist :tag "Symbol text properties"))) > > + > > +(defconst custom-icon--texts-sub-type > > + '(list :format "%{%t%}:\n%v\n" > > + :tag "Texts Only" > > + (const :tag "" text) > > + (repeat :tag "Values" > > + (string :tag "Text")) > > + (plist :tag "Text properties"))) > > + > > +(defconst custom-icon--type > > + `(repeat :format ,(concat "%{%t%}" > > + (propertize ":" 'display "") > > + "\n\n%v%i\n") > > + :tag "Icon elements: > > +- Only the first occurrence of a same element counts. > > +- Missing elements will take their default value. > > +- At least one element should be provided with a valid value." > > + (choice :void ,custom-icon--texts-sub-type > > + :extra-offset -3 > > + ,custom-icon--images-sub-type > > + ,custom-icon--emojis-sub-type > > + ,custom-icon--symbols-sub-type > > + ,custom-icon--texts-sub-type))) > > + > > (defun custom-icon-value-create (widget) > > "Here is where you edit the icon's specification." > > (custom-load-widget widget) > > @@ -5535,13 +5582,7 @@ custom-icon-value-create > > (form (widget-get widget :custom-form)) > > (symbol (widget-get widget :value)) > > (tag (widget-get widget :tag)) > > - (type '(repeat > > - (list (choice (const :tag "Images" image) > > - (const :tag "Colorful Emojis" emoji) > > - (const :tag "Monochrome Symbols" symbol) > > - (const :tag "Text Only" text)) > > - (repeat string) > > - plist))) > > + (type custom-icon--type) > > (prefix (widget-get widget :custom-prefix)) > > (last (widget-get widget :custom-last)) > > (style (widget-get widget :custom-style)) > > I think this is an improvement. Thanks David. Thanks for the review. I wanted to install this, but byte-compiler produces a warning: ELC cus-edit.elc In toplevel form: cus-edit.el:5595:20: Warning: reference to free variable `custom-icon--texts-widget' Is that a typo, and you actually meant custom-icon--texts-sub-type? Also, could you please accompany the patch with the ChangeLog-style commit log message (see CONTRIBUTE for the details)? Otherwise, I will have to write the log message manually when installing your changes. Thanks.