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: Sat, 14 Sep 2024 12:51:50 +0300 Message-ID: <86frq2h8ax.fsf@gnu.org> References: <4cd4a62c-6642-49a3-8b2c-5eda13ac79af@orange.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39422"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73178@debbugs.gnu.org To: David Ponce , Mauro Aranda Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 14 11:53:15 2024 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 1spPSs-000A1j-MO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 14 Sep 2024 11:53:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spPSY-0004Zd-CI; Sat, 14 Sep 2024 05:52:54 -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 1spPSW-0004Z2-Pl for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2024 05:52:52 -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 1spPSW-00014c-Fp for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2024 05:52:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=VIejcSj3PIgtp/yQfJO9Q7HOm6wx1DCVxKSb/Tf2ISo=; b=CHflfhLQPo1KSENBbySug/FJABa54srh2/exe07dFzHcykZCDAXH8DGjyIwFaQ9uDhCyJ1vbYoPUOBbj0m5ryU8qZWcylOP5PaTB+lYaPGjB3q54YYRBVeFWbYrleEk0ULpm91c9M/PRAkmBdP9XxvKGjpX4GE033051z9Vc2kv0BumRaNhbMRjqfxd6ZBnJQF10nAJRcO2aURml/yz/YLQyX6otWFJB12FDGfwrI/+wpYXD2uBVNFet34gM5GhmDUMkRNoeSz1r+l+Y1+wJVn4gVDjzjYnoJI7xWn2VaTmulCtKCMHIBWVq7RNwiNhVacrFM2sfeeWCp0aSuY5GeA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1spPSg-00028s-87 for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2024 05:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Sep 2024 09:53: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.17263075318134 (code B ref 73178); Sat, 14 Sep 2024 09:53:02 +0000 Original-Received: (at 73178) by debbugs.gnu.org; 14 Sep 2024 09:52:11 +0000 Original-Received: from localhost ([127.0.0.1]:44851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spPRq-000277-Ex for submit@debbugs.gnu.org; Sat, 14 Sep 2024 05:52:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spPRo-00026s-8L for 73178@debbugs.gnu.org; Sat, 14 Sep 2024 05:52:08 -0400 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 1spPRY-00011I-2f; Sat, 14 Sep 2024 05:51:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=VIejcSj3PIgtp/yQfJO9Q7HOm6wx1DCVxKSb/Tf2ISo=; b=CQE/I8tow5bpmB3VTKg9 cu6vy4Kx025u/FBOZZiyYFEjUARMkxWO/JqB2zZUPRKRuVt7/DumZq11husyU/oxSQ67nMwlklZ0g ddkyxjs9E3I8d7lVAo7rlFbDOUzGPqejt1+srlCNLoIBA4T40fC9tgqcd6Zn57gmfhy8nnBFHm+hI IfI5kmeoJHPXBsou6A5UgSMJ6bjd9kfBRwNtss/yReMc0y+p2+yuYBazhhbDLqOsvBUWrRWHL3sN3 0aqgO6lBE9RkZaMSnGVAz1xnIfSt/2XyXptqiloXbewjNOSKKXtMR4ncOV4BPNDohhVD/LWpUWvGF LGGRM6UCBt0GMA==; In-Reply-To: <4cd4a62c-6642-49a3-8b2c-5eda13ac79af@orange.fr> (bug-gnu-emacs@gnu.org) 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:291722 Archived-At: > Date: Wed, 11 Sep 2024 16:28:24 +0200 > From: David Ponce via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Whenever I try to use Emacs' built-in icons, I have some difficulty > understanding the user interface for customizing an icon. For example, > regardless of the type of icon element, all the fields have similar > labels, which makes the interface difficult to understand and use. > For instance, for Images, it is not clear that the String field is > intended to enter the image file name: > > Choice: Value Menu [Images|Colorful Emojis|Monochrome Symbols|Text only] > Repeat: > INS DEL String: > INS > Plist: > INS DEL : > Key: > Value: > INS > > Also, nothing guides you regarding usage of this complex widget. > > I propose the attached patch that improves the widget used to > customize an icon. Possible ChangeLog: > > 2024-09-11 David Ponce > > Improve usability of the widget used to customize icon. > > * lisp/cus-edit.el (custom-icon--images-sub-type) > (custom-icon--emojis-sub-type, custom-icon--symbols-sub-type) > (custom-icon--texts-sub-type): New constant. > (custom-icon--type): New constant. > (custom-icon-value-create): Use it. > > With this patch, a quick help summarizes usage, and the different > fields are named according to the kind of icon element. > > Here is a view of the new UI when customizing the default `button' icon: > > --------------------------------------------------------------- > Hide Button: > 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. > > INS DEL Choice: Value Menu Images: > > Values: > INS DEL Image filename: > INS > Image attributes: > INS DEL : > Key: :face > Value: icon-button > INS > > INS DEL Choice: Value Menu Colorful Emojis: > > Values: > INS DEL Emoji text: 🔵 > INS > Emoji text properties: > INS DEL : > Key: :face > Value: icon > INS > > INS DEL Choice: Value Menu Monochrome Symbols: > > Values: > INS DEL Symbol text: ● > INS > Symbol text properties: > INS DEL : > Key: :face > Value: icon-button > INS > > INS DEL Choice: Value Menu Texts Only: > > Values: > INS DEL Text: button > INS > Text properties: > INS DEL : > Key: :face > Value: icon-button > INS > > INS > --------------------------------------------------------------- > > WDYT? > > Thanks! Thanks. Mauro, could you please review and comment? > 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-widget > + :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--widget) > (prefix (widget-get widget :custom-prefix)) > (last (widget-get widget :custom-last)) > (style (widget-get widget :custom-style))