branch: externals/auctex commit e07380983065209f7e7bc6d6a8215758a725cf8a Author: Ikumi Keita <ik...@ikumi.que.jp> Commit: Ikumi Keita <ik...@ikumi.que.jp>
Commit for LaTeX mode and docTeX mode * latex.el: * tex.el: * font-latex.el: * preview.el.in: * tests/latex/latex-test.el: * tests/tex/command-expansion.el: * tex-bar.el: * texmathp.el: Change major mode names. latex-mode -> LaTeX-mode doctex-mode -> docTeX-mode --- font-latex.el | 16 ++++----- latex.el | 77 ++++++++++++++++++++---------------------- preview.el.in | 14 ++++---- tests/latex/latex-test.el | 16 ++++----- tests/tex/command-expansion.el | 2 +- tex-bar.el | 2 +- tex.el | 70 +++++++++++++++++++------------------- texmathp.el | 2 +- 8 files changed, 97 insertions(+), 102 deletions(-) diff --git a/font-latex.el b/font-latex.el index ee6d06f85d..29b5c888fc 100644 --- a/font-latex.el +++ b/font-latex.el @@ -1286,7 +1286,7 @@ triggers Font Lock to recognize the change." (defun font-latex--make-syntax-propertize-function () "Return a `syntax-propertize-function' for (La|Doc)TeX documents." - (let ((kws ;; (if (derived-mode-p 'doctex-mode) + (let ((kws ;; (if (derived-mode-p 'docTeX-mode) ;; font-latex-doctex-syntactic-keywords font-latex-syntactic-keywords)) ;; ) (syntax-propertize-via-font-lock kws))) @@ -1301,7 +1301,7 @@ triggers Font Lock to recognize the change." ;; The test for `major-mode' currently only works with docTeX mode ;; because `TeX-install-font-lock' is called explicitly in - ;; `doctex-mode'. In case other modes have to be distinguished as + ;; `docTeX-mode'. In case other modes have to be distinguished as ;; well, remove the call to `TeX-install-font-lock' from ;; `VirTeX-common-initialization' and place it in the different ;; `xxx-mode' calls instead, but _after_ `major-mode' is set. @@ -1325,7 +1325,7 @@ triggers Font Lock to recognize the change." syntax-propertize-wholelines font-latex-sp-extend-region-backwards-verb-env)))) ;; Add the mode-dependent stuff to the basic variables defined above. - (if (eq major-mode 'doctex-mode) + (if (eq major-mode 'docTeX-mode) (progn (setcar defaults (append (car defaults) '(font-latex-doctex-keywords))) @@ -1430,7 +1430,7 @@ OPENCHAR is the opening character and CLOSECHAR is the closing character. Character pairs are usually { } or [ ]. Comments are ignored during the search." (let ((parse-sexp-ignore-comments - (not (eq major-mode 'doctex-mode))) ; scan-sexps ignores comments + (not (eq major-mode 'docTeX-mode))) ; scan-sexps ignores comments (init-point (point)) (mycount 1) (esc-char (or (and (boundp 'TeX-esc) TeX-esc) "\\")) @@ -1483,7 +1483,7 @@ ignored during the search." (forward-line 0) (if (and (eq (char-after) ?\%) (not (font-latex-faces-present-p 'font-latex-verbatim-face))) - (not (eq major-mode 'doctex-mode)) + (not (eq major-mode 'docTeX-mode)) (catch 'found (while (progn (skip-chars-forward "^%" limit) (< (point) limit)) @@ -1511,7 +1511,7 @@ If POS is omitted, the current position of point is used." (defun font-latex-forward-comment () "Like `forward-comment' but with special provisions for docTeX mode. In docTeX mode \"%\" at the start of a line will be treated as whitespace." - (if (eq major-mode 'doctex-mode) + (if (eq major-mode 'docTeX-mode) ;; XXX: We should probably cater for ^^A as well. (progn (while (progn (if (bolp) (skip-chars-forward "%")) @@ -1538,7 +1538,7 @@ Set this to nil if verification of command syntax is unwanted.") '((?\[ . ?\]) (?< . ?>) (?\( . ?\))) "List character pairs used as delimiters for optional arguments.") -(defvar font-latex-syntax-error-modes '(latex-mode) +(defvar font-latex-syntax-error-modes '(LaTeX-mode) "List of modes where syntax errors in macros should be indicated.") (defun font-latex-match-command-with-arguments (regexp keywords face limit) @@ -1768,7 +1768,7 @@ cases.") (pos (funcall search))) (while (and pos (member (match-string 1) - (if (eq major-mode 'doctex-mode) + (if (eq major-mode 'docTeX-mode) (remove "_" font-latex-match-simple-exclude-list) font-latex-match-simple-exclude-list))) (setq pos (funcall search))) diff --git a/latex.el b/latex.el index cf2518b2d0..a19564f1b1 100644 --- a/latex.el +++ b/latex.el @@ -941,7 +941,7 @@ Assume the current point is on neither \"begin{foo}\" nor \"end{foo}\"." ;; comment-prefix. Hence, the next check just looks ;; if we're inside such a group and returns non-nil to ;; recognize such a situation. - (and (eq major-mode 'doctex-mode) + (and (eq major-mode 'docTeX-mode) (looking-at-p (concat (regexp-quote TeX-esc) "\\(?:begin\\|end\\) *{macrocode\\*?}")))) (setq arg (if (= (char-after (match-beginning 1)) ?e) @@ -3910,7 +3910,7 @@ consideration just as is in the non-commented source code." ;; ;; Comments can be filled syntax-aware or not. ;; -;; In `doctex-mode' line comments should always be indented +;; In `docTeX-mode' line comments should always be indented ;; syntax-aware and the comment character has to be anchored at the ;; first column (unless the appear in a macrocode environment). Other ;; comments not in the documentation parts always start after the @@ -3921,7 +3921,7 @@ consideration just as is in the non-commented source code." ;; `LaTeX-syntactic-comments' disabled, line comments should still be ;; indented syntax-aware. ;; -;; In `latex-mode' comments starting in different columns don't have +;; In `LaTeX-mode' comments starting in different columns don't have ;; to be handled differently. They don't have to be anchored in ;; column one. That means that in any case indentation before and ;; after the comment characters has to be checked and adjusted. @@ -4199,9 +4199,9 @@ Lines starting with an item is given an extra indentation of (concat (match-string 0) (TeX-comment-padding-string)))))) (save-excursion (cond ((and fill-prefix - (eq major-mode 'doctex-mode) + (eq major-mode 'docTeX-mode) (TeX-in-line-comment)) - ;; If point is in a line comment in `doctex-mode' we only + ;; If point is in a line comment in `docTeX-mode' we only ;; consider the inner indentation. An exception is when ;; we're inside a verbatim environment where we don't ;; want to touch the indentation, notably with a @@ -4275,7 +4275,7 @@ outer indentation in case of a commented line. The symbols entry found) (cond ((save-excursion (beginning-of-line) (bobp)) 0) - ((and (eq major-mode 'doctex-mode) + ((and (eq major-mode 'docTeX-mode) fill-prefix (TeX-in-line-comment) (progn @@ -4391,7 +4391,7 @@ outer indentation in case of a commented line. The symbols comment-current-flag comment-last-flag (indent-across-comments (or docTeX-indent-across-comments - (not (eq major-mode 'doctex-mode))))) + (not (eq major-mode 'docTeX-mode))))) (beginning-of-line) (setq line-comment-current-flag (TeX-in-line-comment) comment-current-flag (TeX-in-commented-line)) @@ -4420,7 +4420,7 @@ outer indentation in case of a commented line. The symbols ;; code comments). Additionally we don't want to compute inner ;; indentation when a commented and a non-commented line are ;; compared. - (cond ((or (and (eq major-mode 'doctex-mode) + (cond ((or (and (eq major-mode 'docTeX-mode) (or (and line-comment-current-flag (not line-comment-last-flag)) (and (not line-comment-current-flag) @@ -4441,7 +4441,7 @@ outer indentation in case of a commented line. The symbols ;; Some people have opening braces at the end of the ;; line, e.g. in case of `\begin{letter}{%'. (TeX-brace-count-line))) - ((and (eq major-mode 'doctex-mode) + ((and (eq major-mode 'docTeX-mode) (looking-at (concat (regexp-quote TeX-esc) "end[ \t]*{macrocode\\*?}")) fill-prefix @@ -4530,11 +4530,11 @@ outer indentation in case of a commented line. The symbols ;; If `LaTeX-syntactic-comments' is not enabled, ;; do conventional indentation LaTeX-syntactic-comments - ;; Line comments in `doctex-mode' are always + ;; Line comments in `docTeX-mode' are always ;; indented syntax-aware so we need their inner ;; indentation. (and (TeX-in-line-comment) - (eq major-mode 'doctex-mode)))))) + (eq major-mode 'docTeX-mode)))))) ;; INNER indentation (save-excursion (beginning-of-line) @@ -4558,7 +4558,7 @@ recognized." (eq force-type 'inner)) (and (not force-type) (or (and (TeX-in-line-comment) - (eq major-mode 'doctex-mode)) + (eq major-mode 'docTeX-mode)) (and (TeX-in-commented-line) ;; Only move after the % if we're not ;; performing a newline command (bug#47757). @@ -5163,11 +5163,11 @@ depends on the value of `LaTeX-syntactic-comments'." ;; Syntax-aware filling: ;; * `LaTeX-syntactic-comments' enabled: Everything. ;; * `LaTeX-syntactic-comments' disabled: Uncommented code and - ;; line comments in `doctex-mode'. + ;; line comments in `docTeX-mode'. ((or (or LaTeX-syntactic-comments (and (not LaTeX-syntactic-comments) (not has-comment))) - (and (eq major-mode 'doctex-mode) + (and (eq major-mode 'docTeX-mode) (TeX-in-line-comment))) (let ((fill-prefix comment-fill-prefix)) (save-excursion @@ -5341,7 +5341,7 @@ environment in commented regions with the same comment prefix." ;; comment-prefix. Hence, the next check just looks ;; if we're inside such a group and returns non-nil to ;; recognize such a situation. - (and (eq major-mode 'doctex-mode) + (and (eq major-mode 'docTeX-mode) (looking-at-p " *{macrocode\\*?}"))) (setq level (if (= (char-after (match-beginning 1)) ?b) ;;begin @@ -6395,6 +6395,7 @@ commands are defined: :lighter nil :keymap (list (cons (LaTeX-math-abbrev-prefix) LaTeX-math-keymap)) (TeX-set-mode-name)) +;; FIXME: Is this still necessary? (defalias 'latex-math-mode #'LaTeX-math-mode) (easy-menu-define LaTeX-math-mode-menu @@ -6693,7 +6694,7 @@ corresponds to the variables `LaTeX-environment-menu-name' and (easy-menu-define LaTeX-mode-command-menu LaTeX-mode-map "Command menu used in LaTeX mode." - (TeX-mode-specific-command-menu 'latex-mode)) + (TeX-mode-specific-command-menu 'LaTeX-mode)) (easy-menu-define LaTeX-mode-menu LaTeX-mode-map @@ -7857,19 +7858,26 @@ This happens when \\left is inserted." :type 'hook :group 'LaTeX) -(TeX-abbrev-mode-setup latex-mode) +(TeX-abbrev-mode-setup LaTeX-mode) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.drv\\'" . latex-mode) t) ;; append to the end of `auto-mode-alist' to give higher priority to Guix/Nix's derivation modes +(add-to-list 'auto-mode-alist '("\\.drv\\'" . LaTeX-mode) t) ;; append to the end of `auto-mode-alist' to give higher priority to Guix/Nix's derivation modes ;; HeVeA files (LaTeX -> HTML converter: http://hevea.inria.fr/) ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.hva\\'" . latex-mode)) +(add-to-list 'auto-mode-alist '("\\.hva\\'" . LaTeX-mode)) (declare-function LaTeX-preview-setup "preview") +;; We want to use `LaTeX-mode' as the function name. However, it is +;; overwritten when tex-mode.el, prior to Emacs 29, is loaded afterwards +;; because it has non-commented out (defalias 'LaTeX-mode +;; #'latex-mode) in it. +;; When the least supported emacsen version becomes 29, we can safely +;; transform this definition to `(define-derived-mode LaTeX-mode +;; text-mode ...)' and remove defaliases for compatibility. ;;;###autoload -(defun TeX-latex-mode () +(defun TeX-LaTeX-mode () ;; FIXME: Use `define-derived-mode'. "Major mode in AUCTeX for editing LaTeX files. See info under AUCTeX for full documentation. @@ -7883,7 +7891,7 @@ of `LaTeX-mode-hook'." (interactive) (LaTeX-common-initialization) (setq TeX-base-mode-name "LaTeX") - (setq major-mode 'latex-mode) + (setq major-mode 'LaTeX-mode) (setq TeX-command-default "LaTeX") (setq TeX-sentinel-default-function #'TeX-LaTeX-sentinel) (add-hook 'tool-bar-mode-hook #'LaTeX-maybe-install-toolbar nil t) @@ -7920,18 +7928,19 @@ of `LaTeX-mode-hook'." ;; Set up flymake backend, see latex-flymake.el (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t)) -(TeX-abbrev-mode-setup doctex-mode) - +;; COMPATIBILITY for Emacs<29 +;; Override defalias in tex-mode.el. ;;;###autoload -(add-to-list 'auto-mode-alist '("\\.dtx\\'" . doctex-mode)) +(defalias 'LaTeX-mode #'TeX-LaTeX-mode) + +(TeX-abbrev-mode-setup docTeX-mode) ;;;###autoload -(define-derived-mode docTeX-mode TeX-latex-mode "docTeX" +(define-derived-mode docTeX-mode LaTeX-mode "docTeX" "Major mode in AUCTeX for editing .dtx files derived from `LaTeX-mode'. Runs `LaTeX-mode', sets a few variables and runs the hooks in `docTeX-mode-hook'." - :abbrev-table doctex-mode-abbrev-table - (setq major-mode 'doctex-mode) + :abbrev-table docTeX-mode-abbrev-table (set (make-local-variable 'LaTeX-insert-into-comments) t) (set (make-local-variable 'LaTeX-syntactic-comments) t) (setq TeX-default-extension docTeX-default-extension) @@ -7943,18 +7952,6 @@ runs the hooks in `docTeX-mode-hook'." (TeX-set-mode-name) (funcall TeX-install-font-lock)) -;;This is actually a mess: to fit the scheme properly, our derived -;;mode definition would have had to be made for TeX-doctex-mode in the -;;first place, but then we could not have used define-derived-mode, or -;;all mode-specific variables would have gotten non-AUCTeX names. -;;This solution has the advantage that documentation strings are -;;provided in the autoloads, and has the disadvantage that docTeX-mode -;;is not aliased to doctex-mode (not even when the AUCTeX version is -;;disabled) as would be normal for our scheme. - -;;;###autoload -(defalias 'TeX-doctex-mode #'docTeX-mode) - (defcustom docTeX-clean-intermediate-suffixes TeX-clean-default-intermediate-suffixes "List of regexps matching suffixes of files to be deleted. @@ -8004,7 +8001,7 @@ function would return non-nil and `(match-string 1)' would return (set-syntax-table LaTeX-mode-syntax-table) (set (make-local-variable 'indent-line-function) #'LaTeX-indent-line) - (setq local-abbrev-table latex-mode-abbrev-table) + (setq local-abbrev-table LaTeX-mode-abbrev-table) ;; Filling (set (make-local-variable 'paragraph-ignore-fill-prefix) t) diff --git a/preview.el.in b/preview.el.in index 01fa864c97..1c5351dae4 100644 --- a/preview.el.in +++ b/preview.el.in @@ -2272,7 +2272,7 @@ has FUNC called with its current buffer being set to it." (with-current-buffer (pop buffers) (when (or (memq (current-buffer) default-buffers) - (and (memq major-mode '(plain-TeX-mode latex-mode)) + (and (memq major-mode '(plain-TeX-mode LaTeX-mode)) (or (stringp TeX-master) (eq TeX-master t)) (string= (expand-file-name (TeX-master-file t)) @@ -2384,16 +2384,14 @@ BUFFER-MISC is the appropriate data to be used." buffer-misc)))))) ;; Add autoload cookies explicitly for desktop.el. -;; <Background> preview-latex doesn't conform to the following -;; assumptions of desktop.el: +;; <Background> desktop.el assumes the following two: ;; (1) The file associated with the major mode by autoload has defun ;; of handler, which restores the state of the buffer. ;; (2) The file has suitable `add-to-list' form also for ;; `desktop-buffer-mode-handlers' to register the entry of the ;; handler. -;; This isn't the case here because the file associated with -;; `latex-mode' is tex-mode.el, neither preview.el nor latex.el. Thus -;; we include both of them as explicit autoloads in preview-latex.el. +;; This isn't the case for preview-latex. Thus we register both of +;; them as autoload cookies in AUCTeX initialzation code. ;;;###autoload (defun desktop-buffer-preview (file-name _buffer-name misc) "Hook function for restoring persistent previews into a buffer." @@ -2407,7 +2405,7 @@ BUFFER-MISC is the appropriate data to be used." ;;;###autoload (add-to-list 'desktop-buffer-mode-handlers - '(latex-mode . desktop-buffer-preview)) + '(LaTeX-mode . desktop-buffer-preview)) (defcustom preview-auto-cache-preamble 'ask "Whether to generate a preamble cache format automatically. @@ -3104,7 +3102,7 @@ to add the preview functionality." (customize-menu-create 'preview))]) ["Read documentation" preview-goto-info-page] ["Report Bug" preview-report-bug])) - (if (eq major-mode 'latex-mode) + (if (eq major-mode 'LaTeX-mode) (preview-mode-setup)) (unless preview-tb-icon (setq preview-tb-icon (preview-filter-specs preview-tb-icon-specs))) diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el index fbd64e0953..767ae4bd12 100644 --- a/tests/latex/latex-test.el +++ b/tests/latex/latex-test.el @@ -278,7 +278,7 @@ Test against RequirePackage." backend=biber % here is a comment ]{biblatex} ") - (latex-mode) + (LaTeX-mode) (let ((TeX-parse-self t)) (TeX-update-style t)) (should (member "biblatex" (TeX-style-list))) @@ -391,7 +391,7 @@ backend=biber % here is a comment ;; (setq TeX-PDF-from-DVI "Dvips")) ;; :classopt) (insert "\\documentclass[dvips]{article}\n") - (latex-mode) + (LaTeX-mode) (TeX-update-style) (should (equal (TeX-PDF-from-DVI) "Dvips")) (should (not (member "dvips" TeX-active-styles))) @@ -408,7 +408,7 @@ backend=biber % here is a comment ;; (setq TeX-PDF-from-DVI "Dvipdfmx"))) ;; :classopt) (insert "\\documentclass[dvipdfmx]{article}\n") - (latex-mode) + (LaTeX-mode) (TeX-update-style) (should TeX-PDF-mode) (should (equal (TeX-PDF-from-DVI) "Dvipdfmx")) @@ -416,7 +416,7 @@ backend=biber % here is a comment ;; dvipdfmx option should not trigger `TeX-PDF-from-DVI' for ;; XeLaTeX document - (latex-mode) + (LaTeX-mode) (let ((TeX-engine 'xetex)) (TeX-update-style)) (should TeX-PDF-mode) @@ -428,7 +428,7 @@ backend=biber % here is a comment ;; This depends on the following code in latex.el: ;; (TeX-add-style-hook "pdftricks" #'TeX-PDF-mode-on :classopt) (insert "\\documentclass[pdftricks]{article}\n") - (latex-mode) + (LaTeX-mode) (TeX-update-style) (should TeX-PDF-mode) (should (not (member "pdftricks" TeX-active-styles))) @@ -438,7 +438,7 @@ backend=biber % here is a comment ;; This depends on the following code in latex.el: ;; (TeX-add-style-hook "psfrag" #'TeX-PDF-mode-off :classopt) (insert "\\documentclass[psfrag]{article}\n") - (latex-mode) + (LaTeX-mode) (TeX-update-style) (should (not TeX-PDF-mode)) (should (not (member "psfrag" TeX-active-styles)))))) @@ -452,7 +452,7 @@ backend=biber % here is a comment (with-temp-buffer (let ((transient-mark-mode t) (LaTeX-insert-into-comments t)) - (latex-mode) + (LaTeX-mode) (auto-fill-mode 1) ;; test 1: for bug#35284 @@ -662,7 +662,7 @@ ghi")) ;; already. (or orig-mode (electric-pair-mode 1)) - (latex-mode) + (LaTeX-mode) ;; When `LaTeX-insert-left-brace' supplies right brace, ;; `electric-pair-mode' shouldn't come into play. diff --git a/tests/tex/command-expansion.el b/tests/tex/command-expansion.el index 9834487fa4..a89a12e95d 100644 --- a/tests/tex/command-expansion.el +++ b/tests/tex/command-expansion.el @@ -88,7 +88,7 @@ ;; Skip on w32 because the quoting style of `shell-quote-argument' ;; is different. (skip-unless (not (eq system-type 'windows-nt))) - (let ((major-mode 'latex-mode) + (let ((major-mode 'LaTeX-mode) (TeX-engine 'default) (TeX-command-extra-options " \"\\foo\"") TeX-master) diff --git a/tex-bar.el b/tex-bar.el index 8e505d56d1..a0bf9311d0 100644 --- a/tex-bar.el +++ b/tex-bar.el @@ -223,7 +223,7 @@ format of the argument MEANING-ALIST in the mentioned function." (defcustom TeX-bar-LaTeX-buttons '(new-file open-file dired kill-buffer save-buffer cut copy paste undo separator latex next-error view bibtex spell) - "List of buttons available in `latex-mode'. + "List of buttons available in `LaTeX-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. diff --git a/tex.el b/tex.el index 09d1ea8584..17f046498f 100644 --- a/tex.el +++ b/tex.el @@ -186,7 +186,7 @@ If nil, none is specified." (plain-TeX-mode AmSTeX-mode Texinfo-mode) :help "Run plain TeX") ("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil - (latex-mode doctex-mode) :help "Run LaTeX") + (LaTeX-mode docTeX-mode) :help "Run LaTeX") ;; Not part of standard TeX. ("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t" TeX-run-compile nil (Texinfo-mode) :help "Run Makeinfo with Info output") @@ -202,11 +202,11 @@ If nil, none is specified." TeX-run-TeX nil (ConTeXt-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %(O?aux)" TeX-run-BibTeX nil - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode ConTeXt-mode) :help "Run BibTeX") ("Biber" "biber %(output-dir) %s" TeX-run-Biber nil - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run Biber") ;; Not part of standard TeX. ;; It seems that texindex doesn't support "--output-dir" option. @@ -224,32 +224,32 @@ If nil, none is specified." ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Generate PostScript file") ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Convert DVI file to PostScript") ("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" TeX-run-dvipdfmx nil - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Convert DVI file to PDF with dvipdfmx") ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Convert PostScript file to PDF") ("Glossaries" "makeglossaries %(d-dir) %s" TeX-run-command nil - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run makeglossaries to create glossary file") ("Index" "makeindex %(O?idx)" TeX-run-index nil - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run makeindex to create index file") ("upMendex" "upmendex %(O?idx)" TeX-run-index t - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run upmendex to create index file") ("Xindy" "texindy %s" TeX-run-command nil - (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode Texinfo-mode) + (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode Texinfo-mode) :help "Run xindy to create index file") - ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) + ("Check" "lacheck %s" TeX-run-compile nil (LaTeX-mode) :help "Check LaTeX file for correctness") - ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode) + ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (LaTeX-mode) :help "Check LaTeX file for common mistakes") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") @@ -347,8 +347,8 @@ Any additional elements get just transferred to the respective menu entries." (choice :tag "Modes" (const :tag "All" t) (set (const :tag "Plain TeX" plain-TeX-mode) - (const :tag "LaTeX" latex-mode) - (const :tag "DocTeX" doctex-mode) + (const :tag "LaTeX" LaTeX-mode) + (const :tag "DocTeX" docTeX-mode) (const :tag "ConTeXt" ConTeXt-mode) (const :tag "Texinfo" Texinfo-mode) (const :tag "AmSTeX" AmSTeX-mode))) @@ -992,9 +992,9 @@ If RESET is non-nil, `TeX-command-next' is reset to "Return the prefix for the symbol MODE as string. If no mode is given the current major mode is used." (cdr (assoc (or mode major-mode) '((plain-TeX-mode . "plain-TeX") - (latex-mode . "LaTeX") + (LaTeX-mode . "LaTeX") (AmSTeX-mode . "AmSTeX") - (doctex-mode . "docTeX") + (docTeX-mode . "docTeX") (Texinfo-mode . "Texinfo") (ConTeXt-mode . "ConTeXt"))))) @@ -2467,13 +2467,13 @@ Get `major-mode' from master file and enable it." major-mode) major-mode)) (comment-prefix (cond ((eq mode 'Texinfo-mode) "@c ") - ((eq mode 'doctex-mode) "% ") + ((eq mode 'docTeX-mode) "% ") (t "%%% "))) (mode-string (concat (and (boundp 'japanese-TeX-mode) japanese-TeX-mode "japanese-") (substring (symbol-name mode) 0 -5)))) (newline) - (when (eq major-mode 'doctex-mode) + (when (eq major-mode 'docTeX-mode) (insert comment-prefix TeX-esc "endinput\n")) (insert comment-prefix "Local Variables:\n" @@ -3665,7 +3665,7 @@ produ[ck]t\\|produs\\|environment\\|omgeving\\|umgebung\\|prostredi\\|mediu\\|\ component\\|onderdeel\\|komponent[ea]\\|componenta\\)\ \\|inizia\\(testo\\|progetto\\|prodotto\\|ambiente\\|componente\\)\ \\)\\|%.*?interface=") - ("LATEX" latex-mode + ("LATEX" LaTeX-mode "\\\\\\(begin\\|\\(?:sub\\)\\{0,2\\}section\\|chapter\\|documentstyle\\|\ documentclass\\)\\b") ("TEX" plain-TeX-mode ".")) @@ -3682,10 +3682,10 @@ Each entry is a list with three elements. When entering `tex-mode', each regexp is tried in turn in order to find the major mode to be used.") -(defcustom TeX-default-mode #'latex-mode +(defcustom TeX-default-mode #'LaTeX-mode "Mode to enter for a new file when it can't be determined otherwise." :group 'TeX-misc - :type '(radio (function-item latex-mode) + :type '(radio (function-item LaTeX-mode) (function-item plain-TeX-mode) (function :tag "Other"))) @@ -3704,7 +3704,7 @@ The algorithm is as follows: 1) if the file is empty or `TeX-force-default-mode' is not set to nil, `TeX-default-mode' is chosen 2) If \\documentstyle or \\begin{, \\section{, \\part{ or \\chapter{ is - found, `latex-mode' is selected. + found, `LaTeX-mode' is selected. 3) Otherwise, use `plain-TeX-mode'" (interactive) @@ -5231,7 +5231,7 @@ Brace insertion is only done if point is in a math construct and (easy-menu-add-item nil ;; Ugly hack because docTeX mode uses the LaTeX menu. - (list (if (eq major-mode 'doctex-mode) "LaTeX" TeX-base-mode-name)) + (list (if (eq major-mode 'docTeX-mode) "LaTeX" TeX-base-mode-name)) (or TeX-customization-menu (setq TeX-customization-menu (customize-menu-create 'AUCTeX "Customize AUCTeX"))))) @@ -6209,7 +6209,7 @@ With prefix argument FORCE, always inserts \" characters." font-lock-comment-face) (1- (point)))) (texmathp) - (and (TeX-in-comment) (not (eq major-mode 'doctex-mode)))) + (and (TeX-in-comment) (not (eq major-mode 'docTeX-mode)))) (self-insert-command (prefix-numeric-value force)) (TeX-update-style) (let* ((lang-override (if (eq (car TeX-quote-language) 'override) @@ -6448,7 +6448,7 @@ enter the number of the file to view, anything else to skip: ") list))) (autoload 'info-lookup->completions "info-look") (defvar TeX-doc-backend-alist - '((texdoc (plain-TeX-mode latex-mode doctex-mode AmSTeX-mode ConTeXt-mode) + '((texdoc (plain-TeX-mode LaTeX-mode docTeX-mode AmSTeX-mode ConTeXt-mode) (lambda () (when (executable-find "texdoc") (TeX-search-files-by-type 'docs 'global t t))) @@ -6456,15 +6456,15 @@ enter the number of the file to view, anything else to skip: ") list))) ;; texdoc in MiKTeX requires --view in order to start ;; the viewer instead of an intermediate web page. (call-process "texdoc" nil 0 nil "--view" doc))) - (latex-info (latex-mode) + (latex-info (LaTeX-mode) (lambda () (mapcar (lambda (x) (let ((x (car x))) (if (string-match "\\`\\\\" x) (substring x 1) x))) - (info-lookup->completions 'symbol 'latex-mode))) + (info-lookup->completions 'symbol 'LaTeX-mode))) (lambda (doc) - (info-lookup-symbol (concat "\\" doc) 'latex-mode))) + (info-lookup-symbol (concat "\\" doc) 'LaTeX-mode))) (texinfo-info (Texinfo-mode) (lambda () (mapcar (lambda (x) @@ -7380,7 +7380,7 @@ in `TeX-expand-list-builtin' and `TeX-expand-list'." (format (if (and extra (stringp TeX-command-text) - (memq major-mode '(latex-mode doctex-mode)) + (memq major-mode '(LaTeX-mode docTeX-mode)) (memq TeX-engine '(default uptex))) ;; Since TeXLive 2018, the default encoding for LaTeX ;; files has been changed to UTF-8 if used with @@ -7590,7 +7590,7 @@ omitted) and `TeX-region-file'." TeX-file-extensions) (TeX-save-document name-or-file-fn)) TeX-command-default) - ((and (memq major-mode '(doctex-mode latex-mode)) + ((and (memq major-mode '(docTeX-mode LaTeX-mode)) ;; Want to know if bib file is newer than .bbl ;; We don't care whether the bib files are open in emacs (TeX-check-files (TeX--concat-ext name-or-file-fn "bbl") @@ -7936,7 +7936,7 @@ run of `TeX-run-format', use (let ((idx-file nil) (element nil)) ;; Store md5 hash of the index file before running LaTeX. - (and (memq major-mode '(doctex-mode latex-mode)) + (and (memq major-mode '(docTeX-mode LaTeX-mode)) (prog1 (file-exists-p (setq idx-file (expand-file-name (TeX-active-master "idx")))) ;; In order to avoid confusion and pollution of @@ -8859,7 +8859,7 @@ from.") ;; names right when analysing the process output buffer. ;; Note that \usepackage[utf8]{inputenc} is enabled by default in ;; standard (pdf)latex since TeXLive 2018. - (if (and (memq major-mode '(latex-mode doctex-mode)) + (if (and (memq major-mode '(LaTeX-mode docTeX-mode)) ;; Japanese upLaTeX requires the same treatment with ;; respect to non-ascii characters other than Japanese, in ;; file names within \message{}. @@ -9107,7 +9107,7 @@ If a prefix argument OVERRIDE-CONFIRM is given, confirmation will depend on it being positive instead of the entry in `TeX-command-list'." (interactive "P") - (if (eq major-mode 'latex-mode) + (if (eq major-mode 'LaTeX-mode) (let* ((bounds (LaTeX-command-section-boundaries)) (TeX-command-region-begin (car bounds)) (TeX-command-region-end (cdr bounds))) @@ -9123,7 +9123,7 @@ depend on it being positive instead of the entry in (defun LaTeX-command-run-all-section () "Compile the current section until an error occurs or it is finished." (interactive) - (if (eq major-mode 'latex-mode) + (if (eq major-mode 'LaTeX-mode) (let* ((bounds (LaTeX-command-section-boundaries)) (TeX-command-region-begin (car bounds)) (TeX-command-region-end (cdr bounds))) diff --git a/texmathp.el b/texmathp.el index 1030ed858b..da4f682d67 100644 --- a/texmathp.el +++ b/texmathp.el @@ -280,7 +280,7 @@ See the variable `texmathp-tex-commands' about which commands are checked." (let* ((pos (point)) math-on sw-match (bound (save-excursion (if (re-search-backward - (if (eq major-mode 'doctex-mode) + (if (memq major-mode '(doctex-mode docTeX-mode)) "[\n\r]%*[ \t]*[\n\r]" "[\n\r][ \t]*[\n\r]") nil 1 texmathp-search-n-paragraphs)