all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: David Ponce <da_vid@orange.fr>, Mauro Aranda <maurooaranda@gmail.com>
Cc: 73178@debbugs.gnu.org
Subject: bug#73178: 31.0.50; [PATCH] Improve the widget to customize icon
Date: Sat, 14 Sep 2024 12:51:50 +0300	[thread overview]
Message-ID: <86frq2h8ax.fsf@gnu.org> (raw)
In-Reply-To: <4cd4a62c-6642-49a3-8b2c-5eda13ac79af@orange.fr> (bug-gnu-emacs@gnu.org)

> 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" <bug-gnu-emacs@gnu.org>
> 
> 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  <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.
> 
> 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))





      parent reply	other threads:[~2024-09-14  9:51 UTC|newest]

Thread overview: 5+ 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
2024-09-14  9:52   ` Eli Zaretskii
2024-09-14  9:51 ` Eli Zaretskii [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86frq2h8ax.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73178@debbugs.gnu.org \
    --cc=da_vid@orange.fr \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.