1. xemacs
  2. auctex

Source

auctex / tex-bar.el

Diff from to

File tex-bar.el

 
 ;; You should have received a copy of the GNU General Public
 ;; License along with this program; if not, write to the Free
-;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-;; MA 02110-1301 USA
+;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+;; MA 02111-1307 USA
 
 ;; Author: Miguel V. S. Frasson <frasson@math.leidenuniv.nl>
 ;; Keywords: tool-bar, tex, latex
   "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 '(list (set :inline t
-		    (const open-file)
-		    (const save-buffer)
-		    (const cut)
-		    (const copy)
-		    (const paste)
-		    (const undo)
-		    (const [separator nil])
-		    (const latex)
-		    (const next-error)
-		    (const view)
-		    (const file)
-		    (const bibtex)
-		    (const clean))
-		    ;; (const latex-symbols-experimental)
-	       (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' provides the following 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)
-	  :visible (not TeX-PDF-mode)
-	  :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")))
-    (clean  :image "delete"
-	    :command (TeX-command "Clean" 'TeX-master-file -1)
-	    :help (lambda (&rest ignored)
-		    (TeX-bar-help-from-command-list "Clean"))))
-  ;; 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 nil t)
-  (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)
 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-LaTeX-all-button-alists'."
-  :type '(list (set :inline t
-		    (const open-file)
-		    (const save-buffer)
-		    (const cut)
-		    (const copy)
-		    (const paste)
-		    (const undo)
-		    (const [separator nil])
-		    (const latex)
-		    (const next-error)
-		    (const view)
-		    (const file)
-		    (const bibtex)
-		    (const clean)
-		    (const latex-symbols-experimental))
-	       (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"))))
+  :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-LaTeX-buttons ()
       (insert "Available buttons for LaTeX mode
 ================================")
       (dolist (i assqs-button-alists)
-	(insert (format "\n\n`%s' provides the following buttons:\n  " (car i)))
+	(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))))
 	   :command (progn
 		      (TeX-save-document (TeX-master-file))
 		      (TeX-command "LaTeX" 'TeX-master-file -1))
-	   :help (lambda (&rest ignored)
-		   (TeX-bar-help-from-command-list "LaTeX")))
+	   :help (lambda nil (TeX-bar-help-from-command-list "LaTeX")))
     (pdflatex :image "pdftex"
 	      :command (progn
 			 (TeX-save-document (TeX-master-file))
 			 (TeX-command "PDFLaTeX" 'TeX-master-file -1))
-	      :help (lambda (&rest ignored)
-		      (TeX-bar-help-from-command-list "PDFLaTeX")))
+	      :help (lambda nil (TeX-bar-help-from-command-list "PDFLaTeX")))
     (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"))
+    (view :image "view"
+	  ;; FIXME: Mode specific switching doesn't work yet, so keep general
+	  ;; image for now.
+	  ;;
+	  ;; (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")))
+	  :help (lambda nil (TeX-bar-help-from-command-list "View")))
     (file :image "dvips"
 	  :command (TeX-command "File" 'TeX-master-file -1)
-	  :visible (not TeX-PDF-mode)
-	  :help (lambda (&rest ignored)
-		  (TeX-bar-help-from-command-list "File")))
+	  :help (lambda nil (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")))
-    (clean  :image "delete"
-	    :command (TeX-command "Clean" 'TeX-master-file -1)
-	    :help (lambda (&rest ignored)
-		    (TeX-bar-help-from-command-list "Clean")))
+	    :help (lambda nil (TeX-bar-help-from-command-list "BibTeX")))
     (latex-symbols-experimental . (:alias :eval-group
 					  LaTeX-symbols-toolbar-switch-contents
 					  LaTeX-symbols-toolbar-contents)))
   :type '(alist :key-type symbol :value-type sexp)
   :group 'TeX-tool-bar-button-definitions)
 
-;;; Installation of the tool bar
+;;; instalation of toolbar
 ;;;###autoload
 (defun LaTeX-install-toolbar ()
   "Install toolbar buttons for LaTeX 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 nil t)
   (toolbarx-install-toolbar TeX-bar-LaTeX-buttons
 			    (let ((append-list))
 			      (dolist (elt TeX-bar-LaTeX-all-button-alists)
 		  (toolbarx-refresh))
        ;; help message depends on if symb-toolbar is on or off, and in
        ;; the name of the current class of symbols
-       :help (lambda (&rest ignore)
+       :help (lambda nil
 	       (concat "Turn "
 		       (if LaTeX-symbols-toolbar-visible-flag "off " "on ")
 		       "the toolbar of LaTeX symbols (current class: "