From: Stefan Kangas Date: Sun, 23 Jun 2024 13:41:23 +0000 (+0200) Subject: Prefer setq-local in reftex X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=56f270fe1ec5a8b36516fac8406b9955da69e4bc;p=emacs.git Prefer setq-local in reftex * lisp/textmodes/reftex-global.el (reftex-find-duplicate-labels) (reftex-isearch-minor-mode): * lisp/textmodes/reftex-index.el (reftex-index-mode) (reftex-display-index, reftex-index-initialize-phrases-buffer) (reftex-index-phrases-mode): * lisp/textmodes/reftex-sel.el (reftex-select-label-mode) (reftex-select-bib-mode, reftex-insert-docstruct, reftex-select-item): * lisp/textmodes/reftex-toc.el (reftex-toc-mode, reftex-toc): * lisp/textmodes/reftex.el (reftex-fontify-select-label-buffer): Prefer setq-local. (cherry picked from commit b9ce39ba809f49fe80d5b9a6d41afe1fe144fc77) --- diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el index 0eaffec3b54..7b4407ec336 100644 --- a/lisp/textmodes/reftex-global.el +++ b/lisp/textmodes/reftex-global.el @@ -152,7 +152,7 @@ No active TAGS table is required." (setq dlist (reftex-uniquify-by-car dlist)) (if (null dlist) (error "No duplicate labels in document")) (switch-to-buffer-other-window "*Duplicate Labels*") - (set (make-local-variable 'TeX-master) master) + (setq-local TeX-master master) (erase-buffer) (insert " MULTIPLE LABELS IN CURRENT DOCUMENT:\n") (insert @@ -492,17 +492,16 @@ With no argument, this command toggles (with-current-buffer crt-buf (when reftex-mode (if (boundp 'multi-isearch-next-buffer-function) - (set (make-local-variable - 'multi-isearch-next-buffer-function) - #'reftex-isearch-switch-to-next-file) - (set (make-local-variable 'isearch-wrap-function) - #'reftex-isearch-wrap-function) - (set (make-local-variable 'isearch-search-fun-function) - (lambda () #'reftex-isearch-isearch-search)) - (set (make-local-variable 'isearch-push-state-function) - #'reftex-isearch-push-state-function) - (set (make-local-variable 'isearch-next-buffer-function) - #'reftex-isearch-switch-to-next-file)) + (setq-local multi-isearch-next-buffer-function + #'reftex-isearch-switch-to-next-file) + (setq-local isearch-wrap-function + #'reftex-isearch-wrap-function) + (setq-local isearch-search-fun-function + (lambda () #'reftex-isearch-isearch-search)) + (setq-local isearch-push-state-function + #'reftex-isearch-push-state-function) + (setq-local isearch-next-buffer-function + #'reftex-isearch-switch-to-next-file)) (setq reftex-isearch-minor-mode t)))) (add-hook 'reftex-mode-hook #'reftex-isearch-minor-mode)) (dolist (crt-buf (buffer-list)) diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index a93afd63855..db476ff5c0b 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el @@ -387,9 +387,9 @@ Press `?' for a summary of important key bindings, or check the menu. Here are all local bindings. \\{reftex-index-mode-map}" - (set (make-local-variable 'revert-buffer-function) #'reftex-index-revert) - (set (make-local-variable 'reftex-index-restriction-data) nil) - (set (make-local-variable 'reftex-index-restriction-indicator) nil) + (setq-local revert-buffer-function #'reftex-index-revert) + (setq-local reftex-index-restriction-data nil) + (setq-local reftex-index-restriction-indicator nil) (setq mode-line-format (list "---- " 'mode-line-buffer-identification " " 'global-mode-string @@ -511,9 +511,9 @@ With prefix 3, restrict index to region." ;; If the buffer is currently restricted, empty it to force update. (when reftex-index-restriction-data (reftex-erase-buffer)) - (set (make-local-variable 'reftex-last-index-file) calling-file) - (set (make-local-variable 'reftex-index-tag) index-tag) - (set (make-local-variable 'reftex-docstruct-symbol) docstruct-symbol) + (setq-local reftex-last-index-file calling-file) + (setq-local reftex-index-tag index-tag) + (setq-local reftex-docstruct-symbol docstruct-symbol) (if restriction (setq reftex-index-restriction-indicator (car restriction) reftex-index-restriction-data (cdr restriction)) @@ -1303,8 +1303,7 @@ If the buffer is non-empty, delete the old header first." (lambda (a _b) (equal (car a) default-macro)))) macro entry key repeat) - (if master (set (make-local-variable 'TeX-master) - (file-name-nondirectory master))) + (when master (setq-local TeX-master (file-name-nondirectory master))) (when (> (buffer-size) 0) (goto-char 1) @@ -1387,9 +1386,9 @@ Here are all local bindings. \\{reftex-index-phrases-mode-map}" :syntax-table reftex-index-phrases-syntax-table - (set (make-local-variable 'font-lock-defaults) - reftex-index-phrases-font-lock-defaults) - (set (make-local-variable 'reftex-index-phrases-marker) (make-marker))) + (setq-local font-lock-defaults + reftex-index-phrases-font-lock-defaults) + (setq-local reftex-index-phrases-marker (make-marker))) ;; (add-hook 'reftex-index-phrases-mode-hook #'turn-on-font-lock) (defun reftex-index-next-phrase (&optional arg) diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el index fa36543daf4..aec89448481 100644 --- a/lisp/textmodes/reftex-sel.el +++ b/lisp/textmodes/reftex-sel.el @@ -97,7 +97,7 @@ Press `?' for a summary of important key bindings. During a selection process, these are the local bindings. \\{reftex-select-label-mode-map}" - (set (make-local-variable 'reftex-select-marked) nil) + (setq-local reftex-select-marked nil) (when (syntax-table-p reftex-latex-syntax-table) (set-syntax-table reftex-latex-syntax-table)) ;; We do not set a local map - reftex-select-item does this. @@ -136,7 +136,7 @@ Press `?' for a summary of important key bindings. During a selection process, these are the local bindings. \\{reftex-select-label-mode-map}" - (set (make-local-variable 'reftex-select-marked) nil) + (setq-local reftex-select-marked nil) ;; We do not set a local map - reftex-select-item does this. ) @@ -236,9 +236,9 @@ During a selection process, these are the local bindings. (concat "\\`" (regexp-quote (file-name-directory (reftex-TeX-master-file)))))) - (set (make-local-variable 'reftex-docstruct-symbol) docstruct-symbol) - (set (make-local-variable 'reftex-prefix) - (cdr (assoc labels reftex-typekey-to-prefix-alist))) + (setq-local reftex-docstruct-symbol docstruct-symbol) + (setq-local reftex-prefix + (cdr (assoc labels reftex-typekey-to-prefix-alist))) (if (equal reftex-prefix " ") (setq reftex-prefix nil)) ;; Walk the docstruct and insert the appropriate stuff @@ -459,7 +459,7 @@ During a selection process, these are the local bindings. (reftex-find-start-point (point-min) offset reftex-last-data reftex-last-line) (beginning-of-line 1) - (set (make-local-variable 'reftex-last-follow-point) (point)) + (setq-local reftex-last-follow-point (point)) (unwind-protect (progn @@ -480,9 +480,9 @@ During a selection process, these are the local bindings. (mapc (lambda (c) (delete-overlay (nth 1 c))) reftex-select-marked))))) - (set (make-local-variable 'reftex-last-line) - (+ (count-lines (point-min) (point)) (if (bolp) 1 0))) - (set (make-local-variable 'reftex-last-data) reftex--last-data) + (setq-local reftex-last-line + (+ (count-lines (point-min) (point)) (if (bolp) 1 0))) + (setq-local reftex-last-data reftex--last-data) (reftex-kill-buffer "*RefTeX Help*") (setq reftex-callback-fwd (not reftex-callback-fwd)) ;; ;-))) (message "") diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index 1cc6e27e780..fe5a32f15f0 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -1,6 +1,6 @@ ;;; reftex-toc.el --- RefTeX's table of contents mode -*- lexical-binding: t; -*- -;; Copyright (C) 1997-2000, 2003-2024 Free Software Foundation, Inc. +;; Copyright (C) 1997-2024 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Maintainer: auctex-devel@gnu.org @@ -125,13 +125,13 @@ Press `?' for a summary of important key bindings. Here are all local bindings. \\{reftex-toc-mode-map}" - (set (make-local-variable 'transient-mark-mode) t) - (set (make-local-variable 'revert-buffer-function) #'reftex-toc-revert) - (set (make-local-variable 'reftex-toc-include-labels-indicator) "") - (set (make-local-variable 'reftex-toc-max-level-indicator) - (if (= reftex-toc-max-level 100) - "ALL" - (int-to-string reftex-toc-max-level))) + (setq-local transient-mark-mode t) + (setq-local revert-buffer-function #'reftex-toc-revert) + (setq-local reftex-toc-include-labels-indicator "") + (setq-local reftex-toc-max-level-indicator + (if (= reftex-toc-max-level 100) + "ALL" + (int-to-string reftex-toc-max-level))) (setq mode-line-format (list "---- " 'mode-line-buffer-identification " " 'global-mode-string " (" mode-name ")" @@ -241,7 +241,7 @@ When called with a raw \\[universal-argument] prefix, rescan the document first. (switch-to-buffer "*toc*")) (or (eq major-mode 'reftex-toc-mode) (reftex-toc-mode)) - (set (make-local-variable 'reftex-docstruct-symbol) docstruct-symbol) + (setq-local reftex-docstruct-symbol docstruct-symbol) (setq reftex-toc-include-labels-indicator (if (eq reftex-toc-include-labels t) "ALL" diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 6974a4be4a7..efe38337001 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -1,6 +1,6 @@ ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX -*- lexical-binding: t; -*- -;; Copyright (C) 1997-2000, 2003-2024 Free Software Foundation, Inc. +;; Copyright (C) 1997-2024 Free Software Foundation, Inc. ;; Author: Carsten Dominik ;; Maintainer: auctex-devel@gnu.org @@ -2036,8 +2036,8 @@ IGNORE-WORDS List of words which should be removed from the string." ;; of font-lock) (rename-buffer newname t) ;; Good: we have the indirection functions - (set (make-local-variable 'font-lock-fontify-region-function) - #'reftex-select-font-lock-fontify-region) + (setq-local font-lock-fontify-region-function + #'reftex-select-font-lock-fontify-region) (let ((major-mode 'latex-mode)) (font-lock-mode 1))) (rename-buffer oldname))))