GNU bug report logs - #62562
30.0.50; [PATCH] Some new SVG icons

Previous Next

Package: emacs;

Reported by: Yuan Fu <casouri <at> gmail.com>

Date: Fri, 31 Mar 2023 05:53:02 UTC

Severity: normal

Tags: patch

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62562 in the body.
You can then email your comments to 62562 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to stefankangas <at> gmail.com, bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Fri, 31 Mar 2023 05:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yuan Fu <casouri <at> gmail.com>:
New bug report received and forwarded. Copy sent to stefankangas <at> gmail.com, bug-gnu-emacs <at> gnu.org. (Fri, 31 Mar 2023 05:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Bug Report Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 30.0.50; [PATCH] Some new SVG icons
Date: Thu, 30 Mar 2023 22:52:02 -0700
[Message part 1 (text/plain, inline)]
X-Debbugs-CC: stefankangas <at> gmail.com

I really like the SVG icons Stefan K added to Customize, so I made some
more. These icons can be used for, eg, tab-bar, Customize, and warning
messages. (Especially for the warning message, right now it’s either an
emoji (⛔) or a black block (■).)

The naming is debatable. I want them to be in a subdir together, so they
are now in the "symbols" dir.

The ".16" is because some times an icon design is only suitable for a
particular size, similar to "optical sizing" in font design. Anyway, I
think being specific wouldn’t hurt; It’s easy to use the ".16" version
for other sizes like 32 or 64, but not so much the other way around.

Yuan

[icons.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Fri, 31 Mar 2023 06:13:02 GMT) Full text and rfc822 format available.

Message #8 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: stefankangas <at> gmail.com, 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Fri, 31 Mar 2023 09:12:51 +0300
> Cc: stefankangas <at> gmail.com
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Thu, 30 Mar 2023 22:52:02 -0700
> 
> I really like the SVG icons Stefan K added to Customize, so I made some
> more. These icons can be used for, eg, tab-bar, Customize, and warning
> messages. (Especially for the warning message, right now it’s either an
> emoji (⛔) or a black block (■).)
> 
> The naming is debatable. I want them to be in a subdir together, so they
> are now in the "symbols" dir.
> 
> The ".16" is because some times an icon design is only suitable for a
> particular size, similar to "optical sizing" in font design. Anyway, I
> think being specific wouldn’t hurt; It’s easy to use the ".16" version
> for other sizes like 32 or 64, but not so much the other way around.

Thanks.

Please rename the files so that they have only one period, in the
".svg" extension.  The rest should be dashes or underscores.  Also, I
think this deserves a NEWS entry.  And feel free to install this on
master.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Sat, 01 Apr 2023 19:39:01 GMT) Full text and rfc822 format available.

Message #11 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stefan Kangas <stefankangas <at> gmail.com>, 62562 <at> debbugs.gnu.org,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Sat, 1 Apr 2023 12:38:39 -0700
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: stefankangas <at> gmail.com
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Thu, 30 Mar 2023 22:52:02 -0700
>> 
>> I really like the SVG icons Stefan K added to Customize, so I made some
>> more. These icons can be used for, eg, tab-bar, Customize, and warning
>> messages. (Especially for the warning message, right now it’s either an
>> emoji (⛔) or a black block (■).)
>> 
>> The naming is debatable. I want them to be in a subdir together, so they
>> are now in the "symbols" dir.
>> 
>> The ".16" is because some times an icon design is only suitable for a
>> particular size, similar to "optical sizing" in font design. Anyway, I
>> think being specific wouldn’t hurt; It’s easy to use the ".16" version
>> for other sizes like 32 or 64, but not so much the other way around.
>
> Thanks.
>
> Please rename the files so that they have only one period, in the
> ".svg" extension.  The rest should be dashes or underscores.  Also, I
> think this deserves a NEWS entry.  And feel free to install this on
> master.

Done. I didn’t add any news entries yet since I have some further plans.

I wonder if there could be a command like list-icon-images that shows users
the icon images they can use?

