summaryrefslogtreecommitdiff
path: root/lisp/textmodes/tex-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-03-17 23:32:39 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2021-03-17 23:32:39 -0400
commit485622bbd1afad4c1e39a245cf57605208ca606f (patch)
tree8388854d1b0eaa4e82f55862149c9def4ca1ccc6 /lisp/textmodes/tex-mode.el
parentc28ba117782cd825b2a4dd6ffcc0206ecf36898e (diff)
downloademacs-485622bbd1afad4c1e39a245cf57605208ca606f.tar.gz
emacs-485622bbd1afad4c1e39a245cf57605208ca606f.tar.bz2
emacs-485622bbd1afad4c1e39a245cf57605208ca606f.zip
* lisp/textmodes: Use lexical-binding
* lisp/textmodes/enriched.el: Use lexical-binding. (enriched-mode): Use `delete-dups` to avoid `add-to-list` on a local variable. * lisp/textmodes/makeinfo.el: Use lexical-binding. (makeinfo-region): Remove unused var `filename-or-header`. * lisp/textmodes/refbib.el: Use lexical-binding. (r2b-put-field): Remove unused var `multi-line`. (r2b-barf-output): Remove unused var `match`. * lisp/textmodes/refer.el: Use lexical-binding. (refer-find-entry-internal): Remove unused vars `old-buffer` and `found`. * lisp/textmodes/reftex-auc.el: Use lexical-binding. (LaTeX-add-bibitems): Declare function. (reftex-plug-into-AUCTeX): Use `add-function` and `advice-add` so we can properly unplug. * lisp/textmodes/reftex-cite.el: Use lexical-binding. (reftex-create-bibtex-file): Remove unused var `file`. (reftex--found-list): Declare var. (reftex-offer-bib-menu): Rename local var to `reftex--found-list`. * lisp/textmodes/reftex-dcr.el: Use lexical-binding. (reftex-use-itimer-in-xemacs): Delete XEmacs-only var. (reftex-toggle-auto-view-crossref): Delete XEmacs-only code. (reftex-start-itimer-once): Delete XEmacs-only function. * lisp/textmodes/reftex-global.el: Use lexical-binding. (reftex-isearch-push-state-function): Use a closure instead of `(lambda). * lisp/textmodes/reftex-index.el: Use lexical-binding. (mark-active, transient-mark-mode): Delete var declarations. (reftex-index-mode-map): Remove XEmacs-only code. Use `mapc` so we can use closures instead of hand-built lambdas. (reftex-index-next, reftex-index-previous): Tweak interactive spec to remove unused prefix arg and mark it as a motion command. (reftex-index-phrases-font-lock-keywords) (reftex-index-phrases-font-lock-keywords): Move initialization into declaration. (reftex-index-initialize-phrases-buffer, reftex-index-phrases-mode) reftex-index-phrases-apply-to-region: Remove XEmacs-only code. (TeX-master): Remove redundant declaration. (reftex--chars-first): Rename dynvar from `chars-first`. Adjust all uses. * lisp/textmodes/reftex-parse.el: Use lexical-binding. * lisp/textmodes/reftex-ref.el: Use lexical-binding. (reftex-label): Remove always-nil var `text`. (reftex-refstyle): Declare before first use. (<toplevel>): Use closures rather than `eval` when building commands from `reftex-ref-style-alist`. * lisp/textmodes/reftex-sel.el: Use lexical-binding. (reftex-select-label-mode-map, reftex-select-bib-mode-map): Use `mapc` so we can use closures instead of hand-built lambdas. (reftex-select-label-mode, reftex-select-bib-mode): Remove XEmacs-only code. (reftex-select-data, reftex-select-prompt, reftex-refstyle): Move declaration before first use. (reftex--found-list, reftex--cb-flag, reftex--last-data) (reftex--call-back, reftex--help-string): Move declaration before use, and rename by adding `reftext--` prefix. Adjust all uses in this file. For `reftex--found-list` adjust corresponding uses in `reftex-cite.el`. (reftex-select-item): Explicitly let-bind them. Remove XEmacs-only code. * lisp/textmodes/reftex-toc.el: Use lexical-binding. (reftex-toc-mode-map, reftex-toc-mode, reftex-toc-restore-region) (reftex-toc-next, reftex-toc-previous, reftex-toc-next-heading) (reftex-toc-previous-heading, reftex-toggle-auto-toc-recenter (reftex-make-separate-toc-frame): Remove XEmacs-only code. * lisp/textmodes/reftex-vars.el: Use lexical-binding. * lisp/textmodes/reftex.el: Use lexical-binding. (reftex-mode-map, reftex-mode, reftex-fontify-select-label-buffer) (reftex-verified-face): Remove XEmacs-only code. (reftex-region-active-p, reftex-overlay-put, reftex-move-overlay) (reftex-make-overlay, reftex-get-buffer-visiting, reftex-delete-overlay): Redefine as obsolete aliases. Replace all callers. (current-message): Remove XEmacs-only definition. * lisp/textmodes/remember.el: Use lexical-binding. * lisp/textmodes/table.el (<toplevel>): Use closures rather than `(lambda) to build commands. * lisp/textmodes/texinfmt.el: Use lexical-binding. (texinfo-example-start): Declare var. (texinfo-format-region, texinfo-format-buffer-1): Remove unused var `last-input-buffer`. (texinfo-format-scan): Use `dlet` to bind `whitespace-silent`. (texinfo-optional-braces-discard, texinfo-format-parse-line-args) (texinfo-format-parse-args): Remove unused var `start`. (texinfo-multitable-widths): Remove unused var `start-of-templates`. (texinfo-multitable-item): Strength-reduce `eval` to `symbol-value`. (texinfo-alias): Remove unused vars `start` and `args`. (texinfo-defun-type symbol-property): Change the car to help the type symbol rather than an expression returning it. (texinfo-format-deffn): Remove corresponding `eval`. (texinfo-clear): Remove unused var `value`. (texinfo-format-ifeq): Remove unused var `end`. * lisp/textmodes/texinfo.el: Use lexical-binding. (tex-show-print-queue): Declare function. * lisp/textmodes/texnfo-upd.el: Use lexical-binding. (texinfo-start-menu-description): Remove unused var `end`. (texinfo-insert-node-lines): Remove unused var `beginning-marker`. (texinfo-multiple-files-update): Remove unused vars `next-node-name` and `previous-node-name`. * lisp/textmodes/two-column.el: Use lexical-binding.
Diffstat (limited to 'lisp/textmodes/tex-mode.el')
-rw-r--r--lisp/textmodes/tex-mode.el72
1 files changed, 36 insertions, 36 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index d5a79ad0ac5..fb57b9b0f23 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -857,11 +857,11 @@ START is the position of the \\ and DELIM is the delimiter char."
(defun tex-define-common-keys (keymap)
"Define the keys that we want defined both in TeX mode and in the TeX shell."
- (define-key keymap "\C-c\C-k" 'tex-kill-job)
- (define-key keymap "\C-c\C-l" 'tex-recenter-output-buffer)
- (define-key keymap "\C-c\C-q" 'tex-show-print-queue)
- (define-key keymap "\C-c\C-p" 'tex-print)
- (define-key keymap "\C-c\C-v" 'tex-view)
+ (define-key keymap "\C-c\C-k" #'tex-kill-job)
+ (define-key keymap "\C-c\C-l" #'tex-recenter-output-buffer)
+ (define-key keymap "\C-c\C-q" #'tex-show-print-queue)
+ (define-key keymap "\C-c\C-p" #'tex-print)
+ (define-key keymap "\C-c\C-v" #'tex-view)
(define-key keymap [menu-bar tex] (cons "TeX" (make-sparse-keymap "TeX")))
@@ -884,27 +884,27 @@ START is the position of the \\ and DELIM is the delimiter char."
(let ((map (make-sparse-keymap)))
(set-keymap-parent map text-mode-map)
(tex-define-common-keys map)
- (define-key map "\"" 'tex-insert-quote)
- (define-key map "\n" 'tex-handle-newline)
- (define-key map "\M-\r" 'latex-insert-item)
- (define-key map "\C-c}" 'up-list)
- (define-key map "\C-c{" 'tex-insert-braces)
- (define-key map "\C-c\C-r" 'tex-region)
- (define-key map "\C-c\C-b" 'tex-buffer)
- (define-key map "\C-c\C-f" 'tex-file)
- (define-key map "\C-c\C-c" 'tex-compile)
- (define-key map "\C-c\C-i" 'tex-bibtex-file)
- (define-key map "\C-c\C-o" 'latex-insert-block)
+ (define-key map "\"" #'tex-insert-quote)
+ (define-key map "\n" #'tex-handle-newline)
+ (define-key map "\M-\r" #'latex-insert-item)
+ (define-key map "\C-c}" #'up-list)
+ (define-key map "\C-c{" #'tex-insert-braces)
+ (define-key map "\C-c\C-r" #'tex-region)
+ (define-key map "\C-c\C-b" #'tex-buffer)
+ (define-key map "\C-c\C-f" #'tex-file)
+ (define-key map "\C-c\C-c" #'tex-compile)
+ (define-key map "\C-c\C-i" #'tex-bibtex-file)
+ (define-key map "\C-c\C-o" #'latex-insert-block)
;; Redundant keybindings, for consistency with SGML mode.
- (define-key map "\C-c\C-t" 'latex-insert-block)
- (define-key map "\C-c]" 'latex-close-block)
- (define-key map "\C-c/" 'latex-close-block)
-
- (define-key map "\C-c\C-e" 'latex-close-block)
- (define-key map "\C-c\C-u" 'tex-goto-last-unclosed-latex-block)
- (define-key map "\C-c\C-m" 'tex-feed-input)
- (define-key map [(control return)] 'tex-feed-input)
+ (define-key map "\C-c\C-t" #'latex-insert-block)
+ (define-key map "\C-c]" #'latex-close-block)
+ (define-key map "\C-c/" #'latex-close-block)
+
+ (define-key map "\C-c\C-e" #'latex-close-block)
+ (define-key map "\C-c\C-u" #'tex-goto-last-unclosed-latex-block)
+ (define-key map "\C-c\C-m" #'tex-feed-input)
+ (define-key map [(control return)] #'tex-feed-input)
(define-key map [menu-bar tex tex-bibtex-file]
'("BibTeX File" . tex-bibtex-file))
(define-key map [menu-bar tex tex-validate-region]
@@ -922,7 +922,7 @@ START is the position of the \\ and DELIM is the delimiter char."
(defvar latex-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map tex-mode-map)
- (define-key map "\C-c\C-s" 'latex-split-block)
+ (define-key map "\C-c\C-s" #'latex-split-block)
map)
"Keymap for `latex-mode'. See also `tex-mode-map'.")
@@ -1033,11 +1033,11 @@ says which mode to use."
;; received them from someone using AUCTeX).
;;;###autoload
-(defalias 'TeX-mode 'tex-mode)
+(defalias 'TeX-mode #'tex-mode)
;;;###autoload
-(defalias 'plain-TeX-mode 'plain-tex-mode)
+(defalias 'plain-TeX-mode #'plain-tex-mode)
;;;###autoload
-(defalias 'LaTeX-mode 'latex-mode)
+(defalias 'LaTeX-mode #'latex-mode)
;;;###autoload
(define-derived-mode plain-tex-mode tex-mode "TeX"
@@ -1560,7 +1560,7 @@ the name of the environment and SKEL-ELEM is an element to use in
a skeleton (see `skeleton-insert').")
;; Like tex-insert-braces, but for LaTeX.
-(defalias 'tex-latex-block 'latex-insert-block)
+(defalias 'tex-latex-block #'latex-insert-block)
(define-skeleton latex-insert-block
"Create a matching pair of lines \\begin{NAME} and \\end{NAME} at point.
Puts point on a blank line between them."
@@ -1866,7 +1866,7 @@ Mark is left at original location."
(with-syntax-table tex-mode-syntax-table
(forward-sexp))))))
-(defalias 'tex-close-latex-block 'latex-close-block)
+(defalias 'tex-close-latex-block #'latex-close-block)
(define-skeleton latex-close-block
"Create an \\end{...} to match the last unclosed \\begin{...}."
(save-excursion
@@ -2008,7 +2008,7 @@ Mark is left at original location."
;; Specify an interactive shell, to make sure it prompts.
"-i")
(let ((proc (get-process "tex-shell")))
- (set-process-sentinel proc 'tex-shell-sentinel)
+ (set-process-sentinel proc #'tex-shell-sentinel)
(set-process-query-on-exit-flag proc nil)
(tex-shell)
(while (zerop (buffer-size))
@@ -2063,7 +2063,7 @@ evaluates to a command string.
Return the process in which TeX is running."
(save-excursion
- (let* ((cmd (eval command))
+ (let* ((cmd (eval command t))
(proc (tex-shell-proc))
(buf (process-buffer proc))
(star (string-match "\\*" cmd))
@@ -2313,7 +2313,7 @@ FILE is typically the output DVI or PDF file."
executable))))))
(defun tex-command-executable (cmd)
- (let ((s (if (stringp cmd) cmd (eval (car cmd)))))
+ (let ((s (if (stringp cmd) cmd (eval (car cmd) t))))
(substring s 0 (string-match "[ \t]\\|\\'" s))))
(defun tex-command-active-p (cmd fspec)
@@ -2400,7 +2400,7 @@ Only applies the FSPEC to the args part of FORMAT."
(setq latest (nth 1 cmd) cmds (list cmd)))))))
;; Expand the command spec into the actual text.
(dolist (cmd (prog1 cmds (setq cmds nil)))
- (push (cons (eval (car cmd)) (cdr cmd)) cmds))
+ (push (cons (eval (car cmd) t) (cdr cmd)) cmds))
;; Select the favorite command from the history.
(let ((hist tex-compile-history)
re hist-cmd)
@@ -2446,7 +2446,7 @@ Only applies the FSPEC to the args part of FORMAT."
(completing-read
(format "Command [%s]: " (tex-summarize-command default))
(mapcar (lambda (x)
- (list (tex-format-cmd (eval (car x)) fspec)))
+ (list (tex-format-cmd (eval (car x) t) fspec)))
tex-compile-commands)
nil nil nil 'tex-compile-history default))))
(save-some-buffers (not compilation-ask-about-save) nil)
@@ -2740,7 +2740,7 @@ because there is no standard value that would generally work."
;; Restart the TeX shell if necessary.
(or (tex-shell-running)
(tex-start-shell))
- (let ((tex-dvi-print-command (eval tex-dvi-view-command)))
+ (let ((tex-dvi-print-command (eval tex-dvi-view-command t)))
(tex-print)))
(defun tex-append (file-name suffix)