bug-auctex
[Top][All Lists]
Advanced

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

Re: [Bug-AUCTeX] 2006-12-06; toolbar icons disappear


From: Ralf Angeli
Subject: Re: [Bug-AUCTeX] 2006-12-06; toolbar icons disappear
Date: Thu, 07 Dec 2006 20:59:28 +0100

* Leo (2006-12-07) writes:

> How to reproduce:
>      1. open s1.tex
>      2. open s2.tex
>      3. C-c C-t C-p
>
> Then all icons in toolbar are gone in the s2.tex file buffer as in the
> screenshot.

The bug is caused by `toolbarx-refresh' being called in
`TeX-PDF-mode-hook' and trying to update the tool bar while there are
no buttons configured for it.  This is due to the special TeX tool bar
not being enabled in ConTeXt mode.

The following patch fixes the problem by checking the presence and
value of the variables `plain-TeX-enable-toolbar' and
`LaTeX-enable-toolbar' in the hook function.  (`TeX-mode-prefix' is a
function not included in the patch returning the mode prefix as a
string.)  It feels a bit clumsy, though.  Another approach would be to
check for the non-emptiness of `toolbarx-internal-button-switches' (in
contrast to checking *-enable-toolbar).  It's less fragile because the
test does not rely on all modes defining a *-enable-toolbar variable
but it means that the value nil for
`toolbarx-internal-button-switches' gets the meaning of "the special
TeX tool bar is disabled in this buffer".

What do others think?


--- tex-bar.el  16 Sep 2006 20:24:32 +0200      1.16
+++ tex-bar.el  07 Dec 2006 20:47:29 +0100      
@@ -210,7 +210,12 @@
   (require 'toolbar-x)
   (add-to-list 'toolbarx-image-path
               (expand-file-name "images" TeX-data-directory))
-  (add-hook 'TeX-PDF-mode-hook 'toolbarx-refresh)
+  (add-hook 'TeX-PDF-mode-hook
+           (lambda ()
+             (let ((symbol (intern (concat (TeX-mode-prefix)
+                                           "-enable-toolbar"))))
+               (when (and (boundp symbol) (symbol-value symbol))
+                 (toolbarx-refresh)))))
   (toolbarx-install-toolbar TeX-bar-TeX-buttons
                            (let ((append-list))
                              (dolist (elt TeX-bar-TeX-all-button-alists)
@@ -348,7 +353,12 @@
   (require 'toolbar-x)
   (add-to-list 'toolbarx-image-path
               (expand-file-name "images" TeX-data-directory))
-  (add-hook 'TeX-PDF-mode-hook 'toolbarx-refresh)
+  (add-hook 'TeX-PDF-mode-hook
+           (lambda ()
+             (let ((symbol (intern (concat (TeX-mode-prefix)
+                                           "-enable-toolbar"))))
+               (when (and (boundp symbol) (symbol-value symbol))
+                 (toolbarx-refresh)))))
   (toolbarx-install-toolbar TeX-bar-LaTeX-buttons
                            (let ((append-list))
                              (dolist (elt TeX-bar-LaTeX-all-button-alists)

-- 
Ralf




reply via email to

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