summaryrefslogtreecommitdiff
path: root/lisp/textmodes/reftex-global.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/reftex-global.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/reftex-global.el')
-rw-r--r--lisp/textmodes/reftex-global.el34
1 files changed, 17 insertions, 17 deletions
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index 4d021609019..3b7518e5c3f 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -1,4 +1,4 @@
-;;; reftex-global.el --- operations on entire documents with RefTeX
+;;; reftex-global.el --- operations on entire documents with RefTeX -*- lexical-binding: t; -*-
;; Copyright (C) 1997-2021 Free Software Foundation, Inc.
@@ -39,7 +39,7 @@ The TAGS file is also immediately visited with `visit-tags-table'."
(reftex-access-scan-info current-prefix-arg)
(let* ((master (reftex-TeX-master-file))
(files (reftex-all-document-files))
- (cmd (format "etags %s" (mapconcat 'shell-quote-argument
+ (cmd (format "etags %s" (mapconcat #'shell-quote-argument
files " "))))
(with-current-buffer (reftex-get-file-buffer-force master)
(message "Running etags to create TAGS file...")
@@ -65,7 +65,7 @@ No active TAGS table is required."
(let* ((files (reftex-all-document-files t))
(cmd (format
"%s %s" grep-cmd
- (mapconcat 'identity files " "))))
+ (mapconcat #'identity files " "))))
(grep cmd)))
;;;###autoload
@@ -160,7 +160,7 @@ No active TAGS table is required."
(when (and (car (car dlist))
(cdr (car dlist)))
(cl-incf cnt)
- (insert (mapconcat 'identity (car dlist) "\n ") "\n"))
+ (insert (mapconcat #'identity (car dlist) "\n ") "\n"))
(pop dlist))
(goto-char (point-min))
(when (= cnt 0)
@@ -208,7 +208,7 @@ one with the `xr' package."
(error "Abort"))
;; Make the translation list
(let* ((re-core (concat "\\("
- (mapconcat 'cdr reftex-typekey-to-prefix-alist "\\|")
+ (mapconcat #'cdr reftex-typekey-to-prefix-alist "\\|")
"\\)"))
(label-re (concat "\\`" re-core "\\([0-9]+\\)\\'"))
(search-re (concat "[{,]\\(" re-core "\\([0-9]+\\)\\)[,}]"))
@@ -326,7 +326,7 @@ labels."
file buffer)
(save-current-buffer
(while (setq file (pop files))
- (setq buffer (reftex-get-buffer-visiting file))
+ (setq buffer (find-buffer-visiting file))
(when buffer
(set-buffer buffer)
(save-buffer))))))
@@ -344,7 +344,7 @@ Also checks if buffers visiting the files are in read-only mode."
(ding)
(or (y-or-n-p (format "No write access to %s. Continue? " file))
(error "Abort")))
- (when (and (setq buf (reftex-get-buffer-visiting file))
+ (when (and (setq buf (find-buffer-visiting file))
(with-current-buffer buf
buffer-read-only))
(ding)
@@ -366,10 +366,10 @@ Also checks if buffers visiting the files are in read-only mode."
(goto-char (if isearch-forward (point-min) (point-max))))
(defun reftex-isearch-push-state-function ()
- `(lambda (cmd)
- (reftex-isearch-pop-state-function cmd ,(current-buffer))))
+ (let ((buf (current-buffer)))
+ (lambda (cmd) (reftex-isearch-pop-state-function cmd buf))))
-(defun reftex-isearch-pop-state-function (cmd buffer)
+(defun reftex-isearch-pop-state-function (_cmd buffer)
(switch-to-buffer buffer))
(defun reftex-isearch-isearch-search (string bound noerror)
@@ -451,17 +451,17 @@ With no argument, this command toggles
(if (boundp 'multi-isearch-next-buffer-function)
(set (make-local-variable
'multi-isearch-next-buffer-function)
- 'reftex-isearch-switch-to-next-file)
+ #'reftex-isearch-switch-to-next-file)
(set (make-local-variable 'isearch-wrap-function)
- 'reftex-isearch-wrap-function)
+ #'reftex-isearch-wrap-function)
(set (make-local-variable 'isearch-search-fun-function)
- (lambda () 'reftex-isearch-isearch-search))
+ (lambda () #'reftex-isearch-isearch-search))
(set (make-local-variable 'isearch-push-state-function)
- 'reftex-isearch-push-state-function)
+ #'reftex-isearch-push-state-function)
(set (make-local-variable 'isearch-next-buffer-function)
- 'reftex-isearch-switch-to-next-file))
+ #'reftex-isearch-switch-to-next-file))
(setq reftex-isearch-minor-mode t))))
- (add-hook 'reftex-mode-hook 'reftex-isearch-minor-mode))
+ (add-hook 'reftex-mode-hook #'reftex-isearch-minor-mode))
(dolist (crt-buf (buffer-list))
(with-current-buffer crt-buf
(when reftex-mode
@@ -472,7 +472,7 @@ With no argument, this command toggles
(kill-local-variable 'isearch-push-state-function)
(kill-local-variable 'isearch-next-buffer-function))
(setq reftex-isearch-minor-mode nil))))
- (remove-hook 'reftex-mode-hook 'reftex-isearch-minor-mode)))
+ (remove-hook 'reftex-mode-hook #'reftex-isearch-minor-mode)))
;; Force mode line redisplay.
(set-buffer-modified-p (buffer-modified-p))))