GNU bug report logs - #51648
28.0.60; `tab-bar-close-button' and `tab-bar-new-button' should be documented in the manual

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Sun, 7 Nov 2021 03:08:01 UTC

Severity: wishlist

Merged with 51309

Found in version 28.0.60

Fixed in version 29.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 51648 in the body.
You can then email your comments to 51648 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 bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 03:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Po Lu <luangruo <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 07 Nov 2021 03:08:01 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.60; `tab-bar-close-button' and `tab-bar-new-button' should be
 documented in the manual
Date: Sun, 07 Nov 2021 11:07:07 +0800
I wanted to find out how to customize the image used for tab bar
buttons, but could not find anything in the manual.

It seems that setting the display property of `tab-bar-close-button' and
`tab-bar-new-button' is the way to go.

Shouldn't such an important customization be documented somewhere in the
manual?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 07:14:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60;
 `tab-bar-close-button' and `tab-bar-new-button' should be documented
 in the manual
Date: Sun, 07 Nov 2021 09:12:40 +0200
> Date: Sun, 07 Nov 2021 11:07:07 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 
> I wanted to find out how to customize the image used for tab bar
> buttons, but could not find anything in the manual.
> 
> It seems that setting the display property of `tab-bar-close-button' and
> `tab-bar-new-button' is the way to go.
> 
> Shouldn't such an important customization be documented somewhere in the
> manual?

No, not necessarily.  The manual is not supposed to document all the
customizations we have, only the important ones.

What should be possible is to find the customization by browsing the
tab-bar Custom group.  If that is not currently possible (I didn't
check), then we should probably do something to fix that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 07:25:01 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 07 Nov 2021 15:23:57 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> I wanted to find out how to customize the image used for tab bar
>> buttons, but could not find anything in the manual.
>> 
>> It seems that setting the display property of `tab-bar-close-button' and
>> `tab-bar-new-button' is the way to go.
>> 
>> Shouldn't such an important customization be documented somewhere in the
>> manual?
>
> No, not necessarily.  The manual is not supposed to document all the
> customizations we have, only the important ones.

Note that I said it was important.

FWIW, Two people asked me how to change the image used for those buttons
today.  (In one instance, right after introducing him to the tab bar --
it seems to be a customization people commonly wish to make.)

> What should be possible is to find the customization by browsing the
> tab-bar Custom group.  If that is not currently possible (I didn't
> check), then we should probably do something to fix that.

It isn't, FWIW.  Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 07:41:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>, Juri Linkov <juri <at> linkov.net>
Cc: 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 07 Nov 2021 09:40:15 +0200
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 51648 <at> debbugs.gnu.org
> Date: Sun, 07 Nov 2021 15:23:57 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Shouldn't such an important customization be documented somewhere in the
> >> manual?
> >
> > No, not necessarily.  The manual is not supposed to document all the
> > customizations we have, only the important ones.
> 
> Note that I said it was important.

I don't necessarily agree that it is important enough to be in the
manual.

> FWIW, Two people asked me how to change the image used for those buttons
> today.  (In one instance, right after introducing him to the tab bar --
> it seems to be a customization people commonly wish to make.)

Two people asking doesn't mean it's a common customization, and it is
too early to make those decisions anyway, as the feature is barely out
there.  Decisions about additions to the manual should not be taken
too easily, because the manual is printed and sold by the FSF, and any
addition to it makes the production of the manual more expensive.

> > What should be possible is to find the customization by browsing the
> > tab-bar Custom group.  If that is not currently possible (I didn't
> > check), then we should probably do something to fix that.
> 
> It isn't, FWIW.  Thanks.

Juri, can we please fix this?  Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 08:06:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51648 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 07 Nov 2021 16:05:18 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Decisions about additions to the manual should not be taken too
> easily, because the manual is printed and sold by the FSF, and any
> addition to it makes the production of the manual more expensive.

