bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51648: 28.0.60; `tab-bar-close-button' and `tab-bar-new-button' shou


From: Juri Linkov
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> 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

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 ()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]