From: David Ponce via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>, Mauro Aranda <maurooaranda@gmail.com>
Cc: 73178@debbugs.gnu.org
Subject: bug#73178: 31.0.50; [PATCH] Improve the widget to customize icon
Date: Thu, 9 Jan 2025 11:01:40 +0100 [thread overview]
Message-ID: <822bd2c9-7463-4c55-89c2-2eabd990944d@orange.fr> (raw)
In-Reply-To: <86ed1c31o6.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]
On 2025-01-09 08:07, Eli Zaretskii wrote:
>> Date: Wed, 8 Jan 2025 10:59:27 -0300
>> Cc: Eli Zaretskii <eliz@gnu.org>
>> From: Mauro Aranda <maurooaranda@gmail.com>
>>
[...]
>> 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.
Hello Eli,
Hmm, it seems you didn't install the correct patch?
I attached the correct patch (V2) which applies cleanly for me.
Also below is my proposed ChangeLog.
Thank you, and thanks Mauro for your review.
2025-01-09 David Ponce <da_vid@orange.fr>
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.
[-- Attachment #2: improve-widget-to-customize-icon-V2.patch --]
[-- Type: text/x-patch, Size: 2776 bytes --]
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))
next prev parent reply other threads:[~2025-01-09 10:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-11 14:28 bug#73178: 31.0.50; [PATCH] Improve the widget to customize icon David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 15:19 ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-11 15:28 ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-08 13:59 ` Mauro Aranda
2025-01-09 7:07 ` Eli Zaretskii
2025-01-09 9:10 ` Mauro Aranda
2025-01-09 10:01 ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2025-01-09 14:35 ` Eli Zaretskii
2025-01-09 14:52 ` David Ponce via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14 9:52 ` Eli Zaretskii
2024-09-14 9:51 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=822bd2c9-7463-4c55-89c2-2eabd990944d@orange.fr \
--to=bug-gnu-emacs@gnu.org \
--cc=73178@debbugs.gnu.org \
--cc=da_vid@orange.fr \
--cc=eliz@gnu.org \
--cc=maurooaranda@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).