From 92eadba57fe86a49d67a7e3d797e3180ca0f6ae7 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 1 Dec 2012 12:09:55 +0800 Subject: [PATCH] Convert several major modes to setq-local. * emacs-lisp/lisp-mode.el (lisp-mode-variables, lisp-mode): * progmodes/autoconf.el (autoconf-mode): * progmodes/js.el (js-mode): * progmodes/make-mode.el (makefile-mode, makefile-makepp-mode) (makefile-bsdmake-mode, makefile-imake-mode, makefile-browse): * progmodes/perl-mode.el (perl-mode): * progmodes/sh-script.el (sh-mode, sh-set-shell): * textmodes/css-mode.el (css-mode): * textmodes/sgml-mode.el (html-mode, sgml-mode) (sgml-tags-invisible, sgml-guess-indent): * textmodes/tex-mode.el (tex-common-initialization) (latex-complete-bibtex-keys, tex-shell, tex-main-file) (doctex-mode, plain-tex-mode, latex-mode): * textmodes/texinfo.el (texinfo-mode): Use setq-local. --- lisp/ChangeLog | 17 +++++ lisp/emacs-lisp/lisp-mode.el | 51 ++++++--------- lisp/progmodes/autoconf.el | 29 ++++----- lisp/progmodes/js.el | 46 ++++++-------- lisp/progmodes/make-mode.el | 58 +++++++++--------- lisp/progmodes/perl-mode.el | 32 +++++----- lisp/progmodes/sh-script.el | 87 +++++++++++++------------- lisp/textmodes/css-mode.el | 21 +++---- lisp/textmodes/sgml-mode.el | 116 +++++++++++++++-------------------- lisp/textmodes/tex-mode.el | 101 ++++++++++++++---------------- lisp/textmodes/texinfo.el | 103 +++++++++++++++---------------- 11 files changed, 308 insertions(+), 353 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4dc694e486c..334efbc10e1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,20 @@ +2012-12-01 Chong Yidong + + * emacs-lisp/lisp-mode.el (lisp-mode-variables, lisp-mode): + * progmodes/autoconf.el (autoconf-mode): + * progmodes/js.el (js-mode): + * progmodes/make-mode.el (makefile-mode, makefile-makepp-mode) + (makefile-bsdmake-mode, makefile-imake-mode, makefile-browse): + * progmodes/perl-mode.el (perl-mode): + * progmodes/sh-script.el (sh-mode, sh-set-shell): + * textmodes/css-mode.el (css-mode): + * textmodes/sgml-mode.el (html-mode, sgml-mode) + (sgml-tags-invisible, sgml-guess-indent): + * textmodes/tex-mode.el (tex-common-initialization) + (latex-complete-bibtex-keys, tex-shell, tex-main-file) + (doctex-mode, plain-tex-mode, latex-mode): + * textmodes/texinfo.el (texinfo-mode): Use setq-local. + 2012-12-01 Kirk Kelsey * vc/vc-hg.el (vc-hg-next-revision): diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index bc61a24d9dc..81adab53c93 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -195,45 +195,33 @@ score-mode.el. KEYWORDS-CASE-INSENSITIVE non-nil means that for font-lock keywords will not be case sensitive." (when lisp-syntax (set-syntax-table lisp-mode-syntax-table)) - (make-local-variable 'paragraph-ignore-fill-prefix) - (setq paragraph-ignore-fill-prefix t) - (make-local-variable 'fill-paragraph-function) - (setq fill-paragraph-function 'lisp-fill-paragraph) + (setq-local paragraph-ignore-fill-prefix t) + (setq-local fill-paragraph-function 'lisp-fill-paragraph) ;; Adaptive fill mode gets the fill wrong for a one-line paragraph made of ;; a single docstring. Let's fix it here. - (set (make-local-variable 'adaptive-fill-function) - (lambda () (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") ""))) + (setq-local adaptive-fill-function + (lambda () (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") ""))) ;; Adaptive fill mode gets in the way of auto-fill, ;; and should make no difference for explicit fill ;; because lisp-fill-paragraph should do the job. ;; I believe that newcomment's auto-fill code properly deals with it -stef ;;(set (make-local-variable 'adaptive-fill-mode) nil) - (make-local-variable 'indent-line-function) - (setq indent-line-function 'lisp-indent-line) - (make-local-variable 'outline-regexp) - (setq outline-regexp ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|(") - (make-local-variable 'outline-level) - (setq outline-level 'lisp-outline-level) - (make-local-variable 'comment-start) - (setq comment-start ";") - (make-local-variable 'comment-start-skip) + (setq-local indent-line-function 'lisp-indent-line) + (setq-local outline-regexp ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|(") + (setq-local outline-level 'lisp-outline-level) + (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. - (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") - (make-local-variable 'font-lock-comment-start-skip) + (setq-local comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") ;; Font lock mode uses this only when it KNOWS a comment is starting. - (setq font-lock-comment-start-skip ";+ *") - (make-local-variable 'comment-add) - (setq comment-add 1) ;default to `;;' in comment-region - (make-local-variable 'comment-column) - (setq comment-column 40) + (setq-local font-lock-comment-start-skip ";+ *") + (setq-local comment-add 1) ;default to `;;' in comment-region + (setq-local comment-column 40) ;; Don't get confused by `;' in doc strings when paragraph-filling. - (set (make-local-variable 'comment-use-global-state) t) - (make-local-variable 'imenu-generic-expression) - (setq imenu-generic-expression lisp-imenu-generic-expression) - (make-local-variable 'multibyte-syntax-as-symbol) - (setq multibyte-syntax-as-symbol t) - (set (make-local-variable 'syntax-begin-function) 'beginning-of-defun) + (setq-local comment-use-global-state t) + (setq-local imenu-generic-expression lisp-imenu-generic-expression) + (setq-local multibyte-syntax-as-symbol t) + (setq-local syntax-begin-function 'beginning-of-defun) (setq font-lock-defaults `((lisp-font-lock-keywords lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) @@ -519,10 +507,9 @@ or to switch back to an existing one. Entry to this mode calls the value of `lisp-mode-hook' if that value is non-nil." (lisp-mode-variables nil t) - (set (make-local-variable 'find-tag-default-function) 'lisp-find-tag-default) - (make-local-variable 'comment-start-skip) - (setq comment-start-skip - "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") + (setq-local find-tag-default-function 'lisp-find-tag-default) + (setq-local comment-start-skip + "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *") (setq imenu-case-fold-search t)) (defun lisp-find-tag-default () diff --git a/lisp/progmodes/autoconf.el b/lisp/progmodes/autoconf.el index ac3a7282952..5deb60f9e41 100644 --- a/lisp/progmodes/autoconf.el +++ b/lisp/progmodes/autoconf.el @@ -78,22 +78,19 @@ searching backwards at another AC_... command." ;;;###autoload (define-derived-mode autoconf-mode prog-mode "Autoconf" "Major mode for editing Autoconf configure.ac files." - (set (make-local-variable 'parens-require-spaces) nil) ; for M4 arg lists - (set (make-local-variable 'defun-prompt-regexp) - "^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+") - (set (make-local-variable 'comment-start) "dnl ") - (set (make-local-variable 'comment-start-skip) - "\\(?:\\(\\W\\|\\`\\)dnl\\|#\\) +") - (set (make-local-variable 'syntax-propertize-function) - (syntax-propertize-rules ("\\" (0 "<")))) - (set (make-local-variable 'font-lock-defaults) - `(autoconf-font-lock-keywords nil nil (("_" . "w")))) - (set (make-local-variable 'imenu-generic-expression) - autoconf-imenu-generic-expression) - (set (make-local-variable 'imenu-syntax-alist) '(("_" . "w"))) - (set (make-local-variable 'indent-line-function) #'indent-relative) - (set (make-local-variable 'add-log-current-defun-function) - #'autoconf-current-defun-function)) + (setq-local parens-require-spaces nil) ; for M4 arg lists + (setq-local defun-prompt-regexp "^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+") + (setq-local comment-start "dnl ") + (setq-local comment-start-skip "\\(?:\\(\\W\\|\\`\\)dnl\\|#\\) +") + (setq-local syntax-propertize-function + (syntax-propertize-rules ("\\" (0 "<")))) + (setq-local font-lock-defaults + `(autoconf-font-lock-keywords nil nil (("_" . "w")))) + (setq-local imenu-generic-expression autoconf-imenu-generic-expression) + (setq-local imenu-syntax-alist '(("_" . "w"))) + (setq-local indent-line-function #'indent-relative) + (setq-local add-log-current-defun-function + #'autoconf-current-defun-function)) (provide 'autoconf-mode) (provide 'autoconf) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 33ef7607671..e6bba6a6609 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3306,29 +3306,21 @@ If one hasn't been set, or if it's stale, prompt for a new one." (define-derived-mode js-mode prog-mode "Javascript" "Major mode for editing JavaScript." :group 'js + (setq-local indent-line-function 'js-indent-line) + (setq-local beginning-of-defun-function 'js-beginning-of-defun) + (setq-local end-of-defun-function 'js-end-of-defun) + (setq-local open-paren-in-column-0-is-defun-start nil) + (setq-local font-lock-defaults (list js--font-lock-keywords)) + (setq-local syntax-propertize-function #'js-syntax-propertize) - (set (make-local-variable 'indent-line-function) 'js-indent-line) - (set (make-local-variable 'beginning-of-defun-function) - 'js-beginning-of-defun) - (set (make-local-variable 'end-of-defun-function) - 'js-end-of-defun) - - (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil) - (set (make-local-variable 'font-lock-defaults) - (list js--font-lock-keywords)) - (set (make-local-variable 'syntax-propertize-function) - #'js-syntax-propertize) - - (set (make-local-variable 'parse-sexp-ignore-comments) t) - (set (make-local-variable 'parse-sexp-lookup-properties) t) - (set (make-local-variable 'which-func-imenu-joiner-function) - #'js--which-func-joiner) + (setq-local parse-sexp-ignore-comments t) + (setq-local parse-sexp-lookup-properties t) + (setq-local which-func-imenu-joiner-function #'js--which-func-joiner) ;; Comments - (set (make-local-variable 'comment-start) "// ") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'fill-paragraph-function) - 'js-c-fill-paragraph) + (setq-local comment-start "// ") + (setq-local comment-end "") + (setq-local fill-paragraph-function 'js-c-fill-paragraph) ;; Parse cache (add-hook 'before-change-functions #'js--flush-caches t t) @@ -3338,8 +3330,7 @@ If one hasn't been set, or if it's stale, prompt for a new one." ;; Imenu (setq imenu-case-fold-search nil) - (set (make-local-variable 'imenu-create-index-function) - #'js--imenu-create-index) + (setq imenu-create-index-function #'js--imenu-create-index) ;; for filling, pretend we're cc-mode (setq c-comment-prefix-regexp "//+\\|\\**" @@ -3350,10 +3341,10 @@ If one hasn't been set, or if it's stale, prompt for a new one." c-comment-start-regexp "/[*/]\\|\\s!" comment-start-skip "\\(//+\\|/\\*+\\)\\s *") - (set (make-local-variable 'electric-indent-chars) - (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*". - (set (make-local-variable 'electric-layout-rules) - '((?\; . after) (?\{ . after) (?\} . before))) + (setq-local electric-indent-chars + (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*". + (setq-local electric-layout-rules + '((?\; . after) (?\{ . after) (?\} . before))) (let ((c-buffer-is-cc-mode t)) ;; FIXME: These are normally set by `c-basic-common-init'. Should @@ -3365,8 +3356,7 @@ If one hasn't been set, or if it's stale, prompt for a new one." (make-local-variable 'adaptive-fill-regexp) (c-setup-paragraph-variables)) - (set (make-local-variable 'syntax-begin-function) - #'js--syntax-begin-function) + (setq-local syntax-begin-function #'js--syntax-begin-function) ;; Important to fontify the whole buffer syntactically! If we don't, ;; then we might have regular expression literals that aren't marked diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 2f4419ba2ea..8e8cd74c7be 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -879,41 +879,42 @@ Makefile mode can be configured by modifying the following variables: (make-local-variable 'makefile-need-macro-pickup) ;; Font lock. - (set (make-local-variable 'font-lock-defaults) - ;; SYNTAX-BEGIN set to backward-paragraph to avoid slow-down - ;; near the end of a large buffer, due to parse-partial-sexp's - ;; trying to parse all the way till the beginning of buffer. - '(makefile-font-lock-keywords - nil nil - ((?$ . ".")) - backward-paragraph)) - (set (make-local-variable 'syntax-propertize-function) - makefile-syntax-propertize-function) + (setq-local font-lock-defaults + ;; Set SYNTAX-BEGIN to backward-paragraph to avoid + ;; slow-down near the end of a large buffer, due to + ;; `parse-partial-sexp' trying to parse all the way till + ;; the beginning of buffer. + '(makefile-font-lock-keywords + nil nil + ((?$ . ".")) + backward-paragraph)) + (setq-local syntax-propertize-function + makefile-syntax-propertize-function) ;; Add-log. - (set (make-local-variable 'add-log-current-defun-function) - 'makefile-add-log-defun) + (setq-local add-log-current-defun-function + 'makefile-add-log-defun) ;; Imenu. - (set (make-local-variable 'imenu-generic-expression) - makefile-imenu-generic-expression) + (setq-local imenu-generic-expression + makefile-imenu-generic-expression) ;; Dabbrev. - (set (make-local-variable 'dabbrev-abbrev-skip-leading-regexp) "\\$") + (setq-local dabbrev-abbrev-skip-leading-regexp "\\$") ;; Other abbrevs. (setq local-abbrev-table makefile-mode-abbrev-table) ;; Filling. - (set (make-local-variable 'fill-paragraph-function) 'makefile-fill-paragraph) + (setq-local fill-paragraph-function 'makefile-fill-paragraph) ;; Comment stuff. - (set (make-local-variable 'comment-start) "#") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'comment-start-skip) "#+[ \t]*") + (setq-local comment-start "#") + (setq-local comment-end "") + (setq-local comment-start-skip "#+[ \t]*") ;; Make sure TAB really inserts \t. - (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) + (setq-local indent-line-function 'indent-to-left-margin) ;; Real TABs are important in makefiles (setq indent-tabs-mode t)) @@ -934,8 +935,7 @@ Makefile mode can be configured by modifying the following variables: ;;;###autoload (define-derived-mode makefile-makepp-mode makefile-mode "Makeppfile" "An adapted `makefile-mode' that knows about makepp." - (set (make-local-variable 'makefile-rule-action-regex) - makefile-makepp-rule-action-regex) + (setq-local makefile-rule-action-regex makefile-makepp-rule-action-regex) (setq font-lock-defaults `(makefile-makepp-font-lock-keywords ,@(cdr font-lock-defaults)) imenu-generic-expression @@ -945,11 +945,9 @@ Makefile mode can be configured by modifying the following variables: ;;;###autoload (define-derived-mode makefile-bsdmake-mode makefile-mode "BSDmakefile" "An adapted `makefile-mode' that knows about BSD make." - (set (make-local-variable 'makefile-dependency-regex) - makefile-bsdmake-dependency-regex) - (set (make-local-variable 'makefile-dependency-skip) "^:!") - (set (make-local-variable 'makefile-rule-action-regex) - makefile-bsdmake-rule-action-regex) + (setq-local makefile-dependency-regex makefile-bsdmake-dependency-regex) + (setq-local makefile-dependency-skip "^:!") + (setq-local makefile-rule-action-regex makefile-bsdmake-rule-action-regex) (setq font-lock-defaults `(makefile-bsdmake-font-lock-keywords ,@(cdr font-lock-defaults)))) @@ -957,7 +955,7 @@ Makefile mode can be configured by modifying the following variables: (define-derived-mode makefile-imake-mode makefile-mode "Imakefile" "An adapted `makefile-mode' that knows about imake." :syntax-table makefile-imake-mode-syntax-table - (set (make-local-variable 'syntax-propertize-function) nil) + (setq-local syntax-propertize-function nil) (setq font-lock-defaults `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults)))) @@ -1501,8 +1499,8 @@ Insertion takes place at point." (pop-to-buffer browser-buffer) (makefile-browser-fill targets macros) (shrink-window-if-larger-than-buffer) - (set (make-local-variable 'makefile-browser-selection-vector) - (make-vector (+ (length targets) (length macros)) nil)) + (setq-local makefile-browser-selection-vector + (make-vector (+ (length targets) (length macros)) nil)) (makefile-browser-start-interaction)))) (defun makefile-switch-to-browser () diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index d2f7fc7a059..f8ae0030cf0 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el @@ -631,15 +631,15 @@ Various indentation styles: K&R BSD BLK GNU LW Turning on Perl mode runs the normal hook `perl-mode-hook'." :abbrev-table perl-mode-abbrev-table - (set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter)) - (set (make-local-variable 'paragraph-separate) paragraph-start) - (set (make-local-variable 'paragraph-ignore-fill-prefix) t) - (set (make-local-variable 'indent-line-function) #'perl-indent-line) - (set (make-local-variable 'comment-start) "# ") - (set (make-local-variable 'comment-end) "") - (set (make-local-variable 'comment-start-skip) "\\(^\\|\\s-\\);?#+ *") - (set (make-local-variable 'comment-indent-function) #'perl-comment-indent) - (set (make-local-variable 'parse-sexp-ignore-comments) t) + (setq-local paragraph-start (concat "$\\|" page-delimiter)) + (setq-local paragraph-separate paragraph-start) + (setq-local paragraph-ignore-fill-prefix t) + (setq-local indent-line-function #'perl-indent-line) + (setq-local comment-start "# ") + (setq-local comment-end "") + (setq-local comment-start-skip "\\(^\\|\\s-\\);?#+ *") + (setq-local comment-indent-function #'perl-comment-indent) + (setq-local parse-sexp-ignore-comments t) ;; Tell font-lock.el how to handle Perl. (setq font-lock-defaults '((perl-font-lock-keywords perl-font-lock-keywords-1 @@ -647,22 +647,20 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'." nil nil ((?\_ . "w")) nil (font-lock-syntactic-face-function . perl-font-lock-syntactic-face-function))) - (set (make-local-variable 'syntax-propertize-function) - #'perl-syntax-propertize-function) + (setq-local syntax-propertize-function #'perl-syntax-propertize-function) (add-hook 'syntax-propertize-extend-region-functions #'syntax-propertize-multiline 'append 'local) ;; Electricity. ;; FIXME: setup electric-layout-rules. - (set (make-local-variable 'electric-indent-chars) - (append '(?\{ ?\} ?\; ?\:) electric-indent-chars)) + (setq-local electric-indent-chars + (append '(?\{ ?\} ?\; ?\:) electric-indent-chars)) (add-hook 'electric-indent-functions #'perl-electric-noindent-p nil t) ;; Tell imenu how to handle Perl. - (set (make-local-variable 'imenu-generic-expression) - perl-imenu-generic-expression) + (setq-local imenu-generic-expression perl-imenu-generic-expression) (setq imenu-case-fold-search nil) ;; Setup outline-minor-mode. - (set (make-local-variable 'outline-regexp) perl-outline-regexp) - (set (make-local-variable 'outline-level) 'perl-outline-level)) + (setq-local outline-regexp perl-outline-regexp) + (setq-local outline-level 'perl-outline-level)) ;; This is used by indent-for-comment ;; to decide how much to indent a comment in Perl code diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 5af14e51f49..243b712febb 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1497,42 +1497,41 @@ with your script for an edit-interpret-debug cycle." (make-local-variable 'sh-shell-file) (make-local-variable 'sh-shell) - (set (make-local-variable 'skeleton-pair-default-alist) - sh-skeleton-pair-default-alist) - (set (make-local-variable 'skeleton-end-hook) - (lambda () (or (eolp) (newline) (indent-relative)))) - - (set (make-local-variable 'paragraph-start) (concat page-delimiter "\\|$")) - (set (make-local-variable 'paragraph-separate) paragraph-start) - (set (make-local-variable 'comment-start) "# ") - (set (make-local-variable 'comment-start-skip) "#+[\t ]*") - (set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table) - (set (make-local-variable 'comint-dynamic-complete-functions) - sh-dynamic-complete-functions) + (setq-local skeleton-pair-default-alist + sh-skeleton-pair-default-alist) + (setq-local skeleton-end-hook + (lambda () (or (eolp) (newline) (indent-relative)))) + + (setq-local paragraph-start (concat page-delimiter "\\|$")) + (setq-local paragraph-separate paragraph-start) + (setq-local comment-start "# ") + (setq-local comment-start-skip "#+[\t ]*") + (setq-local local-abbrev-table sh-mode-abbrev-table) + (setq-local comint-dynamic-complete-functions + sh-dynamic-complete-functions) (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t) ;; we can't look if previous line ended with `\' - (set (make-local-variable 'comint-prompt-regexp) "^[ \t]*") - (set (make-local-variable 'imenu-case-fold-search) nil) - (set (make-local-variable 'font-lock-defaults) - `((sh-font-lock-keywords - sh-font-lock-keywords-1 sh-font-lock-keywords-2) - nil nil - ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil - (font-lock-syntactic-face-function - . sh-font-lock-syntactic-face-function))) - (set (make-local-variable 'syntax-propertize-function) - #'sh-syntax-propertize-function) + (setq-local comint-prompt-regexp "^[ \t]*") + (setq-local imenu-case-fold-search nil) + (setq font-lock-defaults + `((sh-font-lock-keywords + sh-font-lock-keywords-1 sh-font-lock-keywords-2) + nil nil + ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil + (font-lock-syntactic-face-function + . sh-font-lock-syntactic-face-function))) + (setq-local syntax-propertize-function #'sh-syntax-propertize-function) (add-hook 'syntax-propertize-extend-region-functions #'syntax-propertize-multiline 'append 'local) (sh-electric-here-document-mode 1) - (set (make-local-variable 'skeleton-pair-alist) '((?` _ ?`))) - (set (make-local-variable 'skeleton-pair-filter-function) 'sh-quoted-p) - (set (make-local-variable 'skeleton-further-elements) - '((< '(- (min sh-indentation (current-column)))))) - (set (make-local-variable 'skeleton-filter-function) 'sh-feature) - (set (make-local-variable 'skeleton-newline-indent-rigidly) t) - (set (make-local-variable 'defun-prompt-regexp) - (concat "^\\(function[ \t]\\|[[:alnum:]]+[ \t]+()[ \t]+\\)")) + (setq-local skeleton-pair-alist '((?` _ ?`))) + (setq-local skeleton-pair-filter-function 'sh-quoted-p) + (setq-local skeleton-further-elements + '((< '(- (min sh-indentation (current-column)))))) + (setq-local skeleton-filter-function 'sh-feature) + (setq-local skeleton-newline-indent-rigidly t) + (setq-local defun-prompt-regexp + (concat "^\\(function[ \t]\\|[[:alnum:]]+[ \t]+()[ \t]+\\)")) ;; Parse or insert magic number for exec, and set all variables depending ;; on the shell thus determined. (sh-set-shell @@ -2104,19 +2103,19 @@ Calls the value of `sh-set-shell-hook' if set." (executable-set-magic shell (sh-feature sh-shell-arg) no-query-flag insert-flag))) (setq mode-line-process (format "[%s]" sh-shell)) - (set (make-local-variable 'sh-shell-variables) nil) - (set (make-local-variable 'sh-shell-variables-initialized) nil) - (set (make-local-variable 'imenu-generic-expression) - (sh-feature sh-imenu-generic-expression)) + (setq-local sh-shell-variables nil) + (setq-local sh-shell-variables-initialized nil) + (setq-local imenu-generic-expression + (sh-feature sh-imenu-generic-expression)) (let ((tem (sh-feature sh-mode-syntax-table-input))) (when tem - (set (make-local-variable 'sh-mode-syntax-table) - (apply 'sh-mode-syntax-table tem)) + (setq-local sh-mode-syntax-table + (apply 'sh-mode-syntax-table tem)) (set-syntax-table sh-mode-syntax-table))) (dolist (var (sh-feature sh-variables)) (sh-remember-variable var)) - (if (set (make-local-variable 'sh-indent-supported-here) - (sh-feature sh-indent-supported)) + (if (setq-local sh-indent-supported-here + (sh-feature sh-indent-supported)) (progn (message "Setting up indent for shell type %s" sh-shell) (if sh-use-smie @@ -2127,16 +2126,16 @@ Calls the value of `sh-set-shell-hook' if set." (funcall mksym "rules") :forward-token (funcall mksym "forward-token") :backward-token (funcall mksym "backward-token"))) - (set (make-local-variable 'parse-sexp-lookup-properties) t) - (set (make-local-variable 'sh-kw-alist) (sh-feature sh-kw)) + (setq-local parse-sexp-lookup-properties t) + (setq-local sh-kw-alist (sh-feature sh-kw)) (let ((regexp (sh-feature sh-kws-for-done))) (if regexp - (set (make-local-variable 'sh-regexp-for-done) - (sh-mkword-regexpr (regexp-opt regexp t))))) + (setq-local sh-regexp-for-done + (sh-mkword-regexpr (regexp-opt regexp t))))) (message "setting up indent stuff") ;; sh-mode has already made indent-line-function local ;; but do it in case this is called before that. - (set (make-local-variable 'indent-line-function) 'sh-indent-line)) + (setq-local indent-line-function 'sh-indent-line)) (if sh-make-vars-local (sh-make-vars-local)) (message "Indentation setup for shell type %s" sh-shell)) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index d50aadef25b..ba104e7b394 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -266,22 +266,21 @@ ;;;###autoload (define-derived-mode css-mode fundamental-mode "CSS" "Major mode to edit Cascading Style Sheets." - (set (make-local-variable 'font-lock-defaults) css-font-lock-defaults) - (set (make-local-variable 'comment-start) "/*") - (set (make-local-variable 'comment-start-skip) "/\\*+[ \t]*") - (set (make-local-variable 'comment-end) "*/") - (set (make-local-variable 'comment-end-skip) "[ \t]*\\*+/") - (set (make-local-variable 'forward-sexp-function) 'css-forward-sexp) - (set (make-local-variable 'parse-sexp-ignore-comments) t) - (set (make-local-variable 'indent-line-function) 'css-indent-line) - (set (make-local-variable 'fill-paragraph-function) - 'css-fill-paragraph) + (setq-local font-lock-defaults css-font-lock-defaults) + (setq-local comment-start "/*") + (setq-local comment-start-skip "/\\*+[ \t]*") + (setq-local comment-end "*/") + (setq-local comment-end-skip "[ \t]*\\*+/") + (setq-local forward-sexp-function 'css-forward-sexp) + (setq-local parse-sexp-ignore-comments t) + (setq-local indent-line-function 'css-indent-line) + (setq-local fill-paragraph-function 'css-fill-paragraph) (when css-electric-keys (let ((fc (make-char-table 'auto-fill-chars))) (set-char-table-parent fc auto-fill-chars) (dolist (c css-electric-keys) (aset fc c 'indent-according-to-mode)) - (set (make-local-variable 'auto-fill-chars) fc)))) + (setq-local auto-fill-chars fc)))) (defvar comment-continue) diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index ed031664246..820822222af 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -463,47 +463,39 @@ Do \\[describe-key] on the following bindings to discover what they do. ;; A start or end tag by itself on a line separates a paragraph. ;; This is desirable because SGML discards a newline that appears ;; immediately after a start tag or immediately before an end tag. - (set (make-local-variable 'paragraph-start) (concat "[ \t]*$\\|\ + (setq-local paragraph-start (concat "[ \t]*$\\|\ \[ \t]*")) - (set (make-local-variable 'paragraph-separate) - (concat paragraph-start "$")) - (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*") + (setq-local paragraph-separate (concat paragraph-start "$")) + (setq-local adaptive-fill-regexp "[ \t]*") (add-hook 'fill-nobreak-predicate 'sgml-fill-nobreak nil t) - (set (make-local-variable 'indent-line-function) 'sgml-indent-line) - (set (make-local-variable 'comment-start) "") - (set (make-local-variable 'comment-indent-function) 'sgml-comment-indent) - (set (make-local-variable 'comment-line-break-function) - 'sgml-comment-indent-new-line) - (set (make-local-variable 'skeleton-further-elements) - '((completion-ignore-case t))) - (set (make-local-variable 'skeleton-end-hook) - (lambda () - (or (eolp) - (not (or (eq v2 '\n) (eq (car-safe v2) '\n))) - (newline-and-indent)))) - (set (make-local-variable 'font-lock-defaults) - '((sgml-font-lock-keywords - sgml-font-lock-keywords-1 - sgml-font-lock-keywords-2) - nil t)) - (set (make-local-variable 'syntax-propertize-function) - sgml-syntax-propertize-function) - (set (make-local-variable 'facemenu-add-face-function) - 'sgml-mode-facemenu-add-face-function) - (set (make-local-variable 'sgml-xml-mode) (sgml-xml-guess)) - (if sgml-xml-mode - () - (set (make-local-variable 'skeleton-transformation-function) - sgml-transformation-function)) + (setq-local indent-line-function 'sgml-indent-line) + (setq-local comment-start "") + (setq-local comment-indent-function 'sgml-comment-indent) + (setq-local comment-line-break-function 'sgml-comment-indent-new-line) + (setq-local skeleton-further-elements '((completion-ignore-case t))) + (setq-local skeleton-end-hook + (lambda () + (or (eolp) + (not (or (eq v2 '\n) (eq (car-safe v2) '\n))) + (newline-and-indent)))) + (setq font-lock-defaults '((sgml-font-lock-keywords + sgml-font-lock-keywords-1 + sgml-font-lock-keywords-2) + nil t)) + (setq-local syntax-propertize-function sgml-syntax-propertize-function) + (setq-local facemenu-add-face-function 'sgml-mode-facemenu-add-face-function) + (setq-local sgml-xml-mode (sgml-xml-guess)) + (unless sgml-xml-mode + (setq-local skeleton-transformation-function sgml-transformation-function)) ;; This will allow existing comments within declarations to be ;; recognized. ;; I can't find a clear description of SGML/XML comments, but it seems that ;; the only reliable ones are although it's not clear what ;; "..." can contain. It used to accept -- ... -- as well, but that was ;; apparently a mistake. - (set (make-local-variable 'comment-start-skip) "