Also CC’ing Juri, since I think maybe tab-bar can take advantage of some
of these icons :-)

Yuan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Sat, 01 Apr 2023 19:42:02 GMT) Full text and rfc822 format available.

Message #14 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stefan Kangas <stefankangas <at> gmail.com>, 62562 <at> debbugs.gnu.org,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Sat, 1 Apr 2023 12:41:24 -0700
[Message part 1 (text/plain, inline)]
> 
> Done. I didn’t add any news entries yet since I have some further plans.
> 
> I wonder if there could be a command like list-icon-images that shows users
> the icon images they can use?
> 
> Also CC’ing Juri, since I think maybe tab-bar can take advantage of some
> of these icons :-)

Here are the icons (the color is applied by face property):

[Screenshot 2023-04-01 at 1.08.45 AM.png (image/png, inline)]
[Message part 3 (text/plain, inline)]

Yuan

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Sun, 02 Apr 2023 07:03:01 GMT) Full text and rfc822 format available.

Message #17 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Sun, 02 Apr 2023 09:56:31 +0300
>> Done. I didn’t add any news entries yet since I have some further plans.
>> 
>> I wonder if there could be a command like list-icon-images that shows users
>> the icon images they can use?
>> 
>> Also CC’ing Juri, since I think maybe tab-bar can take advantage of some
>> of these icons :-)
>
> Here are the icons (the color is applied by face property):

Thanks, the new icons look really nice.  I'll add them to the tab-bar.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Sun, 02 Apr 2023 07:06:01 GMT) Full text and rfc822 format available.

Message #20 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: stefankangas <at> gmail.com, 62562 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Sun, 02 Apr 2023 10:06:06 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Sat, 1 Apr 2023 12:38:39 -0700
> Cc: Stefan Kangas <stefankangas <at> gmail.com>,
>  62562 <at> debbugs.gnu.org,
>  Juri Linkov <juri <at> linkov.net>
> 
> I wonder if there could be a command like list-icon-images that shows users
> the icon images they can use?

Isn't that what image-dired does?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Sun, 02 Apr 2023 16:42:02 GMT) Full text and rfc822 format available.

Message #23 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Sun, 02 Apr 2023 19:27:15 +0300
[Message part 1 (text/plain, inline)]
> I wonder if there could be a command like list-icon-images that shows users
> the icon images they can use?

