From 485622bbd1afad4c1e39a245cf57605208ca606f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 17 Mar 2021 23:32:39 -0400 Subject: * 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. (): 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 (): 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. --- lisp/textmodes/reftex-dcr.el | 46 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 35 deletions(-) (limited to 'lisp/textmodes/reftex-dcr.el') diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el index e517cea2669..a21dd3362b0 100644 --- a/lisp/textmodes/reftex-dcr.el +++ b/lisp/textmodes/reftex-dcr.el @@ -1,4 +1,4 @@ -;;; reftex-dcr.el --- viewing cross references and citations with RefTeX +;;; reftex-dcr.el --- viewing cross references and citations with RefTeX -*- lexical-binding: t; -*- ;; Copyright (C) 1997-2021 Free Software Foundation, Inc. @@ -132,7 +132,7 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." ((eq bibtype 'thebib) (setq item t files (reftex-uniquify - (mapcar 'cdr + (mapcar #'cdr (reftex-all-assq 'thebib (symbol-value reftex-docstruct-symbol)))))) (reftex-default-bibliography @@ -161,10 +161,10 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." (shrink-window (1- (- (window-height) size))) (recenter 0)) ;; Arrange restoration - (add-hook 'pre-command-hook 'reftex-restore-window-conf)) + (add-hook 'pre-command-hook #'reftex-restore-window-conf)) ;; Normal display in other window - (add-hook 'pre-command-hook 'reftex-highlight-shall-die) + (add-hook 'pre-command-hook #'reftex-highlight-shall-die) (setq pop-win (selected-window)) (select-window win) (goto-char pos) @@ -212,13 +212,13 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." (error (set-window-configuration window-conf) (message "ref: Label %s not found" label) (error "ref: Label %s not found" label)))) ;; 2nd is line OK - (add-hook 'pre-command-hook 'reftex-highlight-shall-die) + (add-hook 'pre-command-hook #'reftex-highlight-shall-die) (when (eq how 'tmp-window) ;; Resize window and arrange restoration (shrink-window (1- (- (window-height) 9))) (recenter '(4)) - (add-hook 'pre-command-hook 'reftex-restore-window-conf)) + (add-hook 'pre-command-hook #'reftex-restore-window-conf)) (setq pop-win (selected-window)) (select-window win) (goto-char pos) @@ -266,7 +266,7 @@ With argument, actually select the window showing the cross reference." (defun reftex-restore-window-conf () (set-window-configuration (get 'reftex-auto-view-crossref 'last-window-conf)) (put 'reftex-auto-view-crossref 'last-window-conf nil) - (remove-hook 'pre-command-hook 'reftex-restore-window-conf)) + (remove-hook 'pre-command-hook #'reftex-restore-window-conf)) (defun reftex-echo-ref (label entry docstruct) ;; Display crossref info in echo area. @@ -320,10 +320,6 @@ With argument, actually select the window showing the cross reference." (with-current-buffer buf (run-hooks 'reftex-display-copied-context-hook))))) -(defvar reftex-use-itimer-in-xemacs nil - "Non-nil means use the idle timers in XEmacs for crossref display. -Currently, idle timer restart is broken and we use the post-command-hook.") - ;;;###autoload (defun reftex-toggle-auto-view-crossref () "Toggle the automatic display of crossref information in the echo area. @@ -332,36 +328,16 @@ will display info in the echo area." (interactive) (if reftex-auto-view-crossref-timer (progn - (if (featurep 'xemacs) - (if reftex-use-itimer-in-xemacs - (delete-itimer reftex-auto-view-crossref-timer) - (remove-hook 'post-command-hook 'reftex-start-itimer-once)) - (cancel-timer reftex-auto-view-crossref-timer)) + (cancel-timer reftex-auto-view-crossref-timer) (setq reftex-auto-view-crossref-timer nil) (message "Automatic display of crossref information was turned off")) (setq reftex-auto-view-crossref-timer - (if (featurep 'xemacs) - (if reftex-use-itimer-in-xemacs - (start-itimer "RefTeX Idle Timer" - 'reftex-view-crossref-when-idle - reftex-idle-time reftex-idle-time t) - (add-hook 'post-command-hook 'reftex-start-itimer-once) - t) - (run-with-idle-timer - reftex-idle-time t 'reftex-view-crossref-when-idle))) + (run-with-idle-timer + reftex-idle-time t #'reftex-view-crossref-when-idle)) (unless reftex-auto-view-crossref (setq reftex-auto-view-crossref t)) (message "Automatic display of crossref information was turned on"))) -(defun reftex-start-itimer-once () - (and (featurep 'xemacs) - reftex-mode - (not (itimer-live-p reftex-auto-view-crossref-timer)) - (setq reftex-auto-view-crossref-timer - (start-itimer "RefTeX Idle Timer" - 'reftex-view-crossref-when-idle - reftex-idle-time nil t)))) - ;;;###autoload (defun reftex-view-crossref-from-bibtex (&optional arg) "View location in a LaTeX document which cites the BibTeX entry at point. @@ -431,7 +407,7 @@ Calling this function several times find successive citation locations." (put 'reftex-view-regexp-match :cnt (cl-incf cnt)) (reftex-highlight 0 (match-beginning highlight-group) (match-end highlight-group)) - (add-hook 'pre-command-hook 'reftex-highlight-shall-die) + (add-hook 'pre-command-hook #'reftex-highlight-shall-die) (setq pop-window (selected-window))) (put 'reftex-view-regexp-match :props nil) (or cont (set-window-configuration window-conf))) -- cgit v1.2.3