branch: externals/auctex commit 43ba1244a245f7fa9cfc64317b49a6bec7915fa8 Merge: 901b20a 312dde3 Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge branch 'master' into simplify-TeX-parse-error --- ChangeLog | 42 +++++++++++++++++++++++++++ bib-cite.el | 6 +-- font-latex.el | 5 +-- latex.el | 39 ++++++++----------------- tex-info.el | 87 +++++++++++++++++++++++---------------------------------- tex.el | 52 ++++++++++++++------------------- 6 files changed, 116 insertions(+), 115 deletions(-) diff --git a/ChangeLog b/ChangeLog index 791a5a1..e6cc7e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +2014-08-18 Vincent Bela�che <vincen...@users.sourceforge.net> + + * font-latex.el (font-latex-add-quotes): Code optimization: use + '(add-to-list (make-local-variable (quote foo)) some-value)' + instead of '(make-local-variable (quote foo)) (add-to-list 'foo + some-value)' wherever possible. + + * bib-cite.el (bib-cite-minor-mode) + (bib-cite-setup-highlight-mouse-keymap): Code optimization: use + '(set (make-local-variable (quote foo)) some-value)' instead of + '(make-local-variable (quote foo)) (setq foo some-value)' wherever + possible. + + * latex.el (BibTeX-auto-store) + (LaTeX-common-initialization): Ditto. + + * tex-info.el (TeX-texinfo-mode): Code optimization: use '(set + (make-local-variable (quote foo)) some-value)' instead of + '(make-local-variable (quote foo)) (setq foo some-value)' wherever + possible. Add in style Texinfo standard macros '@acronym' and + '@tie'. + + * tex.el (TeX-assoc-string) new defalias to work-around missing + assoc-string in XEmacs. + (TeX-unload-style): Code optimization: use 'TeX-assoc-string' + instead of 'assoc' to search style in 'TeX-style-hook-list', and + use delq on returned value of assoc-string for removing the style + --- on the one hand delq will go through the whole list rather + than stop after the first match like in original code, but on the + other hand comparison are faster because eq instead of equal is + used and we are working on assoc cell rather than on key, so less + indirection, furthermore delq is C code. Anyway that make the code + much smaller and easier to understand. + (TeX-file-extensions): Add txi amongst extension of texinfo files, + for consistency with info node '(texinfo) Minimum' + (TeX-run-style-hooks): Code optimization: use 'TeX-assoc-string' + instead of 'assoc' to search style in 'TeX-style-hook-list'. + (VirTeX-common-initialization): Code optimization: use '(set + (make-local-variable (quote foo)) some-value)' instead of + '(make-local-variable (quote foo)) (setq foo some-value)' wherever + possible. + 2014-08-18 Tassilo Horn <t...@gnu.org> * font-latex.el (font-latex-set-syntactic-keywords): Allow for a diff --git a/bib-cite.el b/bib-cite.el index 1dbe272..8ac7ac9 100644 --- a/bib-cite.el +++ b/bib-cite.el @@ -756,8 +756,7 @@ runs bib-find, and [mouse-3] runs bib-display." ;; Added for version 2.19 (if (boundp 'tags-always-exact) (progn - (make-local-variable 'tags-always-exact) - (setq tags-always-exact nil))) + (set (make-local-variable 'tags-always-exact) nil))) ;; mouse overlay (if bib-highlight-mouse-t (progn @@ -795,8 +794,7 @@ runs bib-find, and [mouse-3] runs bib-display." ;; own. (defun bib-cite-setup-highlight-mouse-keymap () "Set up the bib-cite text in the current buffer to be clickable." - (make-local-variable 'bib-highlight-mouse-keymap) - (setq bib-highlight-mouse-keymap + (set (make-local-variable 'bib-highlight-mouse-keymap) ;;; First, copy the local keymap so we don't have `disappearing' menus ;;; when the mouse is moved over a \ref, \label or \cite command. diff --git a/font-latex.el b/font-latex.el index b6226b1..0a1b8ad 100644 --- a/font-latex.el +++ b/font-latex.el @@ -127,8 +127,7 @@ If nil, quoted content will not be fontified." QUOTES has to be a list adhering to the format of an element of `font-latex-quote-list'." (setq font-latex-quotes-control nil) - (make-local-variable 'font-latex-quote-list) - (add-to-list 'font-latex-quote-list quotes)) + (add-to-list (make-local-variable 'font-latex-quote-list) quotes)) (defun font-latex-quotes-set-internal () "Set `font-latex-quotes-internal' according to `font-latex-quotes'. @@ -810,7 +809,7 @@ Generated by `font-latex-make-user-keywords'."))) (1 (get-text-property (match-end 1) 'face) t)))) (add-to-list 'font-latex-keywords-1 item) (add-to-list 'font-latex-keywords-2 item)) - (dolist (item + (dolist (item '((font-latex-match-math-env (0 'font-latex-warning-face t t) (1 'font-latex-math-face append t)) diff --git a/latex.el b/latex.el index c2685d7..b260625 100644 --- a/latex.el +++ b/latex.el @@ -1657,16 +1657,11 @@ It will setup BibTeX to store keys in an auto file." (if (boundp 'local-write-file-hooks) (add-hook 'local-write-file-hooks 'TeX-safe-auto-write) (add-hook 'write-file-hooks 'TeX-safe-auto-write)) - (make-local-variable 'TeX-auto-update) - (setq TeX-auto-update 'BibTeX) - (make-local-variable 'TeX-auto-untabify) - (setq TeX-auto-untabify nil) - (make-local-variable 'TeX-auto-parse-length) - (setq TeX-auto-parse-length 999999) - (make-local-variable 'TeX-auto-regexp-list) - (setq TeX-auto-regexp-list BibTeX-auto-regexp-list) - (make-local-variable 'TeX-master) - (setq TeX-master t)) + (set (make-local-variable 'TeX-auto-update) 'BibTeX) + (set (make-local-variable 'TeX-auto-untabify) nil) + (set (make-local-variable 'TeX-auto-parse-length) 999999) + (set (make-local-variable 'TeX-auto-regexp-list) BibTeX-auto-regexp-list) + (set (make-local-variable 'TeX-master) t)) (defvar BibTeX-auto-regexp-list '(("@[Ss][Tt][Rr][Ii][Nn][Gg]" 1 ignore) @@ -5766,18 +5761,14 @@ i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." "Common initialization for LaTeX derived modes." (VirTeX-common-initialization) (set-syntax-table LaTeX-mode-syntax-table) - (make-local-variable 'indent-line-function) - (setq indent-line-function 'LaTeX-indent-line) + (set (make-local-variable 'indent-line-function) 'LaTeX-indent-line) (setq local-abbrev-table latex-mode-abbrev-table) ;; Filling - (make-local-variable 'paragraph-ignore-fill-prefix) - (setq paragraph-ignore-fill-prefix t) - (make-local-variable 'fill-paragraph-function) - (setq fill-paragraph-function 'LaTeX-fill-paragraph) - (make-local-variable 'adaptive-fill-mode) - (setq adaptive-fill-mode nil) + (set (make-local-variable 'paragraph-ignore-fill-prefix) t) + (set (make-local-variable 'fill-paragraph-function) 'LaTeX-fill-paragraph) + (set (make-local-variable 'adaptive-fill-mode) nil) (or LaTeX-largest-level (setq LaTeX-largest-level (LaTeX-section-level "section"))) @@ -5786,18 +5777,15 @@ i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." TeX-trailer-start LaTeX-trailer-start) (require 'outline) - (make-local-variable 'outline-level) - (setq outline-level 'LaTeX-outline-level) - (make-local-variable 'outline-regexp) - (setq outline-regexp (LaTeX-outline-regexp t)) + (set (make-local-variable 'outline-level) 'LaTeX-outline-level) + (set (make-local-variable 'outline-regexp) (LaTeX-outline-regexp t)) (when (boundp 'outline-heading-alist) (setq outline-heading-alist (mapcar (lambda (x) (cons (concat "\\" (nth 0 x)) (nth 1 x))) LaTeX-section-list))) - (make-local-variable 'TeX-auto-full-regexp-list) - (setq TeX-auto-full-regexp-list + (set (make-local-variable 'TeX-auto-full-regexp-list) (append LaTeX-auto-regexp-list plain-TeX-auto-regexp-list)) (LaTeX-set-paragraph-start) @@ -5813,8 +5801,7 @@ i.e. you do _not_ have to cater for this yourself by adding \\\\' or $." (set (make-local-variable 'TeX-search-files-type-alist) LaTeX-search-files-type-alist) - (make-local-variable 'LaTeX-item-list) - (setq LaTeX-item-list '(("description" . LaTeX-item-argument) + (set (make-local-variable 'LaTeX-item-list) '(("description" . LaTeX-item-argument) ("thebibliography" . LaTeX-item-bib) ("array" . LaTeX-item-array) ("tabular" . LaTeX-item-array) diff --git a/tex-info.el b/tex-info.el index f973937..41d674f 100644 --- a/tex-info.el +++ b/tex-info.el @@ -392,7 +392,7 @@ for @node." "Hook function to plug Texinfo into RefTeX." ;; force recompilation of variables (when (string= TeX-base-mode-name "Texinfo") - ;; dirty temporary hook to remove when reftex has a Texinfo builtin + ;; dirty temporary hook to remove when reftex has a Texinfo builtin ;; TODO --- taken on <2014-01-06 mon> --- remove the dirty trick once reftex ;; has been corrected for long enough a time (unless (assq 'Texinfo reftex-label-alist-builtin) @@ -544,38 +544,28 @@ value of `Texinfo-mode-hook'." (setq major-mode 'texinfo-mode) (use-local-map Texinfo-mode-map) (set-syntax-table texinfo-mode-syntax-table) - (make-local-variable 'page-delimiter) - (setq page-delimiter - (concat - "^@node [ \t]*[Tt]op\\|^@\\(" - texinfo-chapter-level-regexp - "\\)")) - (make-local-variable 'require-final-newline) - (setq require-final-newline t) - (make-local-variable 'indent-tabs-mode) - (setq indent-tabs-mode nil) - (make-local-variable 'paragraph-separate) - (setq paragraph-separate - (concat "\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate)) - (make-local-variable 'paragraph-start) - (setq paragraph-start - (concat "\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start)) - (make-local-variable 'fill-column) - (setq fill-column 72) - (make-local-variable 'comment-start) - (setq comment-start "@c ") - (make-local-variable 'comment-start-skip) - (setq comment-start-skip "@c +\\|@comment +") + + (set (make-local-variable 'page-delimiter) + (concat + "^@node [ \t]*[Tt]op\\|^@\\(" + texinfo-chapter-level-regexp + "\\)")) + (set (make-local-variable 'require-final-newline) t) + (set (make-local-variable 'indent-tabs-mode) nil) + (set (make-local-variable 'paragraph-separate) + (concat "\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate)) + (set (make-local-variable 'paragraph-start) + (concat "\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start)) + (set (make-local-variable 'fill-column) 72) + (set (make-local-variable 'comment-start) "@c ") + (set (make-local-variable 'comment-start-skip) "@c +\\|@comment +") (set (make-local-variable 'comment-use-syntax) nil) - (make-local-variable 'words-include-escapes) - (setq words-include-escapes t) - (if (not (boundp 'texinfo-imenu-generic-expression)) + (set (make-local-variable 'words-include-escapes) t) + (if (boundp 'texinfo-imenu-generic-expression) ;; This was introduced in 19.30. - () - (make-local-variable 'imenu-generic-expression) - (setq imenu-generic-expression texinfo-imenu-generic-expression)) - (make-local-variable 'font-lock-defaults) - (setq font-lock-defaults + (set (make-local-variable 'imenu-generic-expression) texinfo-imenu-generic-expression)) + + (set (make-local-variable 'font-lock-defaults) ;; COMPATIBILITY for Emacs 20 (if (boundp 'texinfo-font-lock-syntactic-keywords) '(texinfo-font-lock-keywords @@ -586,42 +576,33 @@ value of `Texinfo-mode-hook'." (if (not (boundp 'texinfo-section-list)) ;; This was included in 19.31. () - (make-local-variable 'outline-regexp) - (setq outline-regexp - (concat "@\\(" - (mapconcat 'car texinfo-section-list "\\>\\|") - "\\>\\)")) - (make-local-variable 'outline-level) - (setq outline-level 'texinfo-outline-level)) + (set (make-local-variable 'outline-regexp) + (concat "@\\(" + (mapconcat 'car texinfo-section-list "\\>\\|") + "\\>\\)")) + (set (make-local-variable 'outline-level) 'texinfo-outline-level)) ;; Mostly AUCTeX stuff (easy-menu-add Texinfo-mode-menu Texinfo-mode-map) (easy-menu-add Texinfo-command-menu Texinfo-mode-map) - (make-local-variable 'TeX-command-current) - (setq TeX-command-current 'TeX-command-master) + (set (make-local-variable 'TeX-command-current) 'TeX-command-master) (setq TeX-default-extension "texi") - (make-local-variable 'TeX-esc) - (setq TeX-esc "@") + (set (make-local-variable 'TeX-esc) "@") - (make-local-variable 'TeX-auto-regexp-list) - (setq TeX-auto-regexp-list 'TeX-auto-empty-regexp-list) - (make-local-variable 'TeX-auto-update) - (setq TeX-auto-update t) + (set (make-local-variable 'TeX-auto-regexp-list) 'TeX-auto-empty-regexp-list) + (set (make-local-variable 'TeX-auto-update) t) (setq TeX-command-default "TeX") (setq TeX-header-end "%*end") (setq TeX-trailer-start (regexp-quote (concat TeX-esc "bye"))) - (make-local-variable 'TeX-complete-list) - (setq TeX-complete-list + (set (make-local-variable 'TeX-complete-list) (list (list "@\\([a-zA-Z]*\\)" 1 'TeX-symbol-list-filtered nil) (list "" TeX-complete-word))) - (make-local-variable 'TeX-font-list) - (setq TeX-font-list Texinfo-font-list) - (make-local-variable 'TeX-font-replace-function) - (setq TeX-font-replace-function 'TeX-font-replace-macro) + (set (make-local-variable 'TeX-font-list) Texinfo-font-list) + (set (make-local-variable 'TeX-font-replace-function) 'TeX-font-replace-macro) (add-hook 'find-file-hooks (lambda () (unless (file-exists-p (buffer-file-name)) @@ -633,6 +614,7 @@ value of `Texinfo-mode-hook'." #'texinfo-current-defun-name)) (TeX-add-symbols + '("acronym" "Acronym") '("appendix" (TeX-arg-literal " ") (TeX-arg-free "Title")) '("appendixsec" (TeX-arg-literal " ") (TeX-arg-free "Title")) '("appendixsection" (TeX-arg-literal " ") (TeX-arg-free "Title")) @@ -740,6 +722,7 @@ value of `Texinfo-mode-hook'." '("thischaptername") '("thisfile") '("thispage") + '("tie") '("tindex" (TeX-arg-literal " ") (TeX-arg-free "Entry")) '("title" (TeX-arg-literal " ") (TeX-arg-free "Title")) '("titlefont" "Text") diff --git a/tex.el b/tex.el index b2435e9..e5378aa 100644 --- a/tex.el +++ b/tex.el @@ -595,6 +595,13 @@ but does nothing in Emacs." Also does other stuff." (TeX-maybe-remove-help menu))) +;;;###autoload +(defalias 'TeX-assoc-string + (symbol-function (if (featurep 'xemacs) 'assoc 'assoc-string)) + (concat "Compatibility alias that points to + function `assoc' with XEMACS and to function `assoc-string' + with GNU EMACS. See function `" + (if (featurep 'xemacs) "assoc" "assoc-string") "'." )) ;;; Documentation for Info-goto-emacs-command-node and similar @@ -2444,14 +2451,9 @@ active.") (defun TeX-unload-style (style) "Forget that we once loaded STYLE." - (cond ((null (assoc style TeX-style-hook-list))) - ((equal (car (car TeX-style-hook-list)) style) - (setq TeX-style-hook-list (cdr TeX-style-hook-list))) - (t - (let ((entry TeX-style-hook-list)) - (while (not (equal (car (car (cdr entry))) style)) - (setq entry (cdr entry))) - (setcdr entry (cdr (cdr entry))))))) + (let ((style-data (TeX-assoc-string style TeX-style-hook-list))) + (if style-data + (setq TeX-style-hook-list (delq style-data TeX-style-hook-list))))) (defcustom TeX-virgin-style (if (and TeX-auto-global (file-directory-p TeX-auto-global)) @@ -2485,7 +2487,7 @@ active.") (match-beginning 2) (match-end 2)))) (condition-case err (mapcar 'funcall - (cdr-safe (assoc style TeX-style-hook-list))) + (cdr-safe (TeX-assoc-string style TeX-style-hook-list))) ;; This happens in case some style added a new parser, and ;; now the style isn't used anymore (user deleted ;; \usepackage{style}). Then we're left over with, e.g., @@ -3133,18 +3135,14 @@ The algorithm is as follows: (setq indent-tabs-mode nil) ;; Ispell support - (make-local-variable 'ispell-parser) - (setq ispell-parser 'tex) - (make-local-variable 'ispell-tex-p) - (setq ispell-tex-p t) + (set (make-local-variable 'ispell-parser) 'tex) + (set (make-local-variable 'ispell-tex-p) t) ;; Redefine some standard variables (make-local-variable 'paragraph-start) (make-local-variable 'paragraph-separate) - (make-local-variable 'comment-start) - (setq comment-start "%") - (make-local-variable 'comment-start-skip) - (setq comment-start-skip + (set (make-local-variable 'comment-start) "%") + (set (make-local-variable 'comment-start-skip) (concat "\\(\\(^\\|[^\\\n]\\)\\(" (regexp-quote TeX-esc) @@ -3154,20 +3152,16 @@ The algorithm is as follows: (set (make-local-variable 'comment-use-syntax) t) ;; `comment-padding' is defined here as an integer for compatibility ;; reasons because older Emacsen could not cope with a string. - (make-local-variable 'comment-padding) - (setq comment-padding 1) + (set (make-local-variable 'comment-padding) 1) ;; Removed as commenting in (La)TeX is done with one `%' not two ;; (make-local-variable 'comment-add) ;; (setq comment-add 1) ;default to `%%' in comment-region - (make-local-variable 'comment-indent-function) - (setq comment-indent-function 'TeX-comment-indent) - (make-local-variable 'comment-multi-line) - (setq comment-multi-line nil) + (set (make-local-variable 'comment-indent-function) 'TeX-comment-indent) + (set (make-local-variable 'comment-multi-line) nil) (make-local-variable 'compile-command) (unless (boundp 'compile-command) (setq compile-command "make")) - (make-local-variable 'words-include-escapes) - (setq words-include-escapes nil) + (set (make-local-variable 'words-include-escapes) nil) ;; Make TAB stand out ;; (make-local-variable 'buffer-display-table) @@ -3177,8 +3171,7 @@ The algorithm is as follows: ;; (aset buffer-display-table ?\t (apply 'vector (append "<TAB>" nil))) ;; Symbol completion. - (make-local-variable 'TeX-complete-list) - (setq TeX-complete-list + (set (make-local-variable 'TeX-complete-list) (list (list "\\\\\\([a-zA-Z]*\\)" 1 'TeX-symbol-list-filtered (if TeX-insert-braces "{}")) @@ -3191,8 +3184,7 @@ The algorithm is as follows: (if (boundp 'local-write-file-hooks) (add-hook 'local-write-file-hooks 'TeX-safe-auto-write) (add-hook 'write-file-hooks 'TeX-safe-auto-write)) - (make-local-variable 'TeX-auto-update) - (setq TeX-auto-update t) + (set (make-local-variable 'TeX-auto-update) t) (define-key TeX-mode-map "\C-xng" 'TeX-narrow-to-group) @@ -3775,7 +3767,7 @@ Check for potential LaTeX environments." "File extensions recognized by AUCTeX." :group 'TeX-file) -(defcustom TeX-file-extensions '("tex" "sty" "cls" "ltx" "texi" "texinfo" "dtx") +(defcustom TeX-file-extensions '("tex" "sty" "cls" "ltx" "texi" "txi" "texinfo" "dtx") "*File extensions used by manually generated TeX files." :group 'TeX-file-extension :type '(repeat (string :format "%v")))