Subject: Re: bug#51648: 28.0.60; `tab-bar-close-button' and `tab-bar-new-button' should be documented in the manual

From: Juri Linkov <[email-masked]>
Date: Thu, 15 Sep 2022 19:20:39 +0300

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