From a5fa79d50e6e6182fef0a6dc526ac272e87e2c02 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 4 Dec 2020 17:55:46 +0100 Subject: [PATCH] Prefer setq-local in cedet * lisp/cedet/data-debug.el (data-debug-mode): * lisp/cedet/ede/custom.el (ede-customize-project): * lisp/cedet/ede/project-am.el (project-am-load-makefile): * lisp/cedet/mode-local.el (mode-local--activate-bindings): * lisp/cedet/semantic.el (semantic--set-buffer-cache): * lisp/cedet/semantic/analyze/debug.el (semantic-analyzer-debug-add-buttons): * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): * lisp/cedet/semantic/senator.el (senator-search-set-tag-class-filter): (senator-isearch-mode-hook): * lisp/cedet/semantic/symref/list.el (semantic-symref-produce-list-on-results) (semantic-symref-results-mode): * lisp/cedet/semantic/util-modes.el (semantic-stickyfunc-mode): * lisp/cedet/semantic/wisent/python.el (wisent-python-default-setup): * lisp/cedet/srecode/srt-mode.el (srecode-template-mode): Prefer setq-local. --- lisp/cedet/data-debug.el | 5 +-- lisp/cedet/ede/custom.el | 3 +- lisp/cedet/ede/project-am.el | 3 +- lisp/cedet/mode-local.el | 2 +- lisp/cedet/semantic.el | 3 +- lisp/cedet/semantic/analyze/debug.el | 2 +- lisp/cedet/semantic/grammar.el | 55 +++++++++++++--------------- lisp/cedet/semantic/senator.el | 18 ++++----- lisp/cedet/semantic/symref/list.el | 4 +- lisp/cedet/semantic/util-modes.el | 4 +- lisp/cedet/semantic/wisent/python.el | 4 +- lisp/cedet/srecode/srt-mode.el | 24 ++++++------ 12 files changed, 59 insertions(+), 68 deletions(-) diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el index 54b9024ebe2..8037c310f41 100644 --- a/lisp/cedet/data-debug.el +++ b/lisp/cedet/data-debug.el @@ -881,9 +881,8 @@ If PARENT is non-nil, it is somehow related as a parent to thing." (setq-local comment-start-skip "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") (buffer-disable-undo) - (set (make-local-variable 'font-lock-global-modes) nil) - (font-lock-mode -1) - ) + (setq-local font-lock-global-modes nil) + (font-lock-mode -1)) ;;;###autoload (defun data-debug-new-buffer (name) diff --git a/lisp/cedet/ede/custom.el b/lisp/cedet/ede/custom.el index 18621ad5f12..63d8b025c6c 100644 --- a/lisp/cedet/ede/custom.el +++ b/lisp/cedet/ede/custom.el @@ -50,8 +50,7 @@ (let* ((ov (oref (ede-current-project) local-variables)) (cp (ede-current-project))) (ede-customize cp) - (make-local-variable 'eieio-ede-old-variables) - (setq eieio-ede-old-variables ov))) + (setq-local eieio-ede-old-variables ov))) ;;;###autoload (defalias 'customize-project 'ede-customize-project) diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el index 61dc8a1fc60..9bd3babdf42 100644 --- a/lisp/cedet/ede/project-am.el +++ b/lisp/cedet/ede/project-am.el @@ -493,8 +493,7 @@ This is used when subprojects are made in named subdirectories." :file fn))) (oset ampf directory (file-name-directory fn)) (oset ampf configureoutputfiles cof) - (make-local-variable 'ede-object) - (setq ede-object ampf) + (setq-local ede-object ampf) ;; Move the rescan after we set ede-object to prevent recursion (project-rescan ampf) ampf)))) diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index a1aea30c20d..b965496cf48 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -314,7 +314,7 @@ Elements are (SYMBOL . PREVIOUS-VALUE), describing one variable." ;; Do the normal thing. (let (modes table old-locals) (unless mode - (set (make-local-variable 'mode-local--init-mode) major-mode) + (setq-local mode-local--init-mode major-mode) (setq mode major-mode)) ;; Get MODE's parents & MODE in the right order. (while mode diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el index 1be0e33c5fe..805582ce5e6 100644 --- a/lisp/cedet/semantic.el +++ b/lisp/cedet/semantic.el @@ -495,8 +495,7 @@ is requested." (setq semantic--buffer-cache tagtable semantic-unmatched-syntax-cache-check nil) ;; This is specific to the bovine parser. - (set (make-local-variable 'semantic-bovinate-nonterminal-check-obarray) - nil) + (setq-local semantic-bovinate-nonterminal-check-obarray nil) (semantic-parse-tree-set-up-to-date) (add-hook 'after-change-functions 'semantic-change-function nil t) (run-hook-with-args 'semantic-after-toplevel-cache-change-hook diff --git a/lisp/cedet/semantic/analyze/debug.el b/lisp/cedet/semantic/analyze/debug.el index 6ea54a200c5..db5b0960335 100644 --- a/lisp/cedet/semantic/analyze/debug.el +++ b/lisp/cedet/semantic/analyze/debug.el @@ -590,7 +590,7 @@ Look for key expressions, and add push-buttons near them." (with-current-buffer "*Help*" (let ((inhibit-read-only t)) (goto-char (point-min)) - (set (make-local-variable 'semantic-analyzer-debug-orig) orig-buffer) + (setq-local semantic-analyzer-debug-orig orig-buffer) ;; First, add do-in buttons to recommendations. (while (re-search-forward "^\\s-*M-x \\(\\(\\w\\|\\s_\\)+\\) " nil t) (let ((fcn (match-string 1))) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index b7670ef44b0..d3379462f4b 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1303,28 +1303,25 @@ the change bounds to encompass the whole nonterminal tag." "Initialize a buffer for editing Semantic grammars. \\{semantic-grammar-mode-map}" - (set (make-local-variable 'parse-sexp-ignore-comments) t) - (set (make-local-variable 'comment-start) ";;") + (setq-local parse-sexp-ignore-comments t) + (setq-local comment-start ";;") ;; Look within the line for a ; following an even number of backslashes ;; after either a non-backslash or the line beginning. - (set (make-local-variable 'comment-start-skip) - "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") - (set (make-local-variable 'indent-line-function) - 'semantic-grammar-indent) - (set (make-local-variable 'fill-paragraph-function) - 'lisp-fill-paragraph) - (set (make-local-variable 'font-lock-multiline) - 'undecided) - (set (make-local-variable 'font-lock-defaults) - '((semantic-grammar-mode-keywords - semantic-grammar-mode-keywords-1 - semantic-grammar-mode-keywords-2 - semantic-grammar-mode-keywords-3) - nil ;; perform string/comment fontification - nil ;; keywords are case sensitive. - ;; This puts _ & - as a word constituent, - ;; simplifying our keywords significantly - ((?_ . "w") (?- . "w")))) + (setq-local comment-start-skip + "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") + (setq-local indent-line-function #'semantic-grammar-indent) + (setq-local fill-paragraph-function #'lisp-fill-paragraph) + (setq-local font-lock-multiline 'undecided) + (setq-local font-lock-defaults + '((semantic-grammar-mode-keywords + semantic-grammar-mode-keywords-1 + semantic-grammar-mode-keywords-2 + semantic-grammar-mode-keywords-3) + nil ;; perform string/comment fontification + nil ;; keywords are case sensitive. + ;; This puts _ & - as a word constituent, + ;; simplifying our keywords significantly + ((?_ . "w") (?- . "w")))) ;; Setup Semantic to parse grammar (semantic-grammar-wy--install-parser) (setq semantic-lex-comment-regex ";;" @@ -1338,16 +1335,14 @@ the change bounds to encompass the whole nonterminal tag." (nonterminal . "Nonterminal") (rule . "Rule") )) - (set (make-local-variable 'semantic-format-face-alist) - '( - (code . default) - (keyword . font-lock-keyword-face) - (token . font-lock-type-face) - (nonterminal . font-lock-function-name-face) - (rule . default) - )) - (set (make-local-variable 'semantic-stickyfunc-sticky-classes) - '(nonterminal)) + (setq-local semantic-format-face-alist + '((code . default) + (keyword . font-lock-keyword-face) + (token . font-lock-type-face) + (nonterminal . font-lock-function-name-face) + (rule . default))) + (setq-local semantic-stickyfunc-sticky-classes + '(nonterminal)) ;; Before each change, clear the cached regexp used to highlight ;; macros local in this grammar. (add-hook 'before-change-functions diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el index e594232353a..49c1933508f 100644 --- a/lisp/cedet/semantic/senator.el +++ b/lisp/cedet/semantic/senator.el @@ -472,9 +472,9 @@ filters in `senator-search-tag-filter-functions' remain active." (if classes (let ((tag (make-symbol "tag")) (names (mapconcat 'symbol-name classes "', `"))) - (set (make-local-variable 'senator--search-filter) - `(lambda (,tag) - (memq (semantic-tag-class ,tag) ',classes))) + (setq-local senator--search-filter + `(lambda (,tag) + (memq (semantic-tag-class ,tag) ',classes))) (add-hook 'senator-search-tag-filter-functions senator--search-filter nil t) (message "Limit search to `%s' tags" names)) @@ -857,17 +857,17 @@ Use a senator search function when semantic isearch mode is enabled." ;; senator one. (when (and (local-variable-p 'isearch-search-fun-function) (not (local-variable-p 'senator-old-isearch-search-fun))) - (set (make-local-variable 'senator-old-isearch-search-fun) - isearch-search-fun-function)) - (set (make-local-variable 'isearch-search-fun-function) - 'senator-isearch-search-fun)) + (setq-local senator-old-isearch-search-fun + isearch-search-fun-function)) + (setq-local isearch-search-fun-function + 'senator-isearch-search-fun)) ;; When `senator-isearch-semantic-mode' is off restore the ;; previous `isearch-search-fun-function'. (when (eq isearch-search-fun-function 'senator-isearch-search-fun) (if (local-variable-p 'senator-old-isearch-search-fun) (progn - (set (make-local-variable 'isearch-search-fun-function) - senator-old-isearch-search-fun) + (setq-local isearch-search-fun-function + senator-old-isearch-search-fun) (kill-local-variable 'senator-old-isearch-search-fun)) (kill-local-variable 'isearch-search-fun-function))))) diff --git a/lisp/cedet/semantic/symref/list.el b/lisp/cedet/semantic/symref/list.el index fc7f9dbcb64..d64d4dd38cd 100644 --- a/lisp/cedet/semantic/symref/list.el +++ b/lisp/cedet/semantic/symref/list.el @@ -176,7 +176,7 @@ Display the references in `semantic-symref-results-mode'." (switch-to-buffer-other-window buff) (set-buffer buff) (semantic-symref-results-mode) - (set (make-local-variable 'semantic-symref-current-results) res) + (setq-local semantic-symref-current-results res) (semantic-symref-results-dump res) (goto-char (point-min)))) @@ -184,7 +184,7 @@ Display the references in `semantic-symref-results-mode'." "Major-mode for displaying Semantic Symbol Reference results." (buffer-disable-undo) ;; FIXME: Why bother turning off font-lock? - (set (make-local-variable 'font-lock-global-modes) nil) + (setq-local font-lock-global-modes nil) (font-lock-mode -1)) (defcustom semantic-symref-results-summary-function 'semantic-format-tag-prototype diff --git a/lisp/cedet/semantic/util-modes.el b/lisp/cedet/semantic/util-modes.el index 24df0098562..776c6b1894e 100644 --- a/lisp/cedet/semantic/util-modes.el +++ b/lisp/cedet/semantic/util-modes.el @@ -701,8 +701,8 @@ non-nil if the minor mode is enabled." (when (and (local-variable-p 'header-line-format (current-buffer)) (not (eq header-line-format semantic-stickyfunc-header-line-format))) - (set (make-local-variable 'semantic-stickyfunc-old-hlf) - header-line-format)) + (setq-local semantic-stickyfunc-old-hlf + header-line-format)) (setq header-line-format semantic-stickyfunc-header-line-format)) ;; Disable sticky func mode ;; Restore previous buffer local value of header line format if diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index 4e3519260a8..66d21f73143 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el @@ -503,10 +503,10 @@ Shortens `code' tags, but passes through for others." (defun wisent-python-default-setup () "Setup buffer for parse." (wisent-python-wy--install-parser) - (set (make-local-variable 'parse-sexp-ignore-comments) t) + (setq-local parse-sexp-ignore-comments t) ;; Give python modes the possibility to overwrite this: (if (not comment-start-skip) - (set (make-local-variable 'comment-start-skip) "#+\\s-*")) + (setq-local comment-start-skip "#+\\s-*")) (setq ;; Character used to separation a parent/child relationship semantic-type-relation-separator-character '(".") diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el index 4c1e030fceb..d82da40de80 100644 --- a/lisp/cedet/srecode/srt-mode.el +++ b/lisp/cedet/srecode/srt-mode.el @@ -191,18 +191,18 @@ we can tell font lock about them.") (define-derived-mode srecode-template-mode fundamental-mode "SRecode" ;; FIXME: Shouldn't it derive from prog-mode? "Major-mode for writing SRecode macros." - (set (make-local-variable 'comment-start) ";;") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'parse-sexp-ignore-comments) t) - (set (make-local-variable 'comment-start-skip) - "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") - (set (make-local-variable 'font-lock-defaults) - '(srecode-font-lock-keywords - nil ;; perform string/comment fontification - nil ;; keywords are case sensitive. - ;; This puts _ & - as a word constituent, - ;; simplifying our keywords significantly - ((?_ . "w") (?- . "w"))))) + (setq-local comment-start ";;") + (setq-local comment-end "") + (setq-local parse-sexp-ignore-comments t) + (setq-local comment-start-skip + "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") + (setq-local font-lock-defaults + '(srecode-font-lock-keywords + nil ;; perform string/comment fontification + nil ;; keywords are case sensitive. + ;; This puts _ & - as a word constituent, + ;; simplifying our keywords significantly + ((?_ . "w") (?- . "w"))))) ;;;###autoload (defalias 'srt-mode 'srecode-template-mode) -- 2.39.5