This is a detail I didn't take into account when making my request,
thanks for pointing it out.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 17:48:03 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 07 Nov 2021 19:37:22 +0200
>> > What should be possible is to find the customization by browsing the
>> > tab-bar Custom group.  If that is not currently possible (I didn't
>> > check), then we should probably do something to fix that.
>>
>> It isn't, FWIW.  Thanks.
>
> Juri, can we please fix this?  Thanks.

Please specify to what extent it should be customizable.

Currently configuration of these buttons is possible with e.g.

  (setq tab-bar-close-button
        (propertize " x"
                    'display
                    `(image :type svg
                            :file "checkbox-mixed.svg"
                            :margin ,tab-bar-button-margin
                            :ascent center)
                    'close-tab t
                    :help "Click to close tab"))

  (setq tab-bar-new-button
        (propertize " + "
                    'display
                    `(image :type svg
                            :file "checked.svg"
                            :margin ,tab-bar-button-margin
                            :ascent center)
                    :help "Click to add tab"))

that uses SVG images.  Also it's possible to use Unicode chars with

  (setq tab-bar-close-button (propertize " x" 'display (propertize "✕" 'face 'tab-bar-tab-inactive) 'close-tab t))
  (setq tab-bar-new-button (propertize " + " 'display (propertize "➕" 'face 'tab-bar-tab)))

So I'd simply add such examples to the docstrings of these variables
for emacs-28.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 18:26:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: luangruo <at> yahoo.com, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 07 Nov 2021 20:25:12 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Cc: Po Lu <luangruo <at> yahoo.com>,  51648 <at> debbugs.gnu.org
> Date: Sun, 07 Nov 2021 19:37:22 +0200
> 
> >> > What should be possible is to find the customization by browsing the
> >> > tab-bar Custom group.  If that is not currently possible (I didn't
> >> > check), then we should probably do something to fix that.
> >>
> >> It isn't, FWIW.  Thanks.
> >
> > Juri, can we please fix this?  Thanks.
> 
> Please specify to what extent it should be customizable.
> 
> Currently configuration of these buttons is possible with e.g.
> 
>   (setq tab-bar-close-button
>         (propertize " x"
>                     'display
>                     `(image :type svg
>                             :file "checkbox-mixed.svg"
>                             :margin ,tab-bar-button-margin
>                             :ascent center)
>                     'close-tab t
>                     :help "Click to close tab"))
> 
>   (setq tab-bar-new-button
>         (propertize " + "
>                     'display
>                     `(image :type svg
>                             :file "checked.svg"
>                             :margin ,tab-bar-button-margin
>                             :ascent center)
>                     :help "Click to add tab"))
> 
> that uses SVG images.  Also it's possible to use Unicode chars with
> 
>   (setq tab-bar-close-button (propertize " x" 'display (propertize "✕" 'face 'tab-bar-tab-inactive) 'close-tab t))
>   (setq tab-bar-new-button (propertize " + " 'display (propertize "➕" 'face 'tab-bar-tab)))

I thought there were some defcustom's for that, but they weren't
easily discoverable by browsing the tab-bar customization group.  But
if you didn't intend to let users customize those, it's up to you.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 18:33:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 07 Nov 2021 20:31:34 +0200
>>   (setq tab-bar-close-button (propertize " x" 'display (propertize "✕" 'face 'tab-bar-tab-inactive) 'close-tab t))
>>   (setq tab-bar-new-button (propertize " + " 'display (propertize "➕" 'face 'tab-bar-tab)))
>
> I thought there were some defcustom's for that, but they weren't
> easily discoverable by browsing the tab-bar customization group.  But
> if you didn't intend to let users customize those, it's up to you.

The problem is that I don't know how it's possible to customize
a string with text properties on it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 18:42:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: luangruo <at> yahoo.com, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 07 Nov 2021 20:41:11 +0200
> From: Juri Linkov <juri <at> linkov.net>
> Cc: luangruo <at> yahoo.com,  51648 <at> debbugs.gnu.org
> Date: Sun, 07 Nov 2021 20:31:34 +0200
> 
> >>   (setq tab-bar-close-button (propertize " x" 'display (propertize "✕" 'face 'tab-bar-tab-inactive) 'close-tab t))
> >>   (setq tab-bar-new-button (propertize " + " 'display (propertize "➕" 'face 'tab-bar-tab)))
> >
> > I thought there were some defcustom's for that, but they weren't
> > easily discoverable by browsing the tab-bar customization group.  But
> > if you didn't intend to let users customize those, it's up to you.
> 
> The problem is that I don't know how it's possible to customize
> a string with text properties on it.

Well, the request was to allow customization of the image on the tabs,
so maybe have just the image(s) customizable?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 07 Nov 2021 20:02:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 07 Nov 2021 22:00:24 +0200
>> >>   (setq tab-bar-close-button (propertize " x" 'display (propertize "✕" 'face 'tab-bar-tab-inactive) 'close-tab t))
>> >>   (setq tab-bar-new-button (propertize " + " 'display (propertize "➕" 'face 'tab-bar-tab)))
>> >
>> > I thought there were some defcustom's for that, but they weren't
>> > easily discoverable by browsing the tab-bar customization group.  But
>> > if you didn't intend to let users customize those, it's up to you.
>> 
>> The problem is that I don't know how it's possible to customize
>> a string with text properties on it.
>
> Well, the request was to allow customization of the image on the tabs,
> so maybe have just the image(s) customizable?

I don't know, let's wait for Po Lu to clarify what people want to customize.
Just a file name of an image file as a string?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Mon, 08 Nov 2021 00:33:02 GMT) Full text and rfc822 format available.

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

From: Po Lu <luangruo <at> yahoo.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Mon, 08 Nov 2021 08:32:36 +0800
Juri Linkov <juri <at> linkov.net> writes:

>> Well, the request was to allow customization of the image on the tabs,
>> so maybe have just the image(s) customizable?
>
> I don't know, let's wait for Po Lu to clarify what people want to customize.
> Just a file name of an image file as a string?

People generally want to customize the image, and perhaps the scale of
that image.

But I see no harm in letting people customize the whole string, if he
wants to.

Thanks!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Mon, 08 Nov 2021 09:05:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Mon, 08 Nov 2021 11:02:19 +0200
> People generally want to customize the image, and perhaps the scale of
> that image.
>
> But I see no harm in letting people customize the whole string, if he
> wants to.

I can't imagine how Customization UI could support customization of
such strings with text properties and images on them.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Mon, 08 Nov 2021 17:47:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Mon, 08 Nov 2021 19:46:01 +0200
forcemerge 51309 51648
thanks

> People generally want to customize the image, and perhaps the scale of
> that image.
>
> But I see no harm in letting people customize the whole string, if he
> wants to.

Please see also bug#51309.




Forcibly Merged 51309 51648. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Mon, 08 Nov 2021 17:47:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Thu, 27 Jan 2022 18:48:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: luangruo <at> yahoo.com, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Thu, 27 Jan 2022 20:45:59 +0200
> Well, the request was to allow customization of the image on the tabs,
> so maybe have just the image(s) customizable?

I noticed that in addition that the button for tab-bar-format-menu-bar
is not customizable, it also has a bug:

  `((menu-bar menu-item (propertize "Menu" 'face 'tab-bar-tab-inactive)
     tab-bar-menu-bar :help "Menu Bar")))
 
i.e. the part with (propertize "Menu" 'face 'tab-bar-tab-inactive)
is inside the quoted list, but it should be unquoted with `,'.

If it's ok to leave this bug in the release branch,
then maybe this patch should be applied only to master?

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index d49fc2efea..4c95438bae 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -751,9 +751,13 @@ tab-bar-menu-bar
                 (menu-bar-keymap))
     (popup-menu menu event)))
 
+(defvar tab-bar-menu-bar-button
+  (propertize "Menu" 'face 'tab-bar-tab-inactive)
+  "Button for the menu bar.")
+
 (defun tab-bar-format-menu-bar ()
   "Produce the Menu button for the tab bar that shows the menu bar."
-  `((menu-bar menu-item (propertize "Menu" 'face 'tab-bar-tab-inactive)
+  `((menu-bar menu-item ,tab-bar-menu-bar-button
      tab-bar-menu-bar :help "Menu Bar")))
 
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Thu, 15 Sep 2022 16:33:01 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Thu, 15 Sep 2022 19:20:39 +0300
[Message part 1 (text/plain, inline)]
>> People generally want to customize the image, and perhaps the scale of
>> that image.
>>
>> But I see no harm in letting people customize the whole string, if he
>> wants to.
>
> I can't imagine how Customization UI could support customization of
> such strings with text properties and images on them.

Fortunately, now we have customizable icons.  So I tried to do this
with a patch like below, but compilation failed with this error
because tab-bar.el is pre-loaded:

  Loading tab-bar (native compiled elisp)...
  Error: void-function (icons--register)
  (require cl-print) while preparing to dump

[tab-bar-new-icon.patch (text/x-diff, inline)]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 561365bb48..5d990ac184 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -33,7 +33,8 @@
 
 (eval-when-compile
   (require 'cl-lib)
-  (require 'seq))
+  (require 'seq)
+  (require 'icons))
 
 
 (defgroup tab-bar nil
@@ -521,6 +522,17 @@ tab-bar-new-button-show
 (defvar tab-bar-new-button " + "
   "Button for creating a new tab.")
 
+(define-icon tab-bar-new-icon nil
+  `((image "tabs/new.xpm"
+           :margin ,tab-bar-button-margin
+           :ascent center)
+    (emoji "➕")
+    (symbol "+")
+    (text " + " :face tab-bar-tab))
+  "Icon for creating a new tab."
+  :version "29.1"
+  :help-echo "New tab")
+
 (defcustom tab-bar-close-button-show t
   "Defines where to show the close tab button.
 If t, show the close tab button on all tabs.
@@ -905,8 +925,8 @@ tab-bar-format-tabs-groups
 
 (defun tab-bar-format-add-tab ()
   "Button to add a new tab."
-  (when (and tab-bar-new-button-show tab-bar-new-button)
-    `((add-tab menu-item ,tab-bar-new-button tab-bar-new-tab
+  (when (and tab-bar-new-button-show)
+    `((add-tab menu-item ,(icon-string 'tab-bar-new-icon) tab-bar-new-tab
                :help "New tab"))))
 
 (defun tab-bar-format-align-right ()

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51648; Package emacs. (Sun, 23 Oct 2022 19:14:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: 51648 <at> debbugs.gnu.org
Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and
 `tab-bar-new-button' should be documented in the manual
Date: Sun, 23 Oct 2022 21:11:43 +0300
[Message part 1 (text/plain, inline)]
> Fortunately, now we have customizable icons.  So I tried to do this
> with a patch like below, but compilation failed with this error
> because tab-bar.el is pre-loaded:
>
>   Loading tab-bar (native compiled elisp)...
>   Error: void-function (icons--register)
>   (require cl-print) while preparing to dump
>

OTOH, the following patch works pretty well:

[tab-bar-icons.patch (text/x-diff, inline)]
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index abefd996a8a..777837f4db7 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -155,25 +155,34 @@ tab-bar--undefine-keys
 
 (defun tab-bar--load-buttons ()
   "Load the icons for the tab buttons."
-  (when (and tab-bar-new-button
-             (not (get-text-property 0 'display tab-bar-new-button)))
-    ;; This file is pre-loaded so only here we can use the right data-directory:
-    (add-text-properties 0 (length tab-bar-new-button)
-                         `(display (image :type xpm
-                                          :file "tabs/new.xpm"
-                                          :margin ,tab-bar-button-margin
-                                          :ascent center))
-                         tab-bar-new-button))
+  (require 'icons)
 
-  (when (and tab-bar-close-button
-             (not (get-text-property 0 'display tab-bar-close-button)))
-    ;; This file is pre-loaded so only here we can use the right data-directory:
-    (add-text-properties 0 (length tab-bar-close-button)
-                         `(display (image :type xpm
-                                          :file "tabs/close.xpm"
-                                          :margin ,tab-bar-button-margin
-                                          :ascent center))
-                         tab-bar-close-button)))
+  (unless (iconp 'tab-bar-new)
+    (define-icon tab-bar-new nil
+      `((image "tabs/new.xpm"
+               :margin ,tab-bar-button-margin
+               :ascent center)
+        ;; (emoji "➕")
+        ;; (symbol "+")
+        (text " + "))
+      "Icon for creating a new tab."
+      :version "29.1"
+      :help-echo "New tab"))
+  (setq tab-bar-new-button (icon-string 'tab-bar-new))
+
+  (unless (iconp 'tab-bar-close)
+    (define-icon tab-bar-close nil
+      `((image "tabs/close.xpm"
+               :margin ,tab-bar-button-margin
+               :ascent center)
+        ;; (emoji " ❌")
+        ;; (symbol "ⓧ")
+        (text " x"))
+      "Icon for closing the clicked tab."
+      :version "29.1"
+      :help-echo "Click to close tab"))
+  (setq tab-bar-close-button (propertize (icon-string 'tab-bar-close)
+                                         'close-tab t)))
 
 (defun tab-bar--tab-bar-lines-for-frame (frame)
   "Determine and return the value of `tab-bar-lines' for FRAME.
@@ -1916,22 +1933,27 @@ tab-bar-history-mode
   :global t :group 'tab-bar
   (if tab-bar-history-mode
       (progn
-        (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-back-button)))
-          ;; This file is pre-loaded so only here we can use the right data-directory:
-          (add-text-properties 0 (length tab-bar-back-button)
-                               `(display (image :type xpm
-                                                :file "tabs/left-arrow.xpm"
-                                                :margin ,tab-bar-button-margin
-                                                :ascent center))
-                               tab-bar-back-button))
-        (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-forward-button)))
-          ;; This file is pre-loaded so only here we can use the right data-directory:
-          (add-text-properties 0 (length tab-bar-forward-button)
-                               `(display (image :type xpm
-                                                :file "tabs/right-arrow.xpm"
-                                                :margin ,tab-bar-button-margin
-                                                :ascent center))
-                               tab-bar-forward-button))
+        (require 'icons)
+
+        (unless (iconp 'tab-bar-back)
+          (define-icon tab-bar-back nil
+            `((image "tabs/left-arrow.xpm"
+                     :margin ,tab-bar-button-margin
+                     :ascent center)
+              (text " < "))
+            "Icon for going back in tab history."
+            :version "29.1"))
+        (setq tab-bar-back-button (icon-string 'tab-bar-back))
+
+        (unless (iconp 'tab-bar-forward)
+          (define-icon tab-bar-forward nil
+            `((image "tabs/right-arrow.xpm"
+                     :margin ,tab-bar-button-margin
+                     :ascent center)
+              (text " > "))
+            "Icon for going forward in tab history."
+            :version "29.1"))
+        (setq tab-bar-forward-button (icon-string 'tab-bar-forward))
 
         (add-hook 'pre-command-hook 'tab-bar--history-pre-change)
         (add-hook 'window-configuration-change-hook 'tab-bar--history-change))

bug marked as fixed in version 29.0.50, send any further explanations to 51309 <at> debbugs.gnu.org and Carlos Pita <carlosjosepita2 <at> gmail.com> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Mon, 24 Oct 2022 07:36:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 21 Nov 2022 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 128 days ago.

Previous Next


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