;:*======================= ;:* AUCTeX build helper (defvar current-file (car (last command-line-args-left)) "The name of the file that is about to be byte-compiled.") ;(message "*** The file of the moment is: %s" current-file) (defun maybe-fbind (args) (while args (or (fboundp (car args)) (defalias (car args) 'ignore)) (setq args (cdr args)))) (defun maybe-bind (args) (mapcar (lambda (var) (unless (boundp var) (set var nil))) args)) ;; From GNU Emacs' byte-run.el (unless (fboundp 'with-no-warnings) (defun with-no-warnings (&rest body) (car (last body)))) ;;; AUCTeX lisp (when (equal "bib-cite.el" current-file) (maybe-fbind '(dired-split find-tag-noselect dired-replace-in-string)) (autoload 'LaTeX-bibitem-list "latex") (autoload 'LaTeX-bibliography-list "latex") (autoload 'TeX-auto-write "tex") (autoload 'TeX-master-file "tex" nil t) (autoload 'TeX-split-string "tex") (autoload 'bibtex-mode "bibtex" nil t) (autoload 'reftex-view-crossref "reftex-dcr" nil t) (autoload 'show-entry "outline" nil t) (maybe-bind '(label tags-file-name LaTeX-label-list TeX-master TeX-check-path BibTeX-auto-regexp-list TeX-header-end LaTeX-header-end TeX-auto-save TeX-auto-update TeX-auto-regexp-list))) (when (equal "context.el" current-file) (autoload 'TeX-read-string "tex") (autoload 'TeX-active-mark "tex") (autoload 'TeX-activate-region "tex") (maybe-fbind '(abbrev-table-put easy-menu-return-item metapost-mode)) (maybe-bind '(ConTeXt-extra-paragraph-commands))) (when (equal "font-latex.el" current-file) (maybe-fbind '(string-make-multibyte set-face-attribute)) (maybe-bind '(font-latex-fontify-sectioning font-lock-set-defaults inhibit-point-motion-hooks inhibit-modification-hooks deactivate-mark prettify-symbols-mode prettify-symbols--keywords file-local-variables-alist LaTeX-verbatim-environments-local LaTeX-verbatim-macros-with-braces-local LaTeX-verbatim-macros-with-delims-local))) (when (equal "latex.el" current-file) (autoload 'LaTeX-install-toolbar "tex-bar" nil t) (autoload 'font-latex-faces-present-p "font-latex") (autoload 'multi-prompt "multi-prompt") (autoload 'multi-prompt-key-value "multi-prompt") (autoload 'outline-level "outline") (autoload 'outline-mark-subtree "outline" nil t) (autoload 'reftex-notice-new-section "reftex-auc") (autoload 'texmathp "texmathp" nil t) (autoload 'texmathp-match-switch "texmathp") (autoload 'turn-off-filladapt-mode "filladapt") (maybe-fbind '(abbrev-table-put char-category-set fill-delete-newlines fill-delete-prefix fill-find-break-point fill-indent-to-left-margin fill-move-to-break-point format-message)) (maybe-bind '(BibTeX-auto-regexp-list LaTeX-header-end LaTeX-indent-environment-list LaTeX-math-abbrev-prefix LaTeX-math-default LaTeX-math-list LaTeX-math-mode-hook LaTeX-math-mode-map LaTeX-math-mode-menu LaTeX-math-mode-off-hook LaTeX-math-mode-on-hook LaTeX-paragraph-commands LaTeX-paragraph-commands-regexp LaTeX-section-list-changed LaTeX-section-menu LaTeX-syntactic-comments LaTeX-trailer-start TeX-arg-input-file-search TeX-arg-item-label-p TeX-arg-right-insert-p TeX-global-input-files TeX-sentinel-default-function comment-padding done-mark entry fill-indent-according-to-mode fill-nobreak-invisible filladapt-mode japanese-TeX-mode level mark-active math-sep name outline-heading-alist reftex-ref-macro-prompt title toc tool-bar-mode transient-mark-mode))) (when (equal "multi-prompt.el" current-file) (maybe-fbind '(minibuffer-contents-no-properties completion-table-with-context)) (maybe-bind '(require-match table))) (when (equal "plain-tex.el" current-file) (maybe-fbind '(abbrev-table-put)) (autoload 'TeX-install-toolbar "tex-bar" nil t)) (when (equal "preview.el" current-file) (maybe-fbind '(byte-to-string)) (maybe-bind '(TeX-japanese-process-output-coding-system TeX-japanese-process-output-coding-system context inhibit-field-text-motion inhibit-point-motion-hooks preview-transparent-border preview-transparent-border))) (when (equal "prv-xemacs.el" current-file) (mapfam :result-type 'void #'(lambda (fn) (autoload fn "preview")) '(preview-filter-specs-1 preview-inactive-string preview-filter-specs preview-auto-reveal-p preview-format-kill preview-delete preview-relaxed-string= preview-disable)) (maybe-bind '(preview-menu preview-dumped-alist preview-auto-reveal ov))) (when (equal "tex-bar.el" current-file) (maybe-bind '(TeX-bar-TeX-all-button-alists TeX-bar-LaTeX-all-button-alists))) (defun display-multi-frame-p (&rest GNU) t) (when (equal "tex-buf.el" current-file) (autoload 'LaTeX-bibliography-list "latex") (autoload 'button-get "button") (autoload 'comint-exec "comint") (maybe-fbind '(event-start posn-point posn-window select-frame-set-input-focus tabulated-list-get-id tabulated-list-init-header tabulated-list-mode tabulated-list-print window-splittable-p add-file-local-variable japanese-TeX-set-process-coding-system TeX-special-mode)) (maybe-bind '(LaTeX-using-Biber TeX-command-buffer TeX-command-pos TeX-command-text TeX-current-page TeX-current-process-region-p TeX-error-description-list TeX-error-list TeX-error-overview-open-after-TeX-run TeX-parse-all-errors TeX-parse-function TeX-record-buffer TeX-region TeX-save-query TeX-sentinel-default-function TeX-sentinel-function command compilation-in-progress dos-machine-type file font-lock-defaults-alist inhibit-field-text-motion inhibit-point-motion-hooks menu-map orig-buffer shell-command-option tabulated-list-entries tabulated-list-format tabulated-list-padding japanese-TeX-mode ConTeXt-Mark-version magic-mode-alist find-file-hook))) (when (equal "tex-fold.el" current-file) (require 'overlay) (maybe-fbind '(jit-lock-fontify-now)) (maybe-bind '(TeX-fold-mode-hook TeX-fold-mode-off-hook TeX-fold-mode-on-hook close-string disable-point-adjustment global-disable-point-adjustment jit-lock-mode mark-active))) (when (equal "tex-info.el" current-file) (mapfam :result-type 'void #'(lambda (fn) (autoload fn "reftex")) '(reftex-ensure-compiled-variables reftex-match-string reftex-nicify-text)) (autoload 'reftex-section-number "reftex-parse") (maybe-bind '(TeX-sentinel-default-function add-log-current-defun-function is-beg-section reftex-label-alist-builtin reftex-label-alist-builtin reftex-mode))) (when (equal "tex-jp.el" current-file) (autoload 'font-latex-add-keywords "font-latex") (maybe-fbind '(get-coding-system-from-locale current-locale)) (maybe-bind '(TeX-command-buffer japanese-TeX-mode TeX-japanese-process-output-coding-system TeX-japanese-process-input-coding-system TeX-error-description-list locale-coding-system))) (when (equal "tex-mik.el" current-file) (maybe-bind '(TeX-kpathsea-path-delimiter TeX-output-view-style TeX-print-command TeX-printer-list TeX-queue-command TeX-source-specials-view-editor-flags TeX-source-specials-view-position-flags TeX-view-style))) (defun line-number-at-pos (&optional pos) (line-number pos t)) (when (equal "tex-wizard.el" current-file) (maybe-fbind '(info-other-window)) (maybe-bind '(LaTeX-mode-hook latex-mode-hook reftex-plug-into-AUCTeX))) (when (equal "tex.el" current-file) (autoload 'font-latex-faces-present-p "font-latex") (autoload 'ispell "ispell" nil t) (autoload 'ispell-buffer "ispell" nil t) (autoload 'spell-buffer "spell" nil t) (autoload 'untabify "tabify" nil t) (autoload 'url-generic-parse-url "url-parse") (autoload 'url-hexify-string "url-util") (autoload 'url-unhex-string "url-util") (autoload 'LaTeX-environment-list "latex") (autoload 'LaTeX-verbatim-macros-with-delims "latex") (autoload 'TeX-command-expand "tex-buf") (autoload 'TeX-pop-to-buffer "tex-buf") (defalias 'x-focus-frame 'focus-frame) (mapfam :result-type 'void #'(lambda (fn) (autoload fn "overlay")) '(overlay-get overlay-start overlays-in)) (maybe-fbind '(comment-forward comment-normalize-vars activate-mark deactivate-mark dbus-call-method dbus-get-unique-name dbus-ignore-errors dbus-introspect-get-method dbus-ping dbus-register-signal TeX-active-master TeX-output-extension deactivate-input-method pdf-sync-forward-search quit-window select-frame-set-input-focus url-encode-url tex--prettify-symbols-compose-p)) (maybe-bind '(BibLaTeX-global-style-files BibTeX-file-extensions BibTeX-global-files BibTeX-global-style-files LaTeX-global-class-files LaTeX-math-mode LaTeX-optcl LaTeX-optop LaTeX-provided-class-options LaTeX-provided-package-options TeX-Biber-file-extensions TeX-Biber-global-files TeX-Omega-mode-hook TeX-Omega-mode-off-hook TeX-Omega-mode-on-hook TeX-PDF-mode TeX-PDF-mode-hook TeX-PDF-mode-off-hook TeX-PDF-mode-on-hook TeX-PDF-mode-parsed TeX-all-extensions TeX-auto-update TeX-command-default TeX-default-extension TeX-esc TeX-file-extensions TeX-fold-mode TeX-global-input-files TeX-interactive-mode TeX-interactive-mode-hook TeX-interactive-mode-off-hook TeX-interactive-mode-on-hook TeX-macro-global TeX-mode-map TeX-mode-p TeX-output-extension TeX-source-correlate-mode TeX-source-correlate-mode-hook TeX-source-correlate-mode-off-hook TeX-source-correlate-mode-on-hook TeX-source-specials-places TeX-source-specials-tex-flags TeX-synctex-tex-flags comment-end-skip comment-padding comment-use-syntax compile-command crm-separator deactivate-mark err exit-mark file found gnuserv-process hilit-patterns-alist ispell-enable-tex-parser ispell-tex-p japanese-TeX-mode last-optional-rejected mark-active name reporter-prompt-for-summary-p server-process texmathp-why transient-mark-mode upcase url-unreserved-chars user-emacs-directory LaTeX-default-verb-delimiter LaTeX-verbatim-environments-local LaTeX-verbatim-macros-with-braces-local LaTeX-verbatim-macros-with-delims-local TeX-current-process-region-p TeX-ispell-verb-delimiters TeX-region TeX-region-orig-buffer crm-completion-table crm-local-completion-map crm-local-must-match-map dbus-debug doc file tex--prettify-symbols-alist))) (when (equal "toolbar-x.el" current-file) (maybe-fbind '(define-key-after create-image find-image toolbarx-emacs-mount-popup-menu toolbarx-emacs-refresh))) ;; custom-defines loooooves to spit tonnes of warnings (when (equal "custom-defines.el" current-file) (require 'advice) (autoload 'font-latex-update-sectioning-faces "font-latex") (autoload 'TeX-sort-strings "tex") (autoload 'TeX-parse-path "tex") (autoload 'TeX-macro-private "tex") (autoload 'TeX-delete-duplicate-strings "tex") (autoload 'LaTeX-paragraph-commands-regexp-make "latex") (autoload 'LaTeX-math-initialize "latex") (maybe-fbind '(preview-set-texinputs)) (maybe-bind '(font-latex-sectioning-max font-latex-built-in-keyword-classes LaTeX-paragraph-commands-regexp LaTeX-math-default shell-command-option TeX-mode-alist TeX-data-directory TeX-clean-default-intermediate-suffixes user-emacs-directory))) ;;; Style Files (when (string-match "style/" current-file) (load "tex") (load "latex") (load "reftex") (load "reftex-auc") (load-file "style/pstricks.el") (autoload 'font-latex-add-keywords "font-latex") (autoload 'font-latex-add-quotes "font-latex") (autoload 'font-latex-set-syntactic-keywords "font-latex") (autoload 'font-latex-update-font-lock "font-latex") (autoload 'TeX-check-engine-add-engines "tex-buf") (autoload 'TeX-read-string "tex") (maybe-fbind '(coding-system-equal insert-pair latexenc-coding-system-to-inputenc latexenc-inputenc-to-coding-system reftex-add-to-label-alist reftex-ref-style-activate)) (maybe-bind '(font-lock-set-defaults LaTeX-caption-key-val-options LaTeX-caption-key-val-options-local LaTeX-fancyvrb-key-val-options-local LaTeX-graphicx-package-options LaTeX-tcolorbox-keyval-options-full LaTeX-article-class-options LaTeX-bicaption-key-val-options LaTeX-caption-supported-float-types LaTeX-italian-close-quote LaTeX-italian-open-quote LaTeX-mathtools-package-options LaTeX-subcaption-key-val-options LaTeX-tcolorbox-keyval-options-local TeX-TikZ-point-function-map TeX-check-engine-list environment exit-mark reftex-label-regexps))) (when (equal "style/empheq.el" current-file) (load-file "style/amsmath.el")) (when (equal "style/gloss-italian.el" current-file) (load-file "style/polyglossia.el")) (when (equal "style/graphics.el" current-file) (maybe-bind '(LaTeX-graphics-package-options))) (when (equal "style/minted.el" current-file) (maybe-fbind '(LaTeX-add-newfloat-DeclareFloatingEnvironments))) (when (equal "style/pstricks.el" current-file) (autoload 'multi-prompt-key-value "multi-prompt") (maybe-bind '(beg))) (when (equal "style/pdfsync.el" current-file) (autoload 'TeX-active-master "tex-buf")) (when (string-match #r"style/\(shortvrb\|n?german\)\.el" current-file) (autoload 'font-latex-add-to-syntax-alist "font-latex")) (when (equal "style/kpfonts.el" current-file) ;; #'decode-char is from mule-ucs. Soooo don't wanna include that ;; for just one style file. --SY. (maybe-fbind '(decode-char)) (maybe-bind '(LaTeX-kpfonts-mode-menu LaTeX-kpfonts-mode-map LaTeX-kpfonts-mode-hook LaTeX-kpfonts-mode-on-hook LaTeX-kpfonts-mode-off-hook))) (when (equal "style/italian.el" current-file) (maybe-bind '(LaTeX-italian-open-quote LaTeX-italian-close-quote))) (when (equal "style/prosper.el" current-file) (maybe-bind '(LaTeX-prosper-transition-history))) (when (equal "style/inputenc.el" current-file) (maybe-bind '(latex-inputenc-coding-alist))) (when (equal "style/mathtools.el" current-file) (maybe-bind '(LaTeX-amsmath-package-options))) (when (equal "style/pdfsync.el" current-file) (maybe-bind '(sync-line))) (when (string-match "style/n?german\\.el" current-file) (maybe-bind '(LaTeX-german-open-quote LaTeX-german-close-quote LaTeX-german-quote-after-quote))) (when (equal "style/emp.el" current-file) (maybe-bind '(LaTeX-emp-fig-name LaTeX-emp-file-name mpost-emp-file-name))) (when (equal "style/dinbrief.el" current-file) (autoload 'TeX-mark-active "tex")) (when (equal "style/doc.el" current-file) (autoload 'TeX-active-mark "tex")) (when (equal "style/tcolorbox.el" current-file) (maybe-fbind '(LaTeX-xcolor-definecolor-list))) (when (string-match #r"style/\(bi\)?caption\.el" current-file) (load-file "style/babel.el") (load-file "style/polyglossia.el") (maybe-fbind '(LaTeX-newfloat-DeclareFloatingEnvironment-list)))