b02ba548a27396ec7c1fd7ea3b6aaafbc1db2d8f
[packages] / xemacs-packages / auctex / sxepkg.el
1 ;:*=======================
2 ;:* AUCTeX build helper
3
4 (defvar current-file (car (last command-line-args-left))
5   "The name of the file that is about to be byte-compiled.")
6 ;(message "*** The file of the moment is: %s" current-file)
7
8 (defun maybe-fbind (args)
9   (while args
10     (or (fboundp (car args))
11         (defalias (car args) 'ignore))
12     (setq args (cdr args))))
13
14 (defun maybe-bind (args)
15   (mapcar (lambda (var) (unless (boundp var) (set var nil))) args))
16
17 ;;; AUCTeX lisp
18 (when (equal "bib-cite.el" current-file)
19   (maybe-fbind
20    '(dired-split find-tag-noselect font-lock-unset-defaults
21      dired-replace-in-string))
22   (autoload 'LaTeX-bibitem-list "latex")
23   (autoload 'LaTeX-bibliography-list "latex")
24   (autoload 'TeX-auto-write "tex")
25   (autoload 'TeX-master-file "tex" nil t)
26   (autoload 'TeX-split-string "tex")
27   (autoload 'bibtex-mode "bibtex" nil t)
28   (autoload 'reftex-view-crossref "reftex-dcr" nil t)
29   (autoload 'show-entry "outline" nil t)
30   (maybe-bind
31    '(label tags-file-name LaTeX-label-list TeX-master TeX-check-path
32      BibTeX-auto-regexp-list TeX-header-end LaTeX-header-end
33      TeX-auto-save TeX-auto-update TeX-auto-regexp-list)))
34
35 (when (equal "context.el" current-file)
36   (maybe-fbind
37    '(abbrev-table-put easy-menu-return-item metapost-mode)))
38
39 (when (equal "font-latex.el" current-file)
40   (maybe-fbind '(string-make-multibyte set-face-attribute))
41   (maybe-bind
42    '(font-latex-fontify-sectioning font-lock-set-defaults
43      inhibit-point-motion-hooks inhibit-modification-hooks
44      deactivate-mark)))
45
46 (when (equal "latex.el" current-file)
47   (autoload 'LaTeX-install-toolbar "tex-bar" nil t)
48   (autoload 'font-latex-faces-present-p "font-latex")
49   (autoload 'multi-prompt "multi-prompt")
50   (autoload 'multi-prompt-key-value "multi-prompt")
51   (autoload 'outline-level "outline")
52   (autoload 'outline-mark-subtree "outline" nil t)
53   (autoload 'reftex-notice-new-section "reftex-auc")
54   (autoload 'texmathp "texmathp" nil t)
55   (autoload 'texmathp-match-switch "texmathp")
56   (autoload 'turn-off-filladapt-mode "filladapt")
57   (maybe-fbind
58    '(abbrev-table-put char-category-set fill-delete-newlines
59      fill-delete-prefix fill-find-break-point fill-indent-to-left-margin
60      fill-move-to-break-point))
61   (maybe-bind
62    '(BibTeX-auto-regexp-list LaTeX-header-end LaTeX-indent-environment-list
63      LaTeX-math-abbrev-prefix LaTeX-math-default LaTeX-math-list
64      LaTeX-math-mode-hook LaTeX-math-mode-map LaTeX-math-mode-menu
65      LaTeX-math-mode-off-hook LaTeX-math-mode-on-hook LaTeX-paragraph-commands
66      LaTeX-paragraph-commands-regexp LaTeX-section-list-changed
67      LaTeX-section-menu LaTeX-syntactic-comments LaTeX-trailer-start
68      TeX-arg-input-file-search TeX-arg-item-label-p TeX-arg-right-insert-p
69      TeX-global-input-files TeX-sentinel-default-function comment-padding
70      done-mark entry fill-indent-according-to-mode fill-nobreak-invisible
71      filladapt-mode japanese-TeX-mode level mark-active math-sep name
72      outline-heading-alist reftex-ref-macro-prompt title toc tool-bar-mode
73      transient-mark-mode)))
74
75 (when (equal "multi-prompt.el" current-file)
76   (maybe-fbind
77    '(minibuffer-contents-no-properties completion-table-with-context))
78   (maybe-bind
79    '(require-match table)))
80
81 (when (equal "plain-tex.el" current-file)
82   (maybe-fbind '(abbrev-table-put))
83   (autoload 'TeX-install-toolbar "tex-bar" nil t))
84
85 (when (equal "preview.el" current-file)
86   (maybe-bind
87    '(TeX-japanese-process-output-coding-system
88      TeX-japanese-process-output-coding-system context
89      inhibit-field-text-motion inhibit-point-motion-hooks
90      preview-transparent-border preview-transparent-border)))
91
92
93 (when (equal "prv-xemacs.el" current-file)
94   (mapfam :result-type 'void
95           #'(lambda (fn)
96               (autoload fn "preview"))
97           '(preview-filter-specs-1
98             preview-inactive-string
99             preview-filter-specs
100             preview-auto-reveal-p
101             preview-format-kill
102             preview-delete
103             preview-relaxed-string=
104             preview-disable))
105   (maybe-bind
106    '(preview-menu preview-dumped-alist preview-auto-reveal ov)))
107
108 (when (equal "tex-bar.el" current-file)
109   (maybe-bind
110    '(TeX-bar-TeX-all-button-alists TeX-bar-LaTeX-all-button-alists)))
111
112 (defun display-multi-frame-p (&rest GNU) t)
113
114 (when (equal "tex-buf.el" current-file)
115   (autoload 'LaTeX-bibliography-list "latex")
116   (autoload 'button-get "button")
117   (autoload 'comint-exec "comint")
118   (maybe-fbind
119    '(event-start posn-point posn-window select-frame-set-input-focus
120      tabulated-list-get-id tabulated-list-init-header tabulated-list-mode
121      tabulated-list-print window-splittable-p))
122   (maybe-bind
123    '(LaTeX-using-Biber TeX-command-buffer TeX-command-pos
124      TeX-command-text TeX-current-page TeX-current-process-region-p
125      TeX-error-description-list TeX-error-list
126      TeX-error-overview-open-after-TeX-run TeX-parse-all-errors
127      TeX-parse-function TeX-record-buffer TeX-region TeX-save-query
128      TeX-sentinel-default-function TeX-sentinel-function command
129      compilation-in-progress dos-machine-type file font-lock-defaults-alist
130      inhibit-field-text-motion inhibit-point-motion-hooks menu-map
131      orig-buffer shell-command-option tabulated-list-entries
132      tabulated-list-format tabulated-list-padding)))
133
134 (when (equal "tex-fold.el" current-file)
135   (require 'overlay)
136   (maybe-fbind '(jit-lock-fontify-now))
137   (maybe-bind
138    '(TeX-fold-mode-hook TeX-fold-mode-off-hook TeX-fold-mode-on-hook
139      close-string disable-point-adjustment global-disable-point-adjustment
140      jit-lock-mode mark-active)))
141
142 (when (equal "tex-info.el" current-file)
143   (mapfam :result-type 'void
144           #'(lambda (fn)
145               (autoload fn "reftex"))
146           '(reftex-ensure-compiled-variables
147             reftex-match-string
148             reftex-nicify-text))
149   (autoload 'reftex-section-number "reftex-parse")
150   (maybe-bind
151    '(TeX-sentinel-default-function add-log-current-defun-function
152      is-beg-section reftex-label-alist-builtin
153      reftex-label-alist-builtin reftex-mode)))
154
155 (when (equal "tex-mik.el" current-file)
156   (maybe-bind
157    '(TeX-kpathsea-path-delimiter TeX-output-view-style TeX-print-command
158      TeX-printer-list TeX-queue-command TeX-source-specials-view-editor-flags
159      TeX-source-specials-view-position-flags TeX-view-style)))
160
161 (when (equal "tex-site.el" current-file)
162   (maybe-fbind '(advice-add advice-remove)))
163
164 (defun line-number-at-pos (&optional pos)
165   (line-number pos t))
166
167 (when (equal "tex.el" current-file)
168   (autoload 'font-latex-faces-present-p "font-latex")
169   (autoload 'ispell "ispell" nil t)
170   (autoload 'ispell-buffer "ispell" nil t)
171   (autoload 'spell-buffer "spell" nil t)
172   (autoload 'untabify "tabify" nil t)
173   (autoload 'url-generic-parse-url "url-parse")
174   (autoload 'url-hexify-string "url-util")
175   (autoload 'url-unhex-string "url-util")
176   (autoload 'LaTeX-environment-list "latex")
177   (mapfam :result-type 'void
178           #'(lambda (fn)
179               (autoload fn "overlay"))
180           '(overlay-get overlay-start overlays-in))
181   (maybe-fbind
182    '(comment-forward comment-normalize-vars activate-mark deactivate-mark
183      dbus-call-method dbus-get-unique-name dbus-ignore-errors
184      dbus-introspect-get-method dbus-ping dbus-register-signal 
185      TeX-active-master TeX-output-extension))
186   (maybe-bind
187    '(BibLaTeX-global-style-files BibTeX-file-extensions BibTeX-global-files
188      BibTeX-global-style-files LaTeX-global-class-files LaTeX-math-mode
189      LaTeX-optcl LaTeX-optop LaTeX-provided-class-options
190      LaTeX-provided-package-options TeX-Biber-file-extensions
191      TeX-Biber-global-files TeX-Omega-mode-hook TeX-Omega-mode-off-hook
192      TeX-Omega-mode-on-hook TeX-PDF-mode TeX-PDF-mode-hook
193      TeX-PDF-mode-off-hook TeX-PDF-mode-on-hook TeX-PDF-mode-parsed
194      TeX-all-extensions TeX-auto-update TeX-command-default
195      TeX-default-extension TeX-esc TeX-file-extensions TeX-fold-mode
196      TeX-global-input-files TeX-interactive-mode TeX-interactive-mode-hook
197      TeX-interactive-mode-off-hook TeX-interactive-mode-on-hook TeX-macro-global
198      TeX-mode-map TeX-mode-p TeX-output-extension TeX-source-correlate-mode
199      TeX-source-correlate-mode-hook TeX-source-correlate-mode-off-hook
200      TeX-source-correlate-mode-on-hook TeX-source-specials-places
201      TeX-source-specials-tex-flags TeX-synctex-tex-flags comment-end-skip
202      comment-padding comment-use-syntax compile-command crm-separator
203      deactivate-mark err exit-mark file found gnuserv-process
204      hilit-patterns-alist ispell-enable-tex-parser ispell-tex-p japanese-TeX-mode
205      last-optional-rejected mark-active name reporter-prompt-for-summary-p
206      server-process texmathp-why transient-mark-mode upcase url-unreserved-chars
207      user-emacs-directory)))
208
209
210 (when (equal "toolbar-x.el" current-file)
211   (maybe-fbind '(define-key-after create-image find-image)))
212
213 (when (equal "tex-jp.el" current-file)
214   (maybe-bind
215    '(TeX-command-buffer japanese-TeX-mode
216      TeX-japanese-process-output-coding-system
217      TeX-japanese-process-input-coding-system TeX-error-description-list)))
218
219 ;; custom-defines loooooves to spit tonnes of warnings
220 (when (equal "custom-defines.el" current-file)
221   (require 'advice)
222   (autoload 'font-latex-update-sectioning-faces "font-latex")
223   (autoload 'TeX-sort-strings "tex")
224   (autoload 'TeX-parse-path "tex")
225   (autoload 'TeX-macro-private "tex")
226   (autoload 'TeX-delete-duplicate-strings "tex")
227   (autoload 'LaTeX-paragraph-commands-regexp-make "latex")
228   (autoload 'LaTeX-math-initialize "latex")
229   (maybe-fbind
230    '(preview-set-texinputs))
231   (maybe-bind
232    '(font-latex-sectioning-max font-latex-built-in-keyword-classes
233      LaTeX-paragraph-commands-regexp LaTeX-math-default
234      shell-command-option TeX-mode-alist TeX-data-directory
235      user-emacs-directory)))
236
237 ;;; Style Files
238 (when (string-match "style/" current-file)
239   (load "tex")
240   (load "latex")
241   (load "reftex")
242   (load "reftex-auc")
243   (load-file "style/pstricks.el")
244   (autoload 'font-latex-add-keywords "font-latex")
245   (autoload 'font-latex-add-quotes "font-latex")
246   (autoload 'font-latex-set-syntactic-keywords "font-latex")
247   (maybe-fbind
248    '(coding-system-equal insert-pair latexenc-coding-system-to-inputenc
249      latexenc-inputenc-to-coding-system reftex-add-to-label-alist
250      reftex-ref-style-activate))
251   (maybe-bind '(font-lock-set-defaults)))
252
253 (when (equal "style/pstricks.el" current-file)
254   (autoload 'multi-prompt-key-value "multi-prompt")
255   (maybe-bind '(beg)))
256
257 (when (equal "style/pdfsync.el" current-file)
258   (autoload 'TeX-active-master "tex-buf"))
259
260 (when (string-match 
261        #r"style/\(shortvrb\|n?german\)\.el" current-file)
262   (autoload 'font-latex-add-to-syntax-alist "font-latex"))
263
264 (when (equal "style/kpfonts.el" current-file)
265   ;; #'decode-char is from mule-ucs. Soooo don't wanna include that
266   ;; for just one style file. --SY.
267   (maybe-fbind '(decode-char))
268   (maybe-bind
269    '(LaTeX-kpfonts-mode-menu LaTeX-kpfonts-mode-map
270      LaTeX-kpfonts-mode-hook LaTeX-kpfonts-mode-on-hook
271      LaTeX-kpfonts-mode-off-hook)))
272
273 (when (equal "style/italian.el" current-file)
274   (maybe-bind '(LaTeX-italian-open-quote LaTeX-italian-close-quote)))
275
276 (when (equal "style/prosper.el" current-file)
277   (maybe-bind '(LaTeX-prosper-transition-history)))
278
279 (when (equal "style/inputenc.el" current-file)
280   (maybe-bind '(latex-inputenc-coding-alist)))
281
282 (when (equal "style/mathtools.el" current-file)
283   (maybe-bind '(LaTeX-amsmath-package-options)))
284
285 (when (equal "style/pdfsync.el" current-file)
286   (maybe-bind '(sync-line)))
287
288 (when (string-match "style/n?german\\.el" current-file)
289   (maybe-bind
290    '(LaTeX-german-open-quote LaTeX-german-close-quote
291      LaTeX-german-quote-after-quote)))
292
293 (when (equal "style/emp.el" current-file)
294   (maybe-bind '(LaTeX-emp-fig-name LaTeX-emp-file-name
295                 mpost-emp-file-name)))
296
297 (when (equal "style/biblatex.el" current-file)
298   (autoload 'TeX-read-string "tex"))
299
300 (when (equal "style/dinbrief.el" current-file)
301   (autoload 'TeX-mark-active "tex"))
302
303 (when (equal "style/doc.el" current-file)
304   (autoload 'TeX-active-mark "tex"))