From: Stefan Kangas Date: Fri, 4 Dec 2020 15:00:12 +0000 (+0100) Subject: Prefer setq-local in most of textmodes/*.el X-Git-Tag: emacs-28.0.90~4926 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e6320b11f07c269982dfd0cbf016dec4452daf6d;p=emacs.git Prefer setq-local in most of textmodes/*.el * lisp/textmodes/artist.el (artist-mode-init): * lisp/textmodes/bibtex.el (bibtex-mode): * lisp/textmodes/dns-mode.el (dns-mode): * lisp/textmodes/enriched.el (enriched-mode): * lisp/textmodes/ispell.el (ispell-buffer-local-parsing): * lisp/textmodes/nroff-mode.el (nroff-mode): * lisp/textmodes/picture.el (picture-mode): * lisp/textmodes/refill.el (refill-mode): * lisp/textmodes/two-column.el (2C-split): Prefer setq-local. --- diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index 90e8d360c1b..cc2eaf1e4e9 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el @@ -1413,32 +1413,20 @@ Keymap summary (aset artist-replacement-table ?\t ?\s) (aset artist-replacement-table 0 ?\s) ;; More setup - (make-local-variable 'artist-key-is-drawing) - (make-local-variable 'artist-key-endpoint1) - (make-local-variable 'artist-key-poly-point-list) - (make-local-variable 'artist-key-shape) - (make-local-variable 'artist-key-draw-how) - (make-local-variable 'artist-popup-menu-table) - (make-local-variable 'artist-key-compl-table) - (make-local-variable 'artist-prev-next-op-alist) - (make-local-variable 'artist-rb-save-data) - (make-local-variable 'artist-arrow-point-1) - (make-local-variable 'artist-arrow-point-2) - (setq artist-key-is-drawing nil) - (setq artist-key-endpoint1 nil) - (setq artist-key-poly-point-list nil) - (setq artist-key-shape nil) - (setq artist-popup-menu-table (artist-compute-popup-menu-table artist-mt)) - (setq artist-key-compl-table (artist-compute-key-compl-table artist-mt)) - (setq artist-prev-next-op-alist - (artist-make-prev-next-op-alist artist-key-compl-table)) - (setq artist-rb-save-data (make-vector 7 0)) - (setq artist-arrow-point-1 nil) - (setq artist-arrow-point-2 nil) - (make-local-variable 'next-line-add-newlines) - (setq next-line-add-newlines t) - (setq artist-key-draw-how - (artist-go-get-draw-how-from-symbol artist-curr-go)) + (setq-local artist-key-is-drawing nil) + (setq-local artist-key-endpoint1 nil) + (setq-local artist-key-poly-point-list nil) + (setq-local artist-key-shape nil) + (setq-local artist-popup-menu-table (artist-compute-popup-menu-table artist-mt)) + (setq-local artist-key-compl-table (artist-compute-key-compl-table artist-mt)) + (setq-local artist-prev-next-op-alist + (artist-make-prev-next-op-alist artist-key-compl-table)) + (setq-local artist-rb-save-data (make-vector 7 0)) + (setq-local artist-arrow-point-1 nil) + (setq-local artist-arrow-point-2 nil) + (setq-local next-line-add-newlines t) + (setq-local artist-key-draw-how + (artist-go-get-draw-how-from-symbol artist-curr-go)) (if (and artist-picture-compatibility (not (eq major-mode 'picture-mode))) (progn (picture-mode) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 77fc6990d9c..cb0b95bc20b 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -3457,38 +3457,38 @@ if that value is non-nil. (setq bibtex-parse-idle-timer (run-with-idle-timer bibtex-parse-keys-timeout t 'bibtex-parse-buffers-stealthily))) - (set (make-local-variable 'paragraph-start) "[ \f\n\t]*$") - (set (make-local-variable 'comment-column) 0) - (set (make-local-variable 'defun-prompt-regexp) "^[ \t]*@[[:alnum:]]+[ \t]*") - (set (make-local-variable 'outline-regexp) "[ \t]*@") - (set (make-local-variable 'fill-paragraph-function) #'bibtex-fill-field) - (set (make-local-variable 'font-lock-defaults) - '(bibtex-font-lock-keywords - nil t ((?$ . "\"") - ;; Mathematical expressions should be fontified as strings - (?\" . ".") - ;; Quotes are field delimiters and quote-delimited - ;; entries should be fontified in the same way as - ;; brace-delimited ones - ) - nil - (font-lock-extra-managed-props . (category)) - (font-lock-mark-block-function - . (lambda () - (set-mark (bibtex-end-of-entry)) - (bibtex-beginning-of-entry))))) - (set (make-local-variable 'syntax-propertize-function) - (syntax-propertize-via-font-lock - bibtex-font-lock-syntactic-keywords)) + (setq-local paragraph-start "[ \f\n\t]*$") + (setq-local comment-column 0) + (setq-local defun-prompt-regexp "^[ \t]*@[[:alnum:]]+[ \t]*") + (setq-local outline-regexp "[ \t]*@") + (setq-local fill-paragraph-function #'bibtex-fill-field) + (setq-local font-lock-defaults + '(bibtex-font-lock-keywords + nil t ((?$ . "\"") + ;; Mathematical expressions should be fontified as strings + (?\" . ".") + ;; Quotes are field delimiters and quote-delimited + ;; entries should be fontified in the same way as + ;; brace-delimited ones + ) + nil + (font-lock-extra-managed-props . (category)) + (font-lock-mark-block-function + . (lambda () + (set-mark (bibtex-end-of-entry)) + (bibtex-beginning-of-entry))))) + (setq-local syntax-propertize-function + (syntax-propertize-via-font-lock + bibtex-font-lock-syntactic-keywords)) (let ((fun (lambda () (bibtex-set-dialect) - (set (make-local-variable 'comment-start) bibtex-comment-start) - (set (make-local-variable 'comment-start-skip) - (concat (regexp-quote bibtex-comment-start) "\\>[ \t]*")) - (set (make-local-variable 'fill-prefix) - (make-string (+ bibtex-entry-offset - bibtex-contline-indentation) - ?\s))))) + (setq-local comment-start bibtex-comment-start) + (setq-local comment-start-skip + (concat (regexp-quote bibtex-comment-start) "\\>[ \t]*")) + (setq-local fill-prefix + (make-string (+ bibtex-entry-offset + bibtex-contline-indentation) + ?\s))))) (if (and buffer-file-name enable-local-variables) (add-hook 'hack-local-variables-hook fun nil t) (funcall fun)))) @@ -4014,15 +4014,15 @@ of the head of the entry found. Return nil if no entry found." (defun bibtex-init-sort-entry-class-alist () "Initialize `bibtex-sort-entry-class-alist' (buffer-local)." (unless (local-variable-p 'bibtex-sort-entry-class-alist) - (set (make-local-variable 'bibtex-sort-entry-class-alist) - (let ((i -1) alist) - (dolist (class bibtex-sort-entry-class) - (setq i (1+ i)) - (dolist (entry class) - ;; All entry types should be downcase (for ease of comparison). - (push (cons (if (stringp entry) (downcase entry) entry) i) - alist))) - alist)))) + (setq-local bibtex-sort-entry-class-alist + (let ((i -1) alist) + (dolist (class bibtex-sort-entry-class) + (setq i (1+ i)) + (dolist (entry class) + ;; All entry types should be downcase (for ease of comparison). + (push (cons (if (stringp entry) (downcase entry) entry) i) + alist))) + alist)))) (defun bibtex-lessp (index1 index2) "Predicate for sorting BibTeX entries with indices INDEX1 and INDEX2. diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index 712955e84de..dd28cb8f9a4 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el @@ -178,11 +178,11 @@ variables for customizing indentation. It has its own abbrev table and its own syntax table. Turning on DNS mode runs `dns-mode-hook'." - (set (make-local-variable 'comment-start) ";") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'comment-start-skip) ";+ *") - (set (make-local-variable 'font-lock-defaults) - '(dns-mode-font-lock-keywords nil nil ((?_ . "w")))) + (setq-local comment-start ";") + (setq-local comment-end "") + (setq-local comment-start-skip ";+ *") + (setq-local font-lock-defaults + '(dns-mode-font-lock-keywords nil nil ((?_ . "w")))) (add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial nil t)) diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el index 1656f3cb5fe..919e09076d2 100644 --- a/lisp/textmodes/enriched.el +++ b/lisp/textmodes/enriched.el @@ -247,9 +247,8 @@ Commands: (list 'buffer-display-table buffer-display-table 'default-text-properties default-text-properties 'use-hard-newlines use-hard-newlines)) - (make-local-variable 'enriched-default-text-properties-local-flag) - (setq enriched-default-text-properties-local-flag - (local-variable-p 'default-text-properties)) + (setq-local enriched-default-text-properties-local-flag + (local-variable-p 'default-text-properties)) (make-local-variable 'default-text-properties) (setq buffer-display-table enriched-display-table) (use-hard-newlines 1 (if enriched-rerun-flag 'never nil)) diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 14de77cd542..ba7f36da76c 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -4098,7 +4098,7 @@ Includes LaTeX/Nroff modes and extended character mode." (progn (ispell-send-string "+\n") ; set ispell mode to tex (if (not (eq ispell-parser 'tex)) - (set (make-local-variable 'ispell-parser) 'tex))) + (setq-local ispell-parser 'tex))) (ispell-send-string "-\n")) ; set mode to normal (nroff) ;; If needed, test for SGML & HTML modes and set a buffer local nil/t value. (if (and ispell-skip-html (not (eq ispell-skip-html t))) diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el index bb2582cf7a2..2d7ab13f480 100644 --- a/lisp/textmodes/nroff-mode.el +++ b/lisp/textmodes/nroff-mode.el @@ -134,35 +134,32 @@ Turning on Nroff mode runs `text-mode-hook', then `nroff-mode-hook'. Also, try `nroff-electric-mode', for automatically inserting closing requests for requests that are used in matched pairs." - (set (make-local-variable 'font-lock-defaults) - ;; SYNTAX-BEGIN is set to backward-paragraph to avoid slow-down - ;; near the end of large buffers due to searching to buffer's - ;; beginning. - '(nroff-font-lock-keywords nil t nil backward-paragraph)) - (set (make-local-variable 'outline-regexp) "\\.H[ ]+[1-7]+ ") - (set (make-local-variable 'outline-level) 'nroff-outline-level) + (setq-local font-lock-defaults + ;; SYNTAX-BEGIN is set to backward-paragraph to avoid slow-down + ;; near the end of large buffers due to searching to buffer's + ;; beginning. + '(nroff-font-lock-keywords nil t nil backward-paragraph)) + (setq-local outline-regexp "\\.H[ ]+[1-7]+ ") + (setq-local outline-level 'nroff-outline-level) ;; now define a bunch of variables for use by commands in this mode - (set (make-local-variable 'page-delimiter) "^\\.\\(bp\\|SK\\|OP\\)") - (set (make-local-variable 'paragraph-start) - (concat "[.']\\|" paragraph-start)) - (set (make-local-variable 'paragraph-separate) - (concat "[.']\\|" paragraph-separate)) + (setq-local page-delimiter "^\\.\\(bp\\|SK\\|OP\\)") + (setq-local paragraph-start (concat "[.']\\|" paragraph-start)) + (setq-local paragraph-separate (concat "[.']\\|" paragraph-separate)) ;; Don't auto-fill directive lines starting . or ' since they normally ;; have to be one line. But do auto-fill comments .\" .\# and '''. ;; Comment directives (those starting . or ') are [.'][ \t]*\\[#"] ;; or ''', and this regexp is everything except those. So [.'] ;; followed by not backslash and not ' or followed by backslash but ;; then not # or " - (set (make-local-variable 'auto-fill-inhibit-regexp) - "[.'][ \t]*\\([^ \t\\']\\|\\\\[^#\"]\\)") + (setq-local auto-fill-inhibit-regexp + "[.'][ \t]*\\([^ \t\\']\\|\\\\[^#\"]\\)") ;; comment syntax added by mit-erl!gildea 18 Apr 86 - (set (make-local-variable 'comment-start) "\\\" ") - (set (make-local-variable 'comment-start-skip) "\\\\[\"#][ \t]*") - (set (make-local-variable 'comment-column) 24) - (set (make-local-variable 'comment-indent-function) 'nroff-comment-indent) - (set (make-local-variable 'comment-insert-comment-function) - 'nroff-insert-comment-function) - (set (make-local-variable 'imenu-generic-expression) nroff-imenu-expression)) + (setq-local comment-start "\\\" ") + (setq-local comment-start-skip "\\\\[\"#][ \t]*") + (setq-local comment-column 24) + (setq-local comment-indent-function #'nroff-comment-indent) + (setq-local comment-insert-comment-function #'nroff-insert-comment-function) + (setq-local imenu-generic-expression nroff-imenu-expression)) (defun nroff-outline-level () (save-excursion diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 5216812b587..9cf61c6c5ee 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -764,18 +764,17 @@ they are not by default assigned to keys." (interactive) (if (eq major-mode 'picture-mode) (error "You are already editing a picture") - (set (make-local-variable 'picture-mode-old-local-map) (current-local-map)) + (setq-local picture-mode-old-local-map (current-local-map)) (use-local-map picture-mode-map) - (set (make-local-variable 'picture-mode-old-mode-name) mode-name) - (set (make-local-variable 'picture-mode-old-major-mode) major-mode) + (setq-local picture-mode-old-mode-name mode-name) + (setq-local picture-mode-old-major-mode major-mode) (setq major-mode 'picture-mode) - (set (make-local-variable 'picture-killed-rectangle) nil) - (set (make-local-variable 'tab-stop-list) (default-value 'tab-stop-list)) - (set (make-local-variable 'picture-tab-chars) - (default-value 'picture-tab-chars)) + (setq-local picture-killed-rectangle nil) + (setq-local tab-stop-list (default-value 'tab-stop-list)) + (setq-local picture-tab-chars (default-value 'picture-tab-chars)) (make-local-variable 'picture-vertical-step) (make-local-variable 'picture-horizontal-step) - (set (make-local-variable 'picture-mode-old-truncate-lines) truncate-lines) + (setq-local picture-mode-old-truncate-lines truncate-lines) (setq truncate-lines t) (picture-set-motion 0 1) diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el index a83e6b37583..139221fae37 100644 --- a/lisp/textmodes/refill.el +++ b/lisp/textmodes/refill.el @@ -237,16 +237,14 @@ For true \"word wrap\" behavior, use `visual-line-mode' instead." (add-hook 'after-change-functions 'refill-after-change-function nil t) (add-hook 'post-command-hook 'refill-post-command-function nil t) (add-hook 'pre-command-hook 'refill-pre-command-function nil t) - (set (make-local-variable 'refill-saved-state) - (mapcar (lambda (s) (cons s (symbol-value s))) - '(fill-paragraph-function auto-fill-function))) + (setq-local refill-saved-state + (mapcar (lambda (s) (cons s (symbol-value s))) + '(fill-paragraph-function auto-fill-function))) ;; This provides the test for recursive paragraph filling. - (set (make-local-variable 'fill-paragraph-function) - 'refill-fill-paragraph) + (setq-local fill-paragraph-function #'refill-fill-paragraph) ;; When using justification, doing DEL on 2 spaces should remove ;; both, otherwise, the subsequent refill will undo the DEL. - (set (make-local-variable 'backward-delete-char-untabify-method) - 'hungry) + (setq-local backward-delete-char-untabify-method 'hungry) (setq refill-ignorable-overlay (make-overlay 1 1 nil nil t)) (overlay-put refill-ignorable-overlay 'modification-hooks '(refill-adjust-ignorable-overlay)) diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el index e75ff7a8102..227e2dffd8b 100644 --- a/lisp/textmodes/two-column.el +++ b/lisp/textmodes/two-column.el @@ -388,9 +388,8 @@ First column's text sSs Second column's text (backward-char arg) (setq chars (buffer-substring (point) point)) (skip-chars-forward " \t" point) - (make-local-variable '2C-separator) - (setq 2C-separator (buffer-substring (point) point) - 2C-window-width (+ (fringe-columns 'left) + (setq-local 2C-separator (buffer-substring (point) point)) + (setq 2C-window-width (+ (fringe-columns 'left) (fringe-columns 'right) (scroll-bar-columns 'left) (scroll-bar-columns 'right)