Hi Tassilo,

>>>>> Tassilo Horn <t...@gnu.org> writes:
>> First of all, is this situation common for others, or peculiar to me
>> due to my personal configuration? I continue assuming the former.

> Indeed, same for me.

Thank you for confirmation.

> I think it is not our business to set `tool-bar-style' explicitly but
> rather the user should do that based on his or her preferences.

> Here, the value is nil which, according to its docstring, should mean
> "use the system default or image if no system default".  So I guess
> there's also some GTK setting which a user could configure, and then
> Emacs/AUCTeX should follow suite.

I examined other emacs built-in libraries to figure out how they
suppress redundant text labels. It seems that there is an undocumented
feature such that non-nil :vert-only property for tool bar specification
does the job. (And I noticed a related topic in emacs-devel archive:
https://lists.gnu.org/archive/html/emacs-devel/2020-09/msg00935.html )

The revised patch is attached below. Now AUCTeX tool bar follows the
user preference even when `tool-bar-style' is customized to `both',
presenting labels under icons. (In that case, "Preview" icon lacks the
label, at least for me. It seems that either emacs or gtk omits the
label text "Preview at point" since it's too long to fit there.)

What do you think about it?

Regards,
Ikumi Keita

>From 2bda2212936c7008ad91a242fe9de815d61ec1fc Mon Sep 17 00:00:00 2001
From: Ikumi Keita <ik...@ikumi.que.jp>
Date: Tue, 22 Jun 2021 00:20:29 +0900
Subject: [PATCH] Fix tool bar

* toolbar-x.el (toolbarx-emacs-add-button): Use built-in separator.
Add :vert-only property to suppress labels unless vertical alignment
is specified for labels.
* preview.el.in (preview-mode-setup): Add :vert-only property as well.
---
 preview.el.in | 3 ++-
 toolbar-x.el  | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/preview.el.in b/preview.el.in
index cd3825e3..fd92a2ca 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -3068,7 +3068,8 @@ pp")
     (define-key LaTeX-mode-map [tool-bar preview]
       `(menu-item "Preview at point" preview-at-point
                   :image ,preview-tb-icon
-                  :help "Preview on/off at point")))
+                  :help "Preview on/off at point"
+                  :vert-only t)))
   (when buffer-file-name
     (let* ((filename (expand-file-name buffer-file-name))
            format-cons)
diff --git a/toolbar-x.el b/toolbar-x.el
index d95ca591..4d89d3f5 100644
--- a/toolbar-x.el
+++ b/toolbar-x.el
@@ -1116,7 +1116,9 @@ function `toolbar-install-toolbar'."
                               (cadr (memq :visible filtered-props))))
                (button (cons (memq :button filtered-props)
                              (cadr (memq :button filtered-props))))
-               (menuitem (append
+               (menuitem (if (eq symbol 'separator)
+                             '(menu-item "--")
+                         (append
                           (list 'menu-item
                                 (toolbarx-make-string-from-symbol symbol)
                                 command
@@ -1128,7 +1130,8 @@ function `toolbar-install-toolbar'."
                           (when (car visible)
                             (list :visible (cdr visible)))
                           (when (car button)
-                            (list :button (cdr button)))))
+                            (list :button (cdr button)))
+                          (list :vert-only t))))
                (key-not-used
                 (let* ((count 0)
                        (symb symbol))
-- 
2.31.1

Reply via email to