I'm using `t' (dired-toggle-marks) on all files in Dired in an image dir,
then `C-t C-t' (image-dired-dired-toggle-marked-thumbs).

> Also CC’ing Juri, since I think maybe tab-bar can take advantage of some
> of these icons :-)

After adapting new icons to tab-bar they look nice.
I invite everyone to try out this patch to see
how good they look:

[tab-bar-symbols.patch (text/x-diff, inline)]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 7c3069ca269..044fdc852e0 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -162,7 +162,7 @@ tab-bar--load-buttons
   (declare-function icons--register "icons")
   (unless (iconp 'tab-bar-new)
     (define-icon tab-bar-new nil
-      `((image "tabs/new.xpm"
+      `((image "symbols/plus_16.svg" "tabs/new.xpm"
                :margin ,tab-bar-button-margin
                :ascent center)
         ;; (emoji "➕")
@@ -175,7 +175,7 @@ tab-bar--load-buttons
 
   (unless (iconp 'tab-bar-close)
     (define-icon tab-bar-close nil
-      `((image "tabs/close.xpm"
+      `((image "symbols/cross_16.svg" "tabs/close.xpm"
                :margin ,tab-bar-button-margin
                :ascent center)
         ;; (emoji " ❌")
@@ -189,7 +189,10 @@ tab-bar--load-buttons
 
   (unless (iconp 'tab-bar-menu-bar)
     (define-icon tab-bar-menu-bar nil
-      '(;; (emoji "🍔")
+      `((image "symbols/menu_16.svg"
+               :margin ,tab-bar-button-margin
+               :ascent center)
+        ;; (emoji "🍔")
         (symbol "☰")
         (text "Menu" :face tab-bar-tab-inactive))
       "Icon for the menu bar."
@@ -2133,7 +2142,7 @@ tab-bar-history-mode
 
         (unless (iconp 'tab-bar-back)
           (define-icon tab-bar-back nil
-            `((image "tabs/left-arrow.xpm"
+            `((image "symbols/chevron_left_16.svg" "tabs/left-arrow.xpm"
                      :margin ,tab-bar-button-margin
                      :ascent center)
               (text " < "))
@@ -2143,7 +2152,7 @@ tab-bar-history-mode
 
         (unless (iconp 'tab-bar-forward)
           (define-icon tab-bar-forward nil
-            `((image "tabs/right-arrow.xpm"
+            `((image "symbols/chevron_right_16.svg" "tabs/right-arrow.xpm"
                      :margin ,tab-bar-button-margin
                      :ascent center)
               (text " > "))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Sun, 02 Apr 2023 22:06:02 GMT) Full text and rfc822 format available.

Message #26 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stefan Kangas <stefankangas <at> gmail.com>, 62562 <at> debbugs.gnu.org,
 juri <at> linkov.net
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Sun, 2 Apr 2023 15:05:13 -0700

> On Apr 2, 2023, at 12:06 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Sat, 1 Apr 2023 12:38:39 -0700
>> Cc: Stefan Kangas <stefankangas <at> gmail.com>,
>> 62562 <at> debbugs.gnu.org,
>> Juri Linkov <juri <at> linkov.net>
>> 
>> I wonder if there could be a command like list-icon-images that shows users
>> the icon images they can use?
> 
> Isn't that what image-dired does?

I was thinking of a discovery command, which shows package authors what icon images they can use out-of-the-box, and maybe show the path pass to create-image. They could simply go to image-load-path and call image-dired, but that assumes some degree of familiarity with Emacs and how we use icon images.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Mon, 03 Apr 2023 06:43:01 GMT) Full text and rfc822 format available.

Message #29 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Mon, 03 Apr 2023 09:37:32 +0300
[Message part 1 (text/plain, inline)]
>> Also CC’ing Juri, since I think maybe tab-bar can take advantage of some
>> of these icons :-)
>
> After adapting new icons to tab-bar they look nice.
> I invite everyone to try out this patch to see
> how good they look:

Actually, now buttons are too saturated and attract too much attention,
so here is a better appearance where they are dimmed by the shadow face,
and corresponding code changes that allow this:

[tab-bar-symbols-shadow.patch (text/x-diff, inline)]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 7c3069ca269..c42917d51a0 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -162,7 +162,8 @@ tab-bar--load-buttons
   (declare-function icons--register "icons")
   (unless (iconp 'tab-bar-new)
     (define-icon tab-bar-new nil
-      `((image "tabs/new.xpm"
+      `((image "symbols/plus_16.svg" "tabs/new.xpm"
+               :face shadow
                :margin ,tab-bar-button-margin
                :ascent center)
         ;; (emoji "➕")
@@ -175,7 +176,8 @@ tab-bar--load-buttons
 
   (unless (iconp 'tab-bar-close)
     (define-icon tab-bar-close nil
-      `((image "tabs/close.xpm"
+      `((image "symbols/cross_16.svg" "tabs/close.xpm"
+               :face shadow
                :margin ,tab-bar-button-margin
                :ascent center)
         ;; (emoji " ❌")
@@ -189,7 +191,10 @@ tab-bar--load-buttons
 
   (unless (iconp 'tab-bar-menu-bar)
     (define-icon tab-bar-menu-bar nil
-      '(;; (emoji "🍔")
+      `((image "symbols/menu_16.svg"
+               :margin ,tab-bar-button-margin
+               :ascent center)
+        ;; (emoji "🍔")
         (symbol "☰")
         (text "Menu" :face tab-bar-tab-inactive))
       "Icon for the menu bar."
@@ -717,16 +722,17 @@ tab-bar-tab-name-format-function
   :version "28.1")
 
 (defun tab-bar-tab-name-format-default (tab i)
-  (let ((current-p (eq (car tab) 'current-tab)))
-    (propertize
-     (concat (if tab-bar-tab-hints (format "%d " i) "")
-             (alist-get 'name tab)
-             (or (and tab-bar-close-button-show
-                      (not (eq tab-bar-close-button-show
-                               (if current-p 'non-selected 'selected)))
-                      tab-bar-close-button)
-                 ""))
-     'face (funcall tab-bar-tab-face-function tab))))
+  (let* ((current-p (eq (car tab) 'current-tab))
+         (name (concat (if tab-bar-tab-hints (format "%d " i) "")
+                       (alist-get 'name tab)
+                       (or (and tab-bar-close-button-show
+                                (not (eq tab-bar-close-button-show
+                                         (if current-p 'non-selected 'selected)))
+                                tab-bar-close-button)
+                           ""))))
+    (add-face-text-property
+     0 (length name) (funcall tab-bar-tab-face-function tab) t name)
+    name))
 
 (defcustom tab-bar-format '(tab-bar-format-history
                             tab-bar-format-tabs
@@ -2133,7 +2146,7 @@ tab-bar-history-mode
 
         (unless (iconp 'tab-bar-back)
           (define-icon tab-bar-back nil
-            `((image "tabs/left-arrow.xpm"
+            `((image "symbols/chevron_left_16.svg" "tabs/left-arrow.xpm"
                      :margin ,tab-bar-button-margin
                      :ascent center)
               (text " < "))
@@ -2143,7 +2156,7 @@ tab-bar-history-mode
 
         (unless (iconp 'tab-bar-forward)
           (define-icon tab-bar-forward nil
-            `((image "tabs/right-arrow.xpm"
+            `((image "symbols/chevron_right_16.svg" "tabs/right-arrow.xpm"
                      :margin ,tab-bar-button-margin
                      :ascent center)
               (text " > "))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Mon, 03 Apr 2023 07:57:01 GMT) Full text and rfc822 format available.

Message #32 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Mon, 3 Apr 2023 00:55:58 -0700

> On Apr 2, 2023, at 11:37 PM, Juri Linkov <juri <at> linkov.net> wrote:
> 
>>> Also CC’ing Juri, since I think maybe tab-bar can take advantage of some
>>> of these icons :-)
>> 
>> After adapting new icons to tab-bar they look nice.
>> I invite everyone to try out this patch to see
>> how good they look:
> 
> Actually, now buttons are too saturated and attract too much attention,
> so here is a better appearance where they are dimmed by the shadow face,
> and corresponding code changes that allow this:

Looks nice! BTW, how could I apply a mouse-face to the buttons in the tab-bar? I poked around and mouse-face doesn’t seem to take an effect?

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Mon, 03 Apr 2023 16:30:03 GMT) Full text and rfc822 format available.

Message #35 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Mon, 03 Apr 2023 19:23:48 +0300
>> Actually, now buttons are too saturated and attract too much attention,
>> so here is a better appearance where they are dimmed by the shadow face,
>> and corresponding code changes that allow this:
>
> Looks nice! BTW, how could I apply a mouse-face to the buttons in the
> tab-bar? I poked around and mouse-face doesn’t seem to take an effect?

Currently mouse-face is not supported neither by define-icon not by tab-bar.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Mon, 03 Apr 2023 20:19:02 GMT) Full text and rfc822 format available.

Message #38 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Mon, 3 Apr 2023 13:17:48 -0700

> On Apr 3, 2023, at 9:23 AM, Juri Linkov <juri <at> linkov.net> wrote:
> 
>>> Actually, now buttons are too saturated and attract too much attention,
>>> so here is a better appearance where they are dimmed by the shadow face,
>>> and corresponding code changes that allow this:
>> 
>> Looks nice! BTW, how could I apply a mouse-face to the buttons in the
>> tab-bar? I poked around and mouse-face doesn’t seem to take an effect?
> 
> Currently mouse-face is not supported neither by define-icon not by tab-bar.

Ah, I see. How are the buttons implemented then? If I move my pointer on top of it, it shows the “pressed” face. I’m trying to style the buttons on the tab-bar.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Tue, 04 Apr 2023 07:10:01 GMT) Full text and rfc822 format available.

Message #41 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Tue, 04 Apr 2023 09:50:23 +0300
>>> Looks nice! BTW, how could I apply a mouse-face to the buttons in the
>>> tab-bar? I poked around and mouse-face doesn’t seem to take an effect?
>>
>> Currently mouse-face is not supported neither by define-icon not by tab-bar.
>
> Ah, I see.  How are the buttons implemented then?  If I move my
> pointer on top of it, it shows the “pressed” face.  I’m trying to
> style the buttons on the tab-bar.

Mouse pointer hovering is handled in 'note_tab_bar_highlight' by using
DRAW_IMAGE_SUNKEN.  But you could try to style the image attributes
such as :margin and :ascent in define-icon.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Tue, 02 May 2023 17:15:02 GMT) Full text and rfc822 format available.

Message #44 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Tue, 02 May 2023 20:10:15 +0300
[Message part 1 (text/plain, inline)]
>>>> Looks nice! BTW, how could I apply a mouse-face to the buttons in the
>>>> tab-bar? I poked around and mouse-face doesn’t seem to take an effect?
>>>
>>> Currently mouse-face is not supported neither by define-icon not by tab-bar.
>>
>> Ah, I see.  How are the buttons implemented then?  If I move my
>> pointer on top of it, it shows the “pressed” face.  I’m trying to
>> style the buttons on the tab-bar.
>
> Mouse pointer hovering is handled in 'note_tab_bar_highlight' by using
> DRAW_IMAGE_SUNKEN.  But you could try to style the image attributes
> such as :margin and :ascent in define-icon.

The tab line has a different implementation - with own problems.

Currently when the icon from tabs/close.xpm is used, then hovering
the mouse pointer changes the background of this image to the
background color of mouse-face.

But when the new image symbols/cross_16.svg is used, then on hovering
the original background color is preserved in the svg image, not replaced
with the background color of mouse-face.

I have no idea why there is such idiosyncrasy for svg images
with transparent background.

If this is not an important detail then below is a patch that
adds the new svg images to the tab line as well.

Another problem is that by default the foreground of new svg images
is black.  To tone down the black color, add-face-text-property
was added to tab-bar-tab-name-format-default to use the shadow face
in the previous patch.

The same way to support grayed color for icons on the tab line the
following patch uses add-face-text-property in
tab-line-tab-name-format-default.

The third problem was that using 'define-icon' broke the tab-line
auto-scrolling feature, because for some reason 'define-icon'
sets 'rear-nonsticky' to t.  So the fix below is to override it
and set 'rear-nonsticky' to nil.

[tab-line-symbols-shadow.patch (text/x-diff, inline)]
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 1958f12975f..ca990726cbc 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -185,12 +205,19 @@ tab-line-new-button-show
   :group 'tab-line
   :version "27.1")
 
+(define-icon tab-line-new nil
+  `((image "symbols/plus_16.svg" "tabs/new.xpm"
+           :face shadow
+           :margin (2 . 0)
+           :ascent center)
+    (text " + "))
+  "Icon for creating a new tab."
+  :version "30.1"
+  :help-echo "New tab")
+
 (defvar tab-line-new-button
-  (propertize " + "
-              'display '(image :type xpm
-                               :file "tabs/new.xpm"
-                               :margin (2 . 0)
-                               :ascent center)
+  (propertize (icon-string 'tab-line-new)
+              'rear-nonsticky nil
               'keymap tab-line-add-map
               'mouse-face 'tab-line-highlight
               'help-echo "Click to add tab")
@@ -213,34 +240,53 @@ tab-line-close-button-show
   :group 'tab-line
   :version "27.1")
 
+(define-icon tab-line-close nil
+  `((image "symbols/cross_16.svg" "tabs/close.xpm"
+           :face shadow
+           :margin (2 . 0)
+           :ascent center)
+    (text " x"))
+  "Icon for closing the clicked tab."
+  :version "30.1"
+  :help-echo "Click to close tab")
+
 (defvar tab-line-close-button
-  (propertize " x"
-              'display '(image :type xpm
-                               :file "tabs/close.xpm"
-                               :margin (2 . 0)
-                               :ascent center)
+  (propertize (icon-string 'tab-line-close)
+              'rear-nonsticky nil ;; important to not break auto-scroll
               'keymap tab-line-tab-close-map
               'mouse-face 'tab-line-close-highlight
               'help-echo "Click to close tab")
   "Button for closing the clicked tab.")
 
+(define-icon tab-line-left nil
+  `((image "symbols/chevron_left_16.svg" "tabs/left-arrow.xpm"
+           :face shadow
+           :margin (2 . 0)
+           :ascent center)
+    (text " <"))
+  "Icon for scrolling horizontally to the left."
+  :version "30.1")
+
 (defvar tab-line-left-button
-  (propertize " <"
-              'display '(image :type xpm
-                               :file "tabs/left-arrow.xpm"
-                               :margin (2 . 0)
-                               :ascent center)
+  (propertize (icon-string 'tab-line-left)
+              'rear-nonsticky nil
               'keymap tab-line-left-map
               'mouse-face 'tab-line-highlight
               'help-echo "Click to scroll left")
   "Button for scrolling horizontally to the left.")
 
+(define-icon tab-line-right nil
+  `((image "symbols/chevron_right_16.svg" "tabs/right-arrow.xpm"
+           :face shadow
+           :margin (2 . 0)
+           :ascent center)
+    (text "> "))
+  "Icon for scrolling horizontally to the right."
+  :version "30.1")
+
 (defvar tab-line-right-button
-  (propertize "> "
-              'display '(image :type xpm
-                               :file "tabs/right-arrow.xpm"
-                               :margin (2 . 0)
-                               :ascent center)
+  (propertize (icon-string 'tab-line-right)
+              'rear-nonsticky nil
               'keymap tab-line-right-map
               'mouse-face 'tab-line-highlight
               'help-echo "Click to scroll right")
@@ -484,21 +541,27 @@ tab-line-tab-name-format-default
       (setf face (funcall fn tab tabs face buffer-p selected-p)))
     (apply 'propertize
            (concat (propertize (string-replace "%" "%%" name) ;; (bug#57848)
+                               'face face
                                'keymap tab-line-tab-map
                                'help-echo (if selected-p "Current tab"
                                             "Click to select tab")
                                ;; Don't turn mouse-1 into mouse-2 (bug#49247)
                                'follow-link 'ignore)
-                   (or (and (or buffer-p (assq 'buffer tab) (assq 'close tab))
-                            tab-line-close-button-show
-                            (not (eq tab-line-close-button-show
-                                     (if selected-p 'non-selected 'selected)))
-                            tab-line-close-button)
-                       ""))
+                   (let ((close (or (and (or buffer-p (assq 'buffer tab)
+                                             (assq 'close tab))
+                                         tab-line-close-button-show
+                                         (not (eq tab-line-close-button-show
+                                                  (if selected-p 'non-selected
+                                                    'selected)))
+                                         tab-line-close-button)
+                                    "")))
+                     (setq close (copy-sequence close))
+                     ;; Don't overwrite the icon face
+                     (add-face-text-property 0 (length close) face t close)
+                     close))
            `(
              tab ,tab
              ,@(if selected-p '(selected t))
-             face ,face
              mouse-face tab-line-highlight))))
 
 (defun tab-line-format-template (tabs)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Sun, 27 Aug 2023 17:31:01 GMT) Full text and rfc822 format available.

Message #47 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Sun, 27 Aug 2023 20:27:44 +0300
close 62562 30.0.50
thanks

>>>>> Looks nice! BTW, how could I apply a mouse-face to the buttons in the
>>>>> tab-bar? I poked around and mouse-face doesn’t seem to take an effect?
>>>>
>>>> Currently mouse-face is not supported neither by define-icon not by tab-bar.
>>>
>>> Ah, I see.  How are the buttons implemented then?  If I move my
>>> pointer on top of it, it shows the “pressed” face.  I’m trying to
>>> style the buttons on the tab-bar.
>>
>> Mouse pointer hovering is handled in 'note_tab_bar_highlight' by using
>> DRAW_IMAGE_SUNKEN.  But you could try to style the image attributes
>> such as :margin and :ascent in define-icon.
>
> The tab line has a different implementation

Now changes to use new icons in the tab-bar and tab-line
are pushed to master.  We have plenty of time to test
these changes before the next release.




bug marked as fixed in version 30.0.50, send any further explanations to 62562 <at> debbugs.gnu.org and Yuan Fu <casouri <at> gmail.com> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Sun, 27 Aug 2023 17:31:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Sun, 27 Aug 2023 21:43:01 GMT) Full text and rfc822 format available.

Message #52 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Sun, 27 Aug 2023 14:42:00 -0700

> On Aug 27, 2023, at 10:27 AM, Juri Linkov <juri <at> linkov.net> wrote:
> 
> close 62562 30.0.50
> thanks
> 
>>>>>> Looks nice! BTW, how could I apply a mouse-face to the buttons in the
>>>>>> tab-bar? I poked around and mouse-face doesn’t seem to take an effect?
>>>>> 
>>>>> Currently mouse-face is not supported neither by define-icon not by tab-bar.
>>>> 
>>>> Ah, I see.  How are the buttons implemented then?  If I move my
>>>> pointer on top of it, it shows the “pressed” face.  I’m trying to
>>>> style the buttons on the tab-bar.
>>> 
>>> Mouse pointer hovering is handled in 'note_tab_bar_highlight' by using
>>> DRAW_IMAGE_SUNKEN.  But you could try to style the image attributes
>>> such as :margin and :ascent in define-icon.
>> 
>> The tab line has a different implementation
> 
> Now changes to use new icons in the tab-bar and tab-line
> are pushed to master.  We have plenty of time to test
> these changes before the next release.

Great!

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Thu, 31 Aug 2023 21:02:02 GMT) Full text and rfc822 format available.

Message #55 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Rudolf Adamkovič <salutis <at> me.com>
To: Yuan Fu <casouri <at> gmail.com>, Juri Linkov <juri <at> linkov.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Kangas <stefankangas <at> gmail.com>,
 62562 <at> debbugs.gnu.org
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Thu, 31 Aug 2023 23:00:57 +0200
Yuan Fu <casouri <at> gmail.com> writes:

>> Now changes to use new icons [...] are pushed to master.
>
> Great!

Yuan, the new icons look *fantastic* on
macOS/hiDPI.  Great work!  Thank you.

Rudy
-- 
"Music is the mathematics of the sense, mathematics is the music of the reason."
-- James Joseph Sylvester, 1814-1897

Rudolf Adamkovič <salutis <at> me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62562; Package emacs. (Fri, 01 Sep 2023 07:06:02 GMT) Full text and rfc822 format available.

Message #58 received at 62562 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Rudolf Adamkovič <salutis <at> me.com>
Cc: Yuan Fu <casouri <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>,
 62562 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#62562: 30.0.50; [PATCH] Some new SVG icons
Date: Fri, 01 Sep 2023 09:58:16 +0300
>>> Now changes to use new icons [...] are pushed to master.
>>
>> Great!
>
> Yuan, the new icons look *fantastic* on
> macOS/hiDPI.  Great work!  Thank you.

Now I tested the new icons on hiDPI,
and indeed they look great.  Thanks Yuan.

Also I noticed that some icons on the tab bar/line
required changing their height to the full line height.
So now tab icons are fixed in the commit 30decd1d977.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 29 Sep 2023 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.