auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] Changes to auctex/tex-bar.el,v


From: Reiner Steib
Subject: [AUCTeX-diffs] Changes to auctex/tex-bar.el,v
Date: Thu, 27 Jul 2006 18:41:43 +0000

CVSROOT:        /sources/auctex
Module name:    auctex
Changes by:     Reiner Steib <rsteib>   06/07/27 18:41:42

Index: tex-bar.el
===================================================================
RCS file: /sources/auctex/auctex/tex-bar.el,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- tex-bar.el  25 May 2006 07:50:57 -0000      1.13
+++ tex-bar.el  27 Jul 2006 18:41:42 -0000      1.14
@@ -82,6 +82,122 @@
   "Tool bar support in AUCTeX."
   :group 'AUCTeX)
 
+(defcustom TeX-bar-TeX-buttons
+  '(open-file save-buffer cut copy paste undo
+             [separator nil] tex next-error view bibtex)
+  "List of buttons available in `tex-mode'.
+It should be a list in the same format of the BUTTONS parameter
+in function `toolbarx-install-toolbar', often a symbol that
+labels a button or Emacs/XEmacs choice of buttons.
+
+Type `\\[TeX-bar-TeX-buttons]' for a list of available buttons.
+
+Buttons are defined in alists (labels associated to properties
+that define a button).  For a list of variables that hold such
+alists, see variable `TeX-bar-TeX-all-button-alists'."
+  :type '(repeat (choice (symbol :tag "Label")
+                        (vector :args ((symbol :tag "Label in Emacs ")
+                                       (symbol :tag "Label in XEmacs"))
+                                :tag "Emacs/XEmacs choice")
+                        (sexp :tag "General element")))
+  :group 'TeX-tool-bar)
+
+(defun TeX-bar-TeX-buttons ()
+  "Display in a buffer a list of buttons for `tex-bar.el'."
+  (interactive)
+  (let ((assqs-button-alists)
+       (labels))
+    (dolist (m-alist TeX-bar-TeX-all-button-alists)
+      (setq labels nil)
+      (dolist (as (eval m-alist))
+       (setq labels (cons (car as) labels)))
+      (setq assqs-button-alists (cons (cons m-alist (nreverse labels))
+                                      assqs-button-alists)))
+    (setq assqs-button-alists (nreverse assqs-button-alists))
+    ;; displaying results
+    (save-excursion
+      (set-buffer (get-buffer-create "*TeX tool bar buttons*"))
+      (erase-buffer)
+      (insert "Available buttons for TeX mode
+================================")
+      (dolist (i assqs-button-alists)
+       (insert (format "\n\n`%s' provide buttons:\n  " (car i)))
+       (dolist (j (cdr i))
+         (insert (format " %s" j)))
+       (fill-region (point-at-bol) (point-at-eol))))
+    (display-buffer "*TeX tool bar buttons*" t)))
+
+(defgroup TeX-tool-bar-button-definitions nil
+  "Collections of button definitions."
+  :group 'TeX-tool-bar)
+
+(defcustom TeX-bar-TeX-all-button-alists
+  '(TeX-bar-TeX-button-alist
+    toolbarx-default-toolbar-meaning-alist)
+  "List of variables that hold buttons properties.
+Each element should be a symbol bound to list in the format of
+the argument BUTTON-ALIST in function `toolbarx-install-toolbar'."
+  :type '(repeat variable)
+  :group 'TeX-tool-bar-button-definitions)
+
+(defcustom TeX-bar-TeX-button-alist
+  '((tex :image (lambda nil (if TeX-PDF-mode "pdftex" "tex"))
+        :command (progn
+                   (TeX-save-document (TeX-master-file))
+                   (TeX-command "TeX" 'TeX-master-file -1))
+        :help (lambda (&rest ignored)
+                (TeX-bar-help-from-command-list "TeX")))
+    (pdftex :image "pdftex"
+           :command (progn
+                      (TeX-save-document (TeX-master-file))
+                      (TeX-command "PDFTeX" 'TeX-master-file -1))
+           :help (lambda (&rest ignored)
+                   (TeX-bar-help-from-command-list "PDFTeX")))
+    (next-error :image "error"
+               :command TeX-next-error
+               :enable (plist-get TeX-error-report-switches
+                                  (intern (TeX-master-file)))
+               :visible (plist-get TeX-error-report-switches
+                                   (intern (TeX-master-file))))
+    (view :image (lambda nil (if TeX-PDF-mode "viewpdf" "viewdvi"))
+         :command (TeX-command "View" 'TeX-master-file -1)
+         :help (lambda (&rest ignored)
+                 (TeX-bar-help-from-command-list "View")))
+    (file :image "dvips"
+         :command (TeX-command "File" 'TeX-master-file -1)
+         :help (lambda (&rest ignored)
+                 (TeX-bar-help-from-command-list "File")))
+    (bibtex :image "bibtex"
+           :command (TeX-command "BibTeX" 'TeX-master-file -1)
+           :help (lambda (&rest ignored)
+                   (TeX-bar-help-from-command-list "BibTeX"))))
+  ;; latex-symbols-experimental?
+  "Alist for button definitions in TeX bar.
+Value should le a list where each element is of format (KEY .
+PROPS), where KEY is a symbol that labels the button and PROPS is
+a list of properties of the button.  For a description of the
+format of PROPS, please see documentation of function
+`toolbarx-install-toolbar'.  This custom variable is in the same
+format of the argument MEANING-ALIST in the mentioned function."
+  :type '(alist :key-type symbol :value-type sexp)
+  :group 'TeX-tool-bar-button-definitions)
+
+;;; Installation of the tool bar
+;;;###autoload
+(defun TeX-install-toolbar ()
+  "Install toolbar buttons for TeX mode."
+  (interactive)
+  (require 'toolbar-x)
+  (add-to-list 'toolbarx-image-path
+              (expand-file-name "images" TeX-data-directory))
+  (add-hook 'TeX-PDF-mode-hook 'toolbarx-refresh)
+  (toolbarx-install-toolbar TeX-bar-TeX-buttons
+                           (let ((append-list))
+                             (dolist (elt TeX-bar-TeX-all-button-alists)
+                               (setq append-list (append append-list
+                                                         (eval elt))))
+                             append-list)))
+
 (defcustom TeX-bar-LaTeX-buttons
   '(open-file save-buffer cut copy paste undo
              [separator nil] latex next-error view bibtex)
@@ -184,7 +300,7 @@
   :type '(alist :key-type symbol :value-type sexp)
   :group 'TeX-tool-bar-button-definitions)
 
-;;; instalation of toolbar
+;;; Installation of the tool bar
 ;;;###autoload
 (defun LaTeX-install-toolbar ()
   "Install toolbar buttons for LaTeX mode."




reply via email to

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