a02c9d63f2b132f5838f18fd3dab9858506ebbb9
[packages] / xemacs-packages / auctex / tex-site.el
1 ;;; tex-site.el - Site specific variables.  Don't edit.
2
3 ;; Copyright (C) 2005 Free Software Foundation, Inc.
4 ;;
5 ;; completely rewritten.
6
7 ;; Author: David Kastrup <dak@gnu.org>
8 ;; Maintainer: auctex-devel@gnu.org
9 ;; Keywords: tex
10
11 ;; This file is part of AUCTeX.
12
13 ;; AUCTeX is free software; you can redistribute it and/or modify it
14 ;; under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; any later version.
17
18 ;; AUCTeX is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 ;; General Public License for more details.
22
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
25 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 ;; 02110-1301, USA.
27
28 ;;; Commentary:
29
30 ;; This file contains startup code, autoloads and variables adapted to
31 ;; the local site configuration.  It is generated and placed by the
32 ;; installation procedure and should not be edited by hand, nor moved
33 ;; to a different place, as some settings may be established relative
34 ;; to the file.
35
36 ;; All user customization should be done with
37 ;; M-x customize-variable RET
38
39 ;;; Code:
40
41 (if (< emacs-major-version 21)
42   (error "AUCTeX requires Emacs 21 or later"))
43
44 ;; Define here in order for `M-x customize-group <RET> AUCTeX <RET>'
45 ;; to work if the main AUCTeX files are not loaded yet.
46 (defgroup AUCTeX nil
47   "A (La)TeX environment."
48   :tag "AUCTeX"
49   :link '(custom-manual "(auctex)Top")
50   :link '(url-link :tag "Home Page" "http://www.gnu.org/software/auctex/")
51   :prefix "TeX-"
52   :group 'tex
53   :load "tex" :load "latex" :load "tex-style")
54
55 (defvar TeX-lisp-directory
56   (file-name-directory load-file-name)
57   "The directory where most of the AUCTeX lisp files are located.
58 For the location of lisp files associated with
59 styles, see the variables TeX-style-* (hand-generated lisp) and
60 TeX-auto-* (automatically generated lisp).")
61
62 ;; In 99.99% of use cases this is pointless because the AUCTeX lisp
63 ;; directory will already be in the load-path.  Good thing #'add-to-list
64 ;; won't allow dups. --SY.
65 (add-to-list 'load-path TeX-lisp-directory)
66
67 (defvar TeX-data-directory (locate-data-directory "auctex")
68   "The directory where the AUCTeX non-Lisp data is located.")
69
70 ;; System-wide writable directories are a bad idea at the best of
71 ;; times.  Pretty much the only way of doing it even remotely safely
72 ;; is to use 1777 perms on the directory.  Until I, or someone else,
73 ;; update AUCTeX to do that this var will default to nil unless it, or
74 ;; its parent is writable for the user. --SY.
75 (defcustom TeX-auto-global
76   (let ((dir (file-name-as-directory
77               (expand-file-name "auto"
78                                 (locate-data-directory "auctex")))))
79     (or (and (file-writable-p dir) dir)
80         ;; If it doesn't exist but parent is writable, allow it.
81         (and (file-writable-p (file-dirname dir)) dir)))
82   "*Directory containing automatically generated information.
83 Must end with a directory separator.
84
85 For storing automatic extracted information about the TeX macros
86 shared by all users of a site."
87   :group 'TeX-file
88   :type 'directory)
89
90 (defconst TeX-mode-alist
91   '((tex-mode . tex-mode)
92     (plain-tex-mode . tex-mode)
93     (texinfo-mode . texinfo)
94     (latex-mode . tex-mode)
95     (doctex-mode . tex-mode))
96   "Alist of built-in TeX modes and their load files.")
97
98 (defalias 'TeX-load-hack 'ignore)
99
100 (add-hook 'tex-site-unload-hook
101           (lambda ()
102             (let ((list after-load-alist))
103               (while list
104                 ;; Adapted copy of the definition of `assq-delete-all'
105                 ;; from Emacs 21 as substitute for
106                 ;; `(assq-delete-all'TeX-modes-set (car list))' which
107                 ;; fails on non-list elements in Emacs 21.
108                 (let* ((alist (car list))
109                        (tail alist)
110                        (key 'TeX-modes-set))
111                   (while tail
112                     (if (and (consp (car tail))
113                              (eq (car (car tail)) key))
114                         (setq alist (delq (car tail) alist)))
115                     (setq tail (cdr tail))))
116                 (setq list (cdr list))))
117             (setq load-path (delq TeX-lisp-directory load-path))))
118
119 (defun TeX-modes-set (var value &optional update)
120   "Set VAR (which should be `TeX-modes') to VALUE.
121
122 This places either the standard or the AUCTeX versions of
123 functions into the respective function cell of the mode.
124 If UPDATE is set, a previously saved value for
125 the non-AUCTeX function gets overwritten with the current
126 definition."
127   (custom-set-default var value)
128   (let ((list TeX-mode-alist) elt)
129     (while list
130       (setq elt (car (pop list)))
131       (let ((dst (intern (concat "TeX-" (symbol-name elt)))))
132         (if (fboundp 'advice-add)
133             (if (memq elt value)
134                 (advice-add elt :override dst)
135               (advice-remove elt dst))
136           (when (or update (null (get elt 'tex-saved)))
137             (when (fboundp elt)
138               (put elt 'tex-saved (symbol-function elt))))
139           (defalias elt
140             (if (memq elt value)
141                 dst
142               (get elt 'tex-saved))))))))
143
144 (defcustom TeX-modes
145   (mapcar 'car TeX-mode-alist)
146   "List of modes provided by AUCTeX.
147
148 This variable can't be set normally; use customize for that, or
149 set it with `TeX-modes-set'."
150   :type (cons 'set
151               (mapcar (lambda(x) (list 'const (car x))) TeX-mode-alist))
152   :set 'TeX-modes-set
153   :group 'AUCTeX
154   :initialize(lambda (var value)
155                (custom-initialize-reset var value)
156                (unless (fboundp 'advice-add)
157                  (let ((list TeX-mode-alist))
158                    (while list
159                      (eval-after-load (cdar list)
160                        `(TeX-modes-set ',var ,var t))
161                      (setq list (cdr list)))))) )
162
163 (defconst AUCTeX-version "11.92"
164     "AUCTeX version.
165 If not a regular release, the date of the last change.")
166
167 (defconst AUCTeX-date "2017-12-03"
168   "AUCTeX release date using the ISO 8601 format, yyyy-mm-dd.")
169
170 ;; Store bibitems when saving a BibTeX buffer
171 (add-hook 'bibtex-mode-hook 'BibTeX-auto-store)
172
173 (provide 'tex-site)