From 22caab8bacf76ae439f8b647218b37334bfd87bd Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 9 Dec 2020 08:34:35 +0100 Subject: [PATCH] Prefer setq-local in some remaining progmodes * lisp/progmodes/dcl-mode.el (dcl-mode): * lisp/progmodes/hideif.el (hide-ifdef-mode) (hide-ifdef-toggle-shadowing): * lisp/progmodes/ps-mode.el (ps-mode, ps-run-mode): * lisp/progmodes/xscheme.el (xscheme-start) (local-set-scheme-interaction-buffer, scheme-interaction-mode): Prefer setq-local. --- lisp/progmodes/dcl-mode.el | 12 ++++++------ lisp/progmodes/hideif.el | 16 ++++++++-------- lisp/progmodes/ps-mode.el | 26 +++++++++++++------------- lisp/progmodes/xscheme.el | 18 +++++++++--------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el index ca45795adc0..9bafd7aa42c 100644 --- a/lisp/progmodes/dcl-mode.el +++ b/lisp/progmodes/dcl-mode.el @@ -588,17 +588,17 @@ $ There is some minimal font-lock support (see vars `dcl-font-lock-defaults' and `dcl-font-lock-keywords')." - (set (make-local-variable 'indent-line-function) 'dcl-indent-line) - (set (make-local-variable 'comment-start) "!") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'comment-multi-line) nil) + (setq-local indent-line-function 'dcl-indent-line) + (setq-local comment-start "!") + (setq-local comment-end "") + (setq-local comment-multi-line nil) ;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct. ;; The drawback was that you couldn't make empty comment lines by pressing ;; C-M-j repeatedly - only the first line became a comment line. ;; This version has the drawback that the "$" can be anywhere in the line, ;; and something inappropriate might be interpreted as a comment. - (set (make-local-variable 'comment-start-skip) "\\$[ \t]*![ \t]*") + (setq-local comment-start-skip "\\$[ \t]*![ \t]*") (if (boundp 'imenu-generic-expression) (progn (setq imenu-generic-expression dcl-imenu-generic-expression) @@ -619,7 +619,7 @@ There is some minimal font-lock support (see vars (make-local-variable 'dcl-electric-reindent-regexps) ;; font lock - (set (make-local-variable 'font-lock-defaults) dcl-font-lock-defaults) + (setq-local font-lock-defaults dcl-font-lock-defaults) (tempo-use-tag-list 'dcl-tempo-tags)) diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index 25e75235aa4..7cbc9708fce 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -302,17 +302,17 @@ Several variables affect how the hiding is done: ;; We can still simulate the behavior of older hideif versions (i.e. ;; `hide-ifdef-env' being buffer local) by clearing this variable ;; (C-c @ C) every time before hiding current buffer. -;; (set (make-local-variable 'hide-ifdef-env) +;; (setq-local hide-ifdef-env ;; (default-value 'hide-ifdef-env)) (set 'hide-ifdef-env (default-value 'hide-ifdef-env)) ;; Some C/C++ headers might have other ways to prevent reinclusion and ;; thus would like `hide-ifdef-expand-reinclusion-protection' to be nil. - (set (make-local-variable 'hide-ifdef-expand-reinclusion-protection) - (default-value 'hide-ifdef-expand-reinclusion-protection)) - (set (make-local-variable 'hide-ifdef-hiding) - (default-value 'hide-ifdef-hiding)) - (set (make-local-variable 'hif-outside-read-only) buffer-read-only) - (set (make-local-variable 'line-move-ignore-invisible) t) + (setq-local hide-ifdef-expand-reinclusion-protection + (default-value 'hide-ifdef-expand-reinclusion-protection)) + (setq-local hide-ifdef-hiding + (default-value 'hide-ifdef-hiding)) + (setq-local hif-outside-read-only buffer-read-only) + (setq-local line-move-ignore-invisible t) (add-hook 'change-major-mode-hook (lambda () (hide-ifdef-mode -1)) nil t) @@ -1792,7 +1792,7 @@ It does not do the work that's pointless to redo on a recursive entry." (defun hide-ifdef-toggle-shadowing () "Toggle shadowing." (interactive) - (set (make-local-variable 'hide-ifdef-shadow) (not hide-ifdef-shadow)) + (setq-local hide-ifdef-shadow (not hide-ifdef-shadow)) (message "Shadowing %s" (if hide-ifdef-shadow "ON" "OFF")) (save-restriction (widen) diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el index 6db7a14a241..bcf7bfdefc8 100644 --- a/lisp/progmodes/ps-mode.el +++ b/lisp/progmodes/ps-mode.el @@ -501,18 +501,18 @@ point to the corresponding spot in the PostScript window, if input to the interpreter was sent from that window. Typing \\\\[ps-run-goto-error] when the cursor is at the number has the same effect." (setq-local syntax-propertize-function #'ps-mode-syntax-propertize) - (set (make-local-variable 'font-lock-defaults) - '((ps-mode-font-lock-keywords - ps-mode-font-lock-keywords-1 - ps-mode-font-lock-keywords-2 - ps-mode-font-lock-keywords-3) - nil)) + (setq-local font-lock-defaults + '((ps-mode-font-lock-keywords + ps-mode-font-lock-keywords-1 + ps-mode-font-lock-keywords-2 + ps-mode-font-lock-keywords-3) + nil)) (smie-setup nil #'ps-mode-smie-rules) (setq-local electric-indent-chars (append '(?> ?\] ?\}) electric-indent-chars)) - (set (make-local-variable 'comment-start) "%") + (setq-local comment-start "%") ;; NOTE: `\' has a special meaning in strings only - (set (make-local-variable 'comment-start-skip) "%+[ \t]*") + (setq-local comment-start-skip "%+[ \t]*") ;; enable doc-view-minor-mode => C-c C-c starts viewing the current ps file ;; with doc-view-mode. (doc-view-minor-mode 1)) @@ -910,11 +910,11 @@ plus the usually uncoded characters inserted on positions 1 through 28." (define-derived-mode ps-run-mode comint-mode "Interactive PS" "Major mode in interactive PostScript window. This mode is invoked from `ps-mode' and should not be called directly." - (set (make-local-variable 'font-lock-defaults) - '((ps-run-font-lock-keywords - ps-run-font-lock-keywords-1 - ps-run-font-lock-keywords-2) - t)) + (setq-local font-lock-defaults + '((ps-run-font-lock-keywords + ps-run-font-lock-keywords-1 + ps-run-font-lock-keywords-2) + t)) (setq mode-line-process '(":%s"))) (defun ps-run-running () diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el index c6997862f7f..cdbafbaf897 100644 --- a/lisp/progmodes/xscheme.el +++ b/lisp/progmodes/xscheme.el @@ -173,7 +173,7 @@ With argument, asks for a command line." (setq-default xscheme-process-command-line command-line) (switch-to-buffer (xscheme-start-process command-line process-name buffer-name)) - (set (make-local-variable 'xscheme-process-command-line) command-line)) + (setq-local xscheme-process-command-line command-line)) (defun xscheme-read-command-line (arg) (let ((default @@ -264,11 +264,11 @@ With argument, asks for a command line." xscheme-buffer-name t))) (let ((process-name (verify-xscheme-buffer buffer-name t))) - (set (make-local-variable 'xscheme-buffer-name) buffer-name) - (set (make-local-variable 'xscheme-process-name) process-name) - (set (make-local-variable 'xscheme-runlight) - (with-current-buffer buffer-name - xscheme-runlight)))) + (setq-local xscheme-buffer-name buffer-name) + (setq-local xscheme-process-name process-name) + (setq-local xscheme-runlight + (with-current-buffer buffer-name + xscheme-runlight)))) (defun local-clear-scheme-interaction-buffer () "Make the current buffer use the default scheme interaction buffer." @@ -375,10 +375,10 @@ Entry to this mode runs `scheme-mode-hook' and then (kill-all-local-variables) (make-local-variable 'xscheme-runlight-string) (make-local-variable 'xscheme-runlight) - (set (make-local-variable 'xscheme-previous-mode) previous-mode) + (setq-local xscheme-previous-mode previous-mode) (let ((buffer (current-buffer))) - (set (make-local-variable 'xscheme-buffer-name) (buffer-name buffer)) - (set (make-local-variable 'xscheme-last-input-end) (make-marker)) + (setq-local xscheme-buffer-name (buffer-name buffer)) + (setq-local xscheme-last-input-end (make-marker)) (let ((process (get-buffer-process buffer))) (when process (setq-local xscheme-process-name (process-name process)) -- 2.39.2