1 |
;;; tex.el --- Support for TeX documents. |
;;; tex.el --- Support for TeX documents. |
2 |
|
|
3 |
;; Copyright (C) 1985, 1986, 1993, 1994, 1996, 1997, 1999, 2000, |
;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1996, 1997, 1999, 2000, |
4 |
;; 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
;; 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
|
;; Copyright (C) 1987 Lars Peter Fischer |
|
5 |
;; Copyright (C) 1991 Kresten Krab Thorup |
;; Copyright (C) 1991 Kresten Krab Thorup |
6 |
|
|
7 |
;; Maintainer: auctex-devel@gnu.org |
;; Maintainer: auctex-devel@gnu.org |
550 |
:tag "Arguments" |
:tag "Arguments" |
551 |
(sexp :format "%v"))))) |
(sexp :format "%v"))))) |
552 |
|
|
|
;; End of Site Customization. |
|
553 |
|
|
554 |
;;; Import |
;; The following dependencies are not done with autoload cookies since |
555 |
|
;; they are only useful when tex.el is loaded, anyway. tex-buf.el |
556 |
(defvar no-doc |
;; should remain unloaded as long as one is only editing files, so |
557 |
"This function is part of AUCTeX, but has not yet been loaded. |
;; requiring it here would be wrong. |
558 |
Full documentation will be available after autoloading the function." |
|
559 |
"Documentation for autoload functions.") |
(autoload 'TeX-region-create "tex-buf" nil nil) |
560 |
|
(autoload 'TeX-save-document "tex-buf" nil t) |
561 |
;; This hook will store bibitems when you save a BibTeX buffer. |
(autoload 'TeX-home-buffer "tex-buf" nil t) |
562 |
(add-hook 'bibtex-mode-hook 'BibTeX-auto-store) |
(autoload 'TeX-pin-region "tex-buf" nil t) |
563 |
|
(autoload 'TeX-command-region "tex-buf" nil t) |
564 |
(autoload 'BibTeX-auto-store "latex" no-doc t) |
(autoload 'TeX-command-buffer "tex-buf" nil t) |
565 |
|
(autoload 'TeX-command-master "tex-buf" nil t) |
566 |
(autoload 'LaTeX-math-mode "latex" no-doc t) |
(autoload 'TeX-command "tex-buf" nil nil) |
567 |
(autoload 'japanese-plain-tex-mode "tex-jp" no-doc t) |
(autoload 'TeX-kill-job "tex-buf" nil t) |
568 |
(autoload 'japanese-latex-mode "tex-jp" no-doc t) |
(autoload 'TeX-recenter-output-buffer "tex-buf" nil t) |
569 |
(autoload 'texinfo-mode "tex-info" no-doc t) |
(autoload 'TeX-next-error "tex-buf" nil t) |
570 |
(autoload 'latex-mode "latex" no-doc t) |
(autoload 'TeX-toggle-debug-boxes "tex-buf" nil t) |
571 |
|
(autoload 'TeX-region-file "tex-buf" nil nil) |
572 |
(autoload 'multi-prompt "multi-prompt" no-doc nil) |
(autoload 'TeX-current-offset "tex-buf" nil nil) |
573 |
|
(autoload 'TeX-process-set-variable "tex-buf" nil nil) |
574 |
(autoload 'texmathp "texmathp" no-doc nil) |
(autoload 'TeX-view "tex-buf" nil t) |
|
(autoload 'texmathp-match-switch "texmathp" no-doc nil) |
|
|
|
|
|
;; Don't require `tex-buf' because `tex-buf' requires `tex'. |
|
|
(autoload 'TeX-region-create "tex-buf" no-doc nil) |
|
|
(autoload 'TeX-save-document "tex-buf" no-doc t) |
|
|
(autoload 'TeX-home-buffer "tex-buf" no-doc t) |
|
|
(autoload 'TeX-pin-region "tex-buf" no-doc t) |
|
|
(autoload 'TeX-command-region "tex-buf" no-doc t) |
|
|
(autoload 'TeX-command-buffer "tex-buf" no-doc t) |
|
|
(autoload 'TeX-command-master "tex-buf" no-doc t) |
|
|
(autoload 'TeX-command "tex-buf" no-doc nil) |
|
|
(autoload 'TeX-kill-job "tex-buf" no-doc t) |
|
|
(autoload 'TeX-recenter-output-buffer "tex-buf" no-doc t) |
|
|
(autoload 'TeX-next-error "tex-buf" no-doc t) |
|
|
(autoload 'TeX-toggle-debug-boxes "tex-buf" no-doc t) |
|
|
(autoload 'TeX-region-file "tex-buf" no-doc nil) |
|
|
(autoload 'TeX-current-offset "tex-buf" no-doc nil) |
|
|
(autoload 'TeX-process-set-variable "tex-buf" no-doc nil) |
|
|
(autoload 'TeX-view "tex-buf" no-doc t) |
|
|
|
|
|
(autoload 'TeX-fold-mode "tex-fold" no-doc t) |
|
|
(autoload 'tex-fold-mode "tex-fold" no-doc t) |
|
575 |
|
|
576 |
;;; Portability. |
;;; Portability. |
577 |
|
|
603 |
Also does other stuff." |
Also does other stuff." |
604 |
(TeX-maybe-remove-help menu))) |
(TeX-maybe-remove-help menu))) |
605 |
|
|
606 |
(eval-and-compile |
(defconst AUC-TeX-version AUCTeX-version) |
607 |
(defconst AUCTeX-version |
(make-obsolete-variable 'AUC-TeX-version 'AUCTeX-version "11.50") |
608 |
(eval-when-compile |
|
609 |
(let ((name "$Name$") |
(defconst AUC-TeX-date AUCTeX-date) |
610 |
(rev "$Revision$")) |
(make-obsolete-variable 'AUC-TeX-date 'AUCTeX-date "11.50") |
|
(or (when (string-match "\\`[$]Name: *\\(release_\\)?\\([^ ]+\\) *[$]\\'" |
|
|
name) |
|
|
(setq name (match-string 2 name)) |
|
|
(while (string-match "_" name) |
|
|
(setq name (replace-match "." t t name))) |
|
|
name) |
|
|
(if (string-match "\\`[$]Revision: *\\([^ ]+\\) *[$]\\'" rev) |
|
|
(format "CVS-%s" (match-string 1 rev))) |
|
|
"unknown"))) |
|
|
"AUCTeX version. |
|
|
If not a regular release, CVS revision of `tex.el'.")) |
|
|
|
|
|
(defconst AUCTeX-date |
|
|
(eval-when-compile |
|
|
(let ((date "$Date$")) |
|
|
(string-match |
|
|
"\\`[$]Date: *\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" |
|
|
date) |
|
|
(format "%s-%s-%s" (match-string 1 date) (match-string 2 date) |
|
|
(match-string 3 date)))) |
|
|
"AUCTeX release date using the ISO 8601 format, yyyy-mm-dd.") |
|
|
|
|
|
(defconst AUC-TeX-version AUCTeX-version |
|
|
"Obsolete. Replaced by `AUCTeX-version'.") |
|
|
|
|
|
(defconst AUC-TeX-date AUCTeX-date |
|
|
"Obsolete. Replaced by `AUCTeX-date'.") |
|
|
|
|
|
(defmacro TeX-defun (name args doc &rest body) |
|
|
"Define an AUCTeX function. |
|
|
The function NAME with argument ARGS and version-specific |
|
|
DOC string gets defined as BODY. An occurence of %s in the |
|
|
DOC string gets replaced with a string like \"AUCTeX 5.1\"." |
|
|
;; (declare (indent defun) (debug &declare name name |
|
|
;; lambda-list args |
|
|
;; arg doc |
|
|
;; def-body body)) |
|
|
`(defun ,name ,args ,(format doc |
|
|
(concat "AUCTeX " AUCTeX-version)) |
|
|
,@body)) |
|
611 |
|
|
612 |
;;; Documentation for Info-goto-emacs-command-node and similar |
;;; Documentation for Info-goto-emacs-command-node and similar |
613 |
|
|
614 |
(eval-after-load 'info '(dolist (elt '("TeX" "LaTeX" "ConTeXt" "Texinfo")) |
(eval-after-load 'info '(dolist (elt '("TeX" "LaTeX" "ConTeXt" "Texinfo" |
615 |
|
"docTeX")) |
616 |
(add-to-list 'Info-file-list-for-emacs |
(add-to-list 'Info-file-list-for-emacs |
617 |
(cons elt "AUCTeX")))) |
(cons elt "AUCTeX")))) |
618 |
|
|
2083 |
|
|
2084 |
;;; Font Locking |
;;; Font Locking |
2085 |
|
|
|
(autoload 'font-latex-setup "font-latex" |
|
|
"Font locking optimized for LaTeX. |
|
|
Should work with all Emacsen." t) |
|
|
(autoload 'tex-font-setup "tex-font" |
|
|
"Copy of Emacs 21 standard tex-mode font lock support. |
|
|
This only works with Emacs 21." t) |
|
|
|
|
2086 |
(defcustom TeX-install-font-lock 'font-latex-setup |
(defcustom TeX-install-font-lock 'font-latex-setup |
2087 |
"Function to call to install font lock support. |
"Function to call to install font lock support. |
2088 |
Choose `ignore' if you don't want AUCTeX to install support for font locking." |
Choose `ignore' if you don't want AUCTeX to install support for font locking." |
2092 |
(function-item ignore) |
(function-item ignore) |
2093 |
(function :tag "Other"))) |
(function :tag "Other"))) |
2094 |
|
|
|
|
|
2095 |
;;; The Mode |
;;; The Mode |
2096 |
|
|
2097 |
(defvar TeX-format-list |
(defvar TeX-format-list |
2131 |
:group 'TeX-misc |
:group 'TeX-misc |
2132 |
:type 'boolean) |
:type 'boolean) |
2133 |
|
|
2134 |
;; Do not ;;;###autoload because of conflict with standard tex-mode.el. |
;;;###autoload |
2135 |
(defun tex-mode () |
(TeX-doc) |
2136 |
"Major mode for editing TeX or LaTeX files. |
;;;###autoload |
2137 |
|
(defun TeX-tex-mode () |
2138 |
|
"Major mode in %s for editing TeX or LaTeX files. |
2139 |
Tries to guess whether this file is for plain TeX or LaTeX. |
Tries to guess whether this file is for plain TeX or LaTeX. |
2140 |
|
|
2141 |
The algorithm is as follows: |
The algorithm is as follows: |
2261 |
|
|
2262 |
;;; Plain TeX mode |
;;; Plain TeX mode |
2263 |
|
|
2264 |
;; Do not ;;;###autoload because of conflict with standard tex-mode.el. |
;;;###autoload |
2265 |
(TeX-defun plain-tex-mode () |
(TeX-doc) |
2266 |
|
;;;###autoload |
2267 |
|
(defun TeX-plain-tex-mode () |
2268 |
"Major mode in %s for editing plain TeX files. |
"Major mode in %s for editing plain TeX files. |
2269 |
See info under AUCTeX for documentation. |
See info under AUCTeX for documentation. |
2270 |
|
|
3518 |
(cons "AmS-TeX" plain-TeX-menu-entries)) |
(cons "AmS-TeX" plain-TeX-menu-entries)) |
3519 |
|
|
3520 |
;;;###autoload |
;;;###autoload |
3521 |
(TeX-defun ams-tex-mode () |
(TeX-doc) |
3522 |
|
;;;###autoload |
3523 |
|
(defun ams-tex-mode () |
3524 |
"Major mode in %s for editing AmS-TeX files. |
"Major mode in %s for editing AmS-TeX files. |
3525 |
See info under AUCTeX for documentation. |
See info under AUCTeX for documentation. |
3526 |
|
|
4317 |
`TeX-quote-language' if it is.") |
`TeX-quote-language' if it is.") |
4318 |
(make-variable-buffer-local 'TeX-quote-language) |
(make-variable-buffer-local 'TeX-quote-language) |
4319 |
|
|
|
;;;###autoload |
|
4320 |
(defun TeX-insert-quote (force) |
(defun TeX-insert-quote (force) |
4321 |
"Insert the appropriate quotation marks for TeX. |
"Insert the appropriate quotation marks for TeX. |
4322 |
Inserts the value of `TeX-open-quote' (normally ``) or `TeX-close-quote' |
Inserts the value of `TeX-open-quote' (normally ``) or `TeX-close-quote' |
4383 |
(t |
(t |
4384 |
close-quote))))))) |
close-quote))))))) |
4385 |
|
|
|
;; For the sake of BibTeX... |
|
|
;;; Do not ;;;###autoload because of conflict with standard tex-mode.el. |
|
|
(fset 'tex-insert-quote 'TeX-insert-quote) |
|
|
|
|
4386 |
(defun TeX-insert-punctuation () |
(defun TeX-insert-punctuation () |
4387 |
"Insert point or comma, cleaning up preceding space." |
"Insert point or comma, cleaning up preceding space." |
4388 |
(interactive) |
(interactive) |
4404 |
(defun TeX-goto-info-page () |
(defun TeX-goto-info-page () |
4405 |
"Read documentation for AUCTeX in the info system." |
"Read documentation for AUCTeX in the info system." |
4406 |
(interactive) |
(interactive) |
4407 |
(require 'info) |
(info "auctex")) |
|
(Info-goto-node "(auctex)")) |
|
4408 |
|
|
4409 |
;;;###autoload |
;;;###autoload |
4410 |
(defun TeX-submit-bug-report () |
(defun TeX-submit-bug-report () |
4429 |
'TeX-style-path |
'TeX-style-path |
4430 |
'TeX-auto-save |
'TeX-auto-save |
4431 |
'TeX-parse-self |
'TeX-parse-self |
4432 |
'TeX-master) |
'TeX-master |
4433 |
|
'TeX-command-list) |
4434 |
nil nil |
nil nil |
4435 |
"Remember to cover the basics, that is, what you expected to happen and |
"Remember to cover the basics, that is, what you expected to happen and |
4436 |
what in fact did happen. |
what in fact did happen. |