+2012-12-01 Chong Yidong <cyd@gnu.org>
+
+ * 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 <kirk.kelsey@0x4b.net>
* vc/vc-hg.el (vc-hg-next-revision):
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)
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 ()
;;;###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 ("\\<dnl\\>" (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 ("\\<dnl\\>" (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)
(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)
;; 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 "//+\\|\\**"
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
(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
(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))
;;;###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
;;;###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))))
(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))))
(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 ()
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
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))
\f
;; This is used by indent-for-comment
;; to decide how much to indent a comment in Perl code
(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
(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
(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))
;;;###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)
;; 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]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>"))
- (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-end) " -->")
- (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-end " -->")
+ (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) "<!--[ \t]*")
- (set (make-local-variable 'comment-end-skip) "[ \t]*--[ \t\n]*>")
+ (setq-local comment-start-skip "<!--[ \t]*")
+ (setq-local comment-end-skip "[ \t]*--[ \t\n]*>")
;; This definition has an HTML leaning but probably fits well for other modes.
(setq imenu-generic-expression
`((nil
(unwind-protect
(save-excursion
(goto-char (point-min))
- (if (set (make-local-variable 'sgml-tags-invisible)
- (if arg
- (>= (prefix-numeric-value arg) 0)
- (not sgml-tags-invisible)))
+ (if (setq-local sgml-tags-invisible
+ (if arg
+ (>= (prefix-numeric-value arg) 0)
+ (not sgml-tags-invisible)))
(while (re-search-forward sgml-tag-name-re nil t)
(setq string
(cdr (assq (intern-soft (downcase (match-string 1)))
(goto-char (point-min))
(if (re-search-forward "^\\([ \t]+\\)<" 500 'noerror)
(progn
- (set (make-local-variable 'sgml-basic-offset)
- (1- (current-column)))
+ (setq-local sgml-basic-offset (1- (current-column)))
(message "Guessed sgml-basic-offset = %d"
sgml-basic-offset)
))))
(eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil))
\\{html-mode-map}"
- (set (make-local-variable 'sgml-display-text) html-display-text)
- (set (make-local-variable 'sgml-tag-face-alist) html-tag-face-alist)
- (make-local-variable 'sgml-tag-alist)
- (make-local-variable 'sgml-face-tag-alist)
- (make-local-variable 'sgml-tag-help)
- (make-local-variable 'outline-regexp)
- (make-local-variable 'outline-heading-end-regexp)
- (make-local-variable 'outline-level)
- (make-local-variable 'sentence-end-base)
- (setq sentence-end-base "[.?!][]\"'”)}]*\\(<[^>]*>\\)*"
- sgml-tag-alist html-tag-alist
- sgml-face-tag-alist html-face-tag-alist
- sgml-tag-help html-tag-help
- outline-regexp "^.*<[Hh][1-6]\\>"
- outline-heading-end-regexp "</[Hh][1-6]>"
- outline-level (lambda ()
- (char-before (match-end 0))))
+ (setq-local sgml-display-text html-display-text)
+ (setq-local sgml-tag-face-alist html-tag-face-alist)
+ (setq-local sgml-tag-alist html-tag-alist)
+ (setq-local sgml-face-tag-alist html-face-tag-alist)
+ (setq-local sgml-tag-help html-tag-help)
+ (setq-local outline-regexp "^.*<[Hh][1-6]\\>")
+ (setq-local outline-heading-end-regexp "</[Hh][1-6]>")
+ (setq-local outline-level
+ (lambda () (char-before (match-end 0))))
+ (setq-local sentence-end-base "[.?!][]\"'”)}]*\\(<[^>]*>\\)*")
+
(setq imenu-create-index-function 'html-imenu-index)
- (set (make-local-variable 'sgml-empty-tags)
- ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd',
- ;; plus manual addition of "wbr".
- '("area" "base" "basefont" "br" "col" "frame" "hr" "img" "input"
- "isindex" "link" "meta" "param" "wbr"))
- (set (make-local-variable 'sgml-unclosed-tags)
- ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd'.
- '("body" "colgroup" "dd" "dt" "head" "html" "li" "option"
- "p" "tbody" "td" "tfoot" "th" "thead" "tr"))
+
+ (setq-local sgml-empty-tags
+ ;; From HTML-4.01's loose.dtd, parsed with
+ ;; `sgml-parse-dtd', plus manual addition of "wbr".
+ '("area" "base" "basefont" "br" "col" "frame" "hr" "img" "input"
+ "isindex" "link" "meta" "param" "wbr"))
+ (setq-local sgml-unclosed-tags
+ ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd'.
+ '("body" "colgroup" "dd" "dt" "head" "html" "li" "option"
+ "p" "tbody" "td" "tfoot" "th" "thead" "tr"))
;; It's for the user to decide if it defeats it or not -stef
;; (make-local-variable 'imenu-sort-function)
;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose
Entering Plain-tex mode runs the hook `text-mode-hook', then the hook
`tex-mode-hook', and finally the hook `plain-tex-mode-hook'. When the
special subshell is initiated, the hook `tex-shell-hook' is run."
- (set (make-local-variable 'tex-command) tex-run-command)
- (set (make-local-variable 'tex-start-of-header) "%\\*\\*start of header")
- (set (make-local-variable 'tex-end-of-header) "%\\*\\*end of header")
- (set (make-local-variable 'tex-trailer) "\\bye\n"))
+ (setq-local tex-command tex-run-command)
+ (setq-local tex-start-of-header "%\\*\\*start of header")
+ (setq-local tex-end-of-header "%\\*\\*end of header")
+ (setq-local tex-trailer "\\bye\n"))
;;;###autoload
(define-derived-mode latex-mode tex-mode "LaTeX"
Entering Latex mode runs the hook `text-mode-hook', then
`tex-mode-hook', and finally `latex-mode-hook'. When the special
subshell is initiated, `tex-shell-hook' is run."
- (set (make-local-variable 'tex-command) latex-run-command)
- (set (make-local-variable 'tex-start-of-header)
- "\\\\document\\(style\\|class\\)")
- (set (make-local-variable 'tex-end-of-header) "\\\\begin\\s-*{document}")
- (set (make-local-variable 'tex-trailer) "\\end{document}\n")
+ (setq-local tex-command latex-run-command)
+ (setq-local tex-start-of-header "\\\\document\\(style\\|class\\)")
+ (setq-local tex-end-of-header "\\\\begin\\s-*{document}")
+ (setq-local tex-trailer "\\end{document}\n")
;; A line containing just $$ is treated as a paragraph separator.
;; A line starting with $$ starts a paragraph,
;; but does not separate paragraphs if it has more stuff on it.
"marginpar" "parbox" "caption"))
"\\|\\$\\$\\|[a-z]*\\(space\\|skip\\|page[a-z]*\\)"
"\\>\\)[ \t]*\\($\\|%\\)\\)"))
- (set (make-local-variable 'imenu-create-index-function)
- 'latex-imenu-create-index)
- (set (make-local-variable 'tex-face-alist) tex-latex-face-alist)
+ (setq-local imenu-create-index-function 'latex-imenu-create-index)
+ (setq-local tex-face-alist tex-latex-face-alist)
(add-hook 'fill-nobreak-predicate 'latex-fill-nobreak-predicate nil t)
- (set (make-local-variable 'indent-line-function) 'latex-indent)
- (set (make-local-variable 'fill-indent-according-to-mode) t)
+ (setq-local indent-line-function 'latex-indent)
+ (setq-local fill-indent-according-to-mode t)
(add-hook 'completion-at-point-functions
'latex-complete-data nil 'local)
- (set (make-local-variable 'outline-regexp) latex-outline-regexp)
- (set (make-local-variable 'outline-level) 'latex-outline-level)
- (set (make-local-variable 'forward-sexp-function) 'latex-forward-sexp)
- (set (make-local-variable 'skeleton-end-hook) nil))
+ (setq-local outline-regexp latex-outline-regexp)
+ (setq-local outline-level 'latex-outline-level)
+ (setq-local forward-sexp-function 'latex-forward-sexp)
+ (setq-local skeleton-end-hook nil))
;;;###autoload
(define-derived-mode slitex-mode latex-mode "SliTeX"
(defun tex-common-initialization ()
;; Regexp isearch should accept newline and formfeed as whitespace.
- (set (make-local-variable 'search-whitespace-regexp) "[ \t\r\n\f]+")
+ (setq-local search-whitespace-regexp "[ \t\r\n\f]+")
;; A line containing just $$ is treated as a paragraph separator.
- (set (make-local-variable 'paragraph-start)
- "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$")
+ (setq-local paragraph-start "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$")
;; A line starting with $$ starts a paragraph,
;; but does not separate paragraphs if it has more stuff on it.
- (set (make-local-variable 'paragraph-separate)
- "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$[ \t]*$")
- (set (make-local-variable 'comment-start) "%")
- (set (make-local-variable 'comment-add) 1)
- (set (make-local-variable 'comment-start-skip)
- "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(%+ *\\)")
- (set (make-local-variable 'parse-sexp-ignore-comments) t)
- (set (make-local-variable 'compare-windows-whitespace)
- 'tex-categorize-whitespace)
- (set (make-local-variable 'facemenu-add-face-function)
- 'tex-facemenu-add-face-function)
- (set (make-local-variable 'facemenu-end-add-face) "}")
- (set (make-local-variable 'facemenu-remove-face-function) t)
- (set (make-local-variable 'font-lock-defaults)
- '((tex-font-lock-keywords tex-font-lock-keywords-1
- tex-font-lock-keywords-2 tex-font-lock-keywords-3)
- nil nil nil nil
- ;; Who ever uses that anyway ???
- (font-lock-mark-block-function . mark-paragraph)
- (font-lock-syntactic-face-function
- . tex-font-lock-syntactic-face-function)
- (font-lock-unfontify-region-function
- . tex-font-lock-unfontify-region)))
- (set (make-local-variable 'syntax-propertize-function)
- (syntax-propertize-rules latex-syntax-propertize-rules))
+ (setq-local paragraph-separate "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$[ \t]*$")
+ (setq-local comment-start "%")
+ (setq-local comment-add 1)
+ (setq-local comment-start-skip
+ "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(%+ *\\)")
+ (setq-local parse-sexp-ignore-comments t)
+ (setq-local compare-windows-whitespace 'tex-categorize-whitespace)
+ (setq-local facemenu-add-face-function 'tex-facemenu-add-face-function)
+ (setq-local facemenu-end-add-face "}")
+ (setq-local facemenu-remove-face-function t)
+ (setq-local font-lock-defaults
+ '((tex-font-lock-keywords tex-font-lock-keywords-1
+ tex-font-lock-keywords-2 tex-font-lock-keywords-3)
+ nil nil nil nil
+ ;; Who ever uses that anyway ???
+ (font-lock-mark-block-function . mark-paragraph)
+ (font-lock-syntactic-face-function
+ . tex-font-lock-syntactic-face-function)
+ (font-lock-unfontify-region-function
+ . tex-font-lock-unfontify-region)))
+ (setq-local syntax-propertize-function
+ (syntax-propertize-rules latex-syntax-propertize-rules))
;; TABs in verbatim environments don't do what you think.
- (set (make-local-variable 'indent-tabs-mode) nil)
+ (setq-local indent-tabs-mode nil)
;; Other vars that should be buffer-local.
(make-local-variable 'tex-command)
(make-local-variable 'tex-start-of-header)
(looking-at bibtex-reference-key))
(push (match-string-no-properties 0) keys)))))
;; Fill the cache.
- (set (make-local-variable 'latex-complete-bibtex-cache)
- (list files key keys)))
+ (setq-local latex-complete-bibtex-cache (list files key keys)))
(complete-with-action action keys key pred)))))
(defun latex-complete-envnames ()
;; The utility functions:
(define-derived-mode tex-shell shell-mode "TeX-Shell"
- (set (make-local-variable 'compilation-error-regexp-alist)
- tex-error-regexp-alist)
+ (setq-local compilation-error-regexp-alist tex-error-regexp-alist)
(compilation-shell-minor-mode t))
;;;###autoload
(with-no-warnings
(when (boundp 'TeX-master)
(cond ((stringp TeX-master)
- (make-local-variable 'tex-main-file)
- (setq tex-main-file TeX-master))
+ (setq-local tex-main-file TeX-master))
((and (eq TeX-master t) buffer-file-name)
(file-relative-name buffer-file-name)))))
;; Try to guess the main file.
(cons (car x) 'doctex-font-lock-syntactic-face-function))
(_ x)))
(cdr font-lock-defaults))))
- (set (make-local-variable 'syntax-propertize-function)
- (syntax-propertize-rules doctex-syntax-propertize-rules)))
+ (setq-local syntax-propertize-function
+ (syntax-propertize-rules doctex-syntax-propertize-rules)))
(run-hooks 'tex-mode-load-hook)
;;; Code:
(eval-when-compile (require 'tex-mode))
+(declare-function tex-buffer "tex-mode" ())
+(declare-function tex-region "tex-mode" (beg end))
+(declare-function tex-send-command "tex-mode")
+(declare-function tex-recenter-output-buffer "tex-mode" (linenum))
+(declare-function tex-print "tex-mode" (&optional alt))
+(declare-function tex-view "tex-mode" ())
+(declare-function tex-shell-running "tex-mode" ())
+(declare-function tex-kill-job "tex-mode" ())
+
(defvar outline-heading-alist)
(defgroup texinfo nil
Entering Texinfo mode calls the value of `text-mode-hook', and then the
value of `texinfo-mode-hook'."
- (set (make-local-variable 'page-delimiter)
- (concat
- "^@node [ \t]*[Tt]op\\|^@\\("
- texinfo-chapter-level-regexp
- "\\)\\>"))
- (make-local-variable 'require-final-newline)
- (setq require-final-newline mode-require-final-newline)
- (make-local-variable 'indent-tabs-mode)
- (setq indent-tabs-mode nil)
- (make-local-variable 'paragraph-separate)
- (setq paragraph-separate
- (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
- (make-local-variable 'paragraph-start)
- (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))
- (set (make-local-variable 'sentence-end-base)
- "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
- (make-local-variable 'fill-column)
- (setq fill-column 70)
- (make-local-variable 'comment-start)
- (setq comment-start "@c ")
- (make-local-variable 'comment-start-skip)
- (setq comment-start-skip "@c +\\|@comment +")
- (make-local-variable 'words-include-escapes)
- (setq words-include-escapes t)
- (make-local-variable 'imenu-generic-expression)
- (setq imenu-generic-expression texinfo-imenu-generic-expression)
+ (setq-local page-delimiter
+ (concat "^@node [ \t]*[Tt]op\\|^@\\("
+ texinfo-chapter-level-regexp
+ "\\)\\>"))
+ (setq-local require-final-newline mode-require-final-newline)
+ (setq-local indent-tabs-mode nil)
+ (setq-local paragraph-separate
+ (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
+ (setq-local paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))
+ (setq-local sentence-end-base "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
+ (setq-local fill-column 70)
+ (setq-local comment-start "@c ")
+ (setq-local comment-start-skip "@c +\\|@comment +")
+ (setq-local words-include-escapes t)
+ (setq-local imenu-generic-expression texinfo-imenu-generic-expression)
(setq imenu-case-fold-search nil)
- (make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
'(texinfo-font-lock-keywords nil nil nil backward-paragraph))
- (set (make-local-variable 'syntax-propertize-function)
- texinfo-syntax-propertize-function)
- (set (make-local-variable 'parse-sexp-lookup-properties) t)
+ (setq-local syntax-propertize-function texinfo-syntax-propertize-function)
+ (setq-local parse-sexp-lookup-properties t)
;; Outline settings.
- (set (make-local-variable 'outline-heading-alist)
- ;; We should merge outline-heading-alist and texinfo-section-list
- ;; but in the mean time, let's just generate one from the other.
- (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
- texinfo-section-list))
- (set (make-local-variable 'outline-regexp)
- (concat (regexp-opt (mapcar 'car outline-heading-alist) t)
- "\\>"))
-
- (make-local-variable 'tex-start-of-header)
- (setq tex-start-of-header "%\\*\\*start")
- (make-local-variable 'tex-end-of-header)
- (setq tex-end-of-header "%\\*\\*end")
- (make-local-variable 'tex-first-line-header-regexp)
- (setq tex-first-line-header-regexp "^\\\\input")
- (make-local-variable 'tex-trailer)
- (setq tex-trailer "@bye\n")
-
- ;; Prevent filling certain lines, in addition to ones specified
- ;; by the user.
- (let ((prevent-filling "^@\\(def\\|multitable\\)"))
- (set (make-local-variable 'auto-fill-inhibit-regexp)
- (if (null auto-fill-inhibit-regexp)
- prevent-filling
- (concat auto-fill-inhibit-regexp "\\|" prevent-filling)))))
+ (setq-local outline-heading-alist
+ ;; We should merge `outline-heading-alist' and
+ ;; `texinfo-section-list'. But in the mean time, let's
+ ;; just generate one from the other.
+ (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
+ texinfo-section-list))
+ (setq-local outline-regexp
+ (concat (regexp-opt (mapcar 'car outline-heading-alist) t)
+ "\\>"))
+
+ (setq-local tex-start-of-header "%\\*\\*start")
+ (setq-local tex-end-of-header "%\\*\\*end")
+ (setq-local tex-first-line-header-regexp "^\\\\input")
+ (setq-local tex-trailer "@bye\n")
+
+ ;; Prevent filling certain lines, in addition to ones specified by
+ ;; the user.
+ (setq-local auto-fill-inhibit-regexp
+ (let ((prevent-filling "^@\\(def\\|multitable\\)"))
+ (if (null auto-fill-inhibit-regexp)
+ prevent-filling
+ (concat auto-fill-inhibit-regexp "\\|" prevent-filling)))))
\f