aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorChong Yidong2012-12-01 12:09:55 +0800
committerChong Yidong2012-12-01 12:09:55 +0800
commit92eadba57fe86a49d67a7e3d797e3180ca0f6ae7 (patch)
tree0b6588412e5b894cd2ee09e08fda5e52201d5ba9 /lisp/textmodes
parent75b4f59c279cbab4ad6a056b39f876b9a7518267 (diff)
downloademacs-92eadba57fe86a49d67a7e3d797e3180ca0f6ae7.tar.gz
emacs-92eadba57fe86a49d67a7e3d797e3180ca0f6ae7.zip
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.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/css-mode.el21
-rw-r--r--lisp/textmodes/sgml-mode.el116
-rw-r--r--lisp/textmodes/tex-mode.el101
-rw-r--r--lisp/textmodes/texinfo.el103
4 files changed, 155 insertions, 186 deletions
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 @@
266;;;###autoload 266;;;###autoload
267(define-derived-mode css-mode fundamental-mode "CSS" 267(define-derived-mode css-mode fundamental-mode "CSS"
268 "Major mode to edit Cascading Style Sheets." 268 "Major mode to edit Cascading Style Sheets."
269 (set (make-local-variable 'font-lock-defaults) css-font-lock-defaults) 269 (setq-local font-lock-defaults css-font-lock-defaults)
270 (set (make-local-variable 'comment-start) "/*") 270 (setq-local comment-start "/*")
271 (set (make-local-variable 'comment-start-skip) "/\\*+[ \t]*") 271 (setq-local comment-start-skip "/\\*+[ \t]*")
272 (set (make-local-variable 'comment-end) "*/") 272 (setq-local comment-end "*/")
273 (set (make-local-variable 'comment-end-skip) "[ \t]*\\*+/") 273 (setq-local comment-end-skip "[ \t]*\\*+/")
274 (set (make-local-variable 'forward-sexp-function) 'css-forward-sexp) 274 (setq-local forward-sexp-function 'css-forward-sexp)
275 (set (make-local-variable 'parse-sexp-ignore-comments) t) 275 (setq-local parse-sexp-ignore-comments t)
276 (set (make-local-variable 'indent-line-function) 'css-indent-line) 276 (setq-local indent-line-function 'css-indent-line)
277 (set (make-local-variable 'fill-paragraph-function) 277 (setq-local fill-paragraph-function 'css-fill-paragraph)
278 'css-fill-paragraph)
279 (when css-electric-keys 278 (when css-electric-keys
280 (let ((fc (make-char-table 'auto-fill-chars))) 279 (let ((fc (make-char-table 'auto-fill-chars)))
281 (set-char-table-parent fc auto-fill-chars) 280 (set-char-table-parent fc auto-fill-chars)
282 (dolist (c css-electric-keys) 281 (dolist (c css-electric-keys)
283 (aset fc c 'indent-according-to-mode)) 282 (aset fc c 'indent-according-to-mode))
284 (set (make-local-variable 'auto-fill-chars) fc)))) 283 (setq-local auto-fill-chars fc))))
285 284
286(defvar comment-continue) 285(defvar comment-continue)
287 286
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.
463 ;; A start or end tag by itself on a line separates a paragraph. 463 ;; A start or end tag by itself on a line separates a paragraph.
464 ;; This is desirable because SGML discards a newline that appears 464 ;; This is desirable because SGML discards a newline that appears
465 ;; immediately after a start tag or immediately before an end tag. 465 ;; immediately after a start tag or immediately before an end tag.
466 (set (make-local-variable 'paragraph-start) (concat "[ \t]*$\\|\ 466 (setq-local paragraph-start (concat "[ \t]*$\\|\
467\[ \t]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>")) 467\[ \t]*</?\\(" sgml-name-re sgml-attrs-re "\\)?>"))
468 (set (make-local-variable 'paragraph-separate) 468 (setq-local paragraph-separate (concat paragraph-start "$"))
469 (concat paragraph-start "$")) 469 (setq-local adaptive-fill-regexp "[ \t]*")
470 (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*")
471 (add-hook 'fill-nobreak-predicate 'sgml-fill-nobreak nil t) 470 (add-hook 'fill-nobreak-predicate 'sgml-fill-nobreak nil t)
472 (set (make-local-variable 'indent-line-function) 'sgml-indent-line) 471 (setq-local indent-line-function 'sgml-indent-line)
473 (set (make-local-variable 'comment-start) "<!-- ") 472 (setq-local comment-start "<!-- ")
474 (set (make-local-variable 'comment-end) " -->") 473 (setq-local comment-end " -->")
475 (set (make-local-variable 'comment-indent-function) 'sgml-comment-indent) 474 (setq-local comment-indent-function 'sgml-comment-indent)
476 (set (make-local-variable 'comment-line-break-function) 475 (setq-local comment-line-break-function 'sgml-comment-indent-new-line)
477 'sgml-comment-indent-new-line) 476 (setq-local skeleton-further-elements '((completion-ignore-case t)))
478 (set (make-local-variable 'skeleton-further-elements) 477 (setq-local skeleton-end-hook
479 '((completion-ignore-case t))) 478 (lambda ()
480 (set (make-local-variable 'skeleton-end-hook) 479 (or (eolp)
481 (lambda () 480 (not (or (eq v2 '\n) (eq (car-safe v2) '\n)))
482 (or (eolp) 481 (newline-and-indent))))
483 (not (or (eq v2 '\n) (eq (car-safe v2) '\n))) 482 (setq font-lock-defaults '((sgml-font-lock-keywords
484 (newline-and-indent)))) 483 sgml-font-lock-keywords-1
485 (set (make-local-variable 'font-lock-defaults) 484 sgml-font-lock-keywords-2)
486 '((sgml-font-lock-keywords 485 nil t))
487 sgml-font-lock-keywords-1 486 (setq-local syntax-propertize-function sgml-syntax-propertize-function)
488 sgml-font-lock-keywords-2) 487 (setq-local facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
489 nil t)) 488 (setq-local sgml-xml-mode (sgml-xml-guess))
490 (set (make-local-variable 'syntax-propertize-function) 489 (unless sgml-xml-mode
491 sgml-syntax-propertize-function) 490 (setq-local skeleton-transformation-function sgml-transformation-function))
492 (set (make-local-variable 'facemenu-add-face-function)
493 'sgml-mode-facemenu-add-face-function)
494 (set (make-local-variable 'sgml-xml-mode) (sgml-xml-guess))
495 (if sgml-xml-mode
496 ()
497 (set (make-local-variable 'skeleton-transformation-function)
498 sgml-transformation-function))
499 ;; This will allow existing comments within declarations to be 491 ;; This will allow existing comments within declarations to be
500 ;; recognized. 492 ;; recognized.
501 ;; I can't find a clear description of SGML/XML comments, but it seems that 493 ;; I can't find a clear description of SGML/XML comments, but it seems that
502 ;; the only reliable ones are <!-- ... --> although it's not clear what 494 ;; the only reliable ones are <!-- ... --> although it's not clear what
503 ;; "..." can contain. It used to accept -- ... -- as well, but that was 495 ;; "..." can contain. It used to accept -- ... -- as well, but that was
504 ;; apparently a mistake. 496 ;; apparently a mistake.
505 (set (make-local-variable 'comment-start-skip) "<!--[ \t]*") 497 (setq-local comment-start-skip "<!--[ \t]*")
506 (set (make-local-variable 'comment-end-skip) "[ \t]*--[ \t\n]*>") 498 (setq-local comment-end-skip "[ \t]*--[ \t\n]*>")
507 ;; This definition has an HTML leaning but probably fits well for other modes. 499 ;; This definition has an HTML leaning but probably fits well for other modes.
508 (setq imenu-generic-expression 500 (setq imenu-generic-expression
509 `((nil 501 `((nil
@@ -982,10 +974,10 @@ With prefix argument ARG, repeat this ARG times."
982 (unwind-protect 974 (unwind-protect
983 (save-excursion 975 (save-excursion
984 (goto-char (point-min)) 976 (goto-char (point-min))
985 (if (set (make-local-variable 'sgml-tags-invisible) 977 (if (setq-local sgml-tags-invisible
986 (if arg 978 (if arg
987 (>= (prefix-numeric-value arg) 0) 979 (>= (prefix-numeric-value arg) 0)
988 (not sgml-tags-invisible))) 980 (not sgml-tags-invisible)))
989 (while (re-search-forward sgml-tag-name-re nil t) 981 (while (re-search-forward sgml-tag-name-re nil t)
990 (setq string 982 (setq string
991 (cdr (assq (intern-soft (downcase (match-string 1))) 983 (cdr (assq (intern-soft (downcase (match-string 1)))
@@ -1564,8 +1556,7 @@ Add this to `sgml-mode-hook' for convenience."
1564 (goto-char (point-min)) 1556 (goto-char (point-min))
1565 (if (re-search-forward "^\\([ \t]+\\)<" 500 'noerror) 1557 (if (re-search-forward "^\\([ \t]+\\)<" 500 'noerror)
1566 (progn 1558 (progn
1567 (set (make-local-variable 'sgml-basic-offset) 1559 (setq-local sgml-basic-offset (1- (current-column)))
1568 (1- (current-column)))
1569 (message "Guessed sgml-basic-offset = %d" 1560 (message "Guessed sgml-basic-offset = %d"
1570 sgml-basic-offset) 1561 sgml-basic-offset)
1571 )))) 1562 ))))
@@ -1979,33 +1970,28 @@ To work around that, do:
1979 (eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil)) 1970 (eval-after-load \"sgml-mode\" '(aset sgml-char-names ?' nil))
1980 1971
1981\\{html-mode-map}" 1972\\{html-mode-map}"
1982 (set (make-local-variable 'sgml-display-text) html-display-text) 1973 (setq-local sgml-display-text html-display-text)
1983 (set (make-local-variable 'sgml-tag-face-alist) html-tag-face-alist) 1974 (setq-local sgml-tag-face-alist html-tag-face-alist)
1984 (make-local-variable 'sgml-tag-alist) 1975 (setq-local sgml-tag-alist html-tag-alist)
1985 (make-local-variable 'sgml-face-tag-alist) 1976 (setq-local sgml-face-tag-alist html-face-tag-alist)
1986 (make-local-variable 'sgml-tag-help) 1977 (setq-local sgml-tag-help html-tag-help)
1987 (make-local-variable 'outline-regexp) 1978 (setq-local outline-regexp "^.*<[Hh][1-6]\\>")
1988 (make-local-variable 'outline-heading-end-regexp) 1979 (setq-local outline-heading-end-regexp "</[Hh][1-6]>")
1989 (make-local-variable 'outline-level) 1980 (setq-local outline-level
1990 (make-local-variable 'sentence-end-base) 1981 (lambda () (char-before (match-end 0))))
1991 (setq sentence-end-base "[.?!][]\"'”)}]*\\(<[^>]*>\\)*" 1982 (setq-local sentence-end-base "[.?!][]\"'”)}]*\\(<[^>]*>\\)*")
1992 sgml-tag-alist html-tag-alist 1983
1993 sgml-face-tag-alist html-face-tag-alist
1994 sgml-tag-help html-tag-help
1995 outline-regexp "^.*<[Hh][1-6]\\>"
1996 outline-heading-end-regexp "</[Hh][1-6]>"
1997 outline-level (lambda ()
1998 (char-before (match-end 0))))
1999 (setq imenu-create-index-function 'html-imenu-index) 1984 (setq imenu-create-index-function 'html-imenu-index)
2000 (set (make-local-variable 'sgml-empty-tags) 1985
2001 ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd', 1986 (setq-local sgml-empty-tags
2002 ;; plus manual addition of "wbr". 1987 ;; From HTML-4.01's loose.dtd, parsed with
2003 '("area" "base" "basefont" "br" "col" "frame" "hr" "img" "input" 1988 ;; `sgml-parse-dtd', plus manual addition of "wbr".
2004 "isindex" "link" "meta" "param" "wbr")) 1989 '("area" "base" "basefont" "br" "col" "frame" "hr" "img" "input"
2005 (set (make-local-variable 'sgml-unclosed-tags) 1990 "isindex" "link" "meta" "param" "wbr"))
2006 ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd'. 1991 (setq-local sgml-unclosed-tags
2007 '("body" "colgroup" "dd" "dt" "head" "html" "li" "option" 1992 ;; From HTML-4.01's loose.dtd, parsed with `sgml-parse-dtd'.
2008 "p" "tbody" "td" "tfoot" "th" "thead" "tr")) 1993 '("body" "colgroup" "dd" "dt" "head" "html" "li" "option"
1994 "p" "tbody" "td" "tfoot" "th" "thead" "tr"))
2009 ;; It's for the user to decide if it defeats it or not -stef 1995 ;; It's for the user to decide if it defeats it or not -stef
2010 ;; (make-local-variable 'imenu-sort-function) 1996 ;; (make-local-variable 'imenu-sort-function)
2011 ;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose 1997 ;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 062f43be57b..c4fe0d629b4 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1062,10 +1062,10 @@ tex-show-queue-command
1062Entering Plain-tex mode runs the hook `text-mode-hook', then the hook 1062Entering Plain-tex mode runs the hook `text-mode-hook', then the hook
1063`tex-mode-hook', and finally the hook `plain-tex-mode-hook'. When the 1063`tex-mode-hook', and finally the hook `plain-tex-mode-hook'. When the
1064special subshell is initiated, the hook `tex-shell-hook' is run." 1064special subshell is initiated, the hook `tex-shell-hook' is run."
1065 (set (make-local-variable 'tex-command) tex-run-command) 1065 (setq-local tex-command tex-run-command)
1066 (set (make-local-variable 'tex-start-of-header) "%\\*\\*start of header") 1066 (setq-local tex-start-of-header "%\\*\\*start of header")
1067 (set (make-local-variable 'tex-end-of-header) "%\\*\\*end of header") 1067 (setq-local tex-end-of-header "%\\*\\*end of header")
1068 (set (make-local-variable 'tex-trailer) "\\bye\n")) 1068 (setq-local tex-trailer "\\bye\n"))
1069 1069
1070;;;###autoload 1070;;;###autoload
1071(define-derived-mode latex-mode tex-mode "LaTeX" 1071(define-derived-mode latex-mode tex-mode "LaTeX"
@@ -1108,11 +1108,10 @@ tex-show-queue-command
1108Entering Latex mode runs the hook `text-mode-hook', then 1108Entering Latex mode runs the hook `text-mode-hook', then
1109`tex-mode-hook', and finally `latex-mode-hook'. When the special 1109`tex-mode-hook', and finally `latex-mode-hook'. When the special
1110subshell is initiated, `tex-shell-hook' is run." 1110subshell is initiated, `tex-shell-hook' is run."
1111 (set (make-local-variable 'tex-command) latex-run-command) 1111 (setq-local tex-command latex-run-command)
1112 (set (make-local-variable 'tex-start-of-header) 1112 (setq-local tex-start-of-header "\\\\document\\(style\\|class\\)")
1113 "\\\\document\\(style\\|class\\)") 1113 (setq-local tex-end-of-header "\\\\begin\\s-*{document}")
1114 (set (make-local-variable 'tex-end-of-header) "\\\\begin\\s-*{document}") 1114 (setq-local tex-trailer "\\end{document}\n")
1115 (set (make-local-variable 'tex-trailer) "\\end{document}\n")
1116 ;; A line containing just $$ is treated as a paragraph separator. 1115 ;; A line containing just $$ is treated as a paragraph separator.
1117 ;; A line starting with $$ starts a paragraph, 1116 ;; A line starting with $$ starts a paragraph,
1118 ;; but does not separate paragraphs if it has more stuff on it. 1117 ;; but does not separate paragraphs if it has more stuff on it.
@@ -1138,18 +1137,17 @@ subshell is initiated, `tex-shell-hook' is run."
1138 "marginpar" "parbox" "caption")) 1137 "marginpar" "parbox" "caption"))
1139 "\\|\\$\\$\\|[a-z]*\\(space\\|skip\\|page[a-z]*\\)" 1138 "\\|\\$\\$\\|[a-z]*\\(space\\|skip\\|page[a-z]*\\)"
1140 "\\>\\)[ \t]*\\($\\|%\\)\\)")) 1139 "\\>\\)[ \t]*\\($\\|%\\)\\)"))
1141 (set (make-local-variable 'imenu-create-index-function) 1140 (setq-local imenu-create-index-function 'latex-imenu-create-index)
1142 'latex-imenu-create-index) 1141 (setq-local tex-face-alist tex-latex-face-alist)
1143 (set (make-local-variable 'tex-face-alist) tex-latex-face-alist)
1144 (add-hook 'fill-nobreak-predicate 'latex-fill-nobreak-predicate nil t) 1142 (add-hook 'fill-nobreak-predicate 'latex-fill-nobreak-predicate nil t)
1145 (set (make-local-variable 'indent-line-function) 'latex-indent) 1143 (setq-local indent-line-function 'latex-indent)
1146 (set (make-local-variable 'fill-indent-according-to-mode) t) 1144 (setq-local fill-indent-according-to-mode t)
1147 (add-hook 'completion-at-point-functions 1145 (add-hook 'completion-at-point-functions
1148 'latex-complete-data nil 'local) 1146 'latex-complete-data nil 'local)
1149 (set (make-local-variable 'outline-regexp) latex-outline-regexp) 1147 (setq-local outline-regexp latex-outline-regexp)
1150 (set (make-local-variable 'outline-level) 'latex-outline-level) 1148 (setq-local outline-level 'latex-outline-level)
1151 (set (make-local-variable 'forward-sexp-function) 'latex-forward-sexp) 1149 (setq-local forward-sexp-function 'latex-forward-sexp)
1152 (set (make-local-variable 'skeleton-end-hook) nil)) 1150 (setq-local skeleton-end-hook nil))
1153 1151
1154;;;###autoload 1152;;;###autoload
1155(define-derived-mode slitex-mode latex-mode "SliTeX" 1153(define-derived-mode slitex-mode latex-mode "SliTeX"
@@ -1198,39 +1196,35 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook
1198 1196
1199(defun tex-common-initialization () 1197(defun tex-common-initialization ()
1200 ;; Regexp isearch should accept newline and formfeed as whitespace. 1198 ;; Regexp isearch should accept newline and formfeed as whitespace.
1201 (set (make-local-variable 'search-whitespace-regexp) "[ \t\r\n\f]+") 1199 (setq-local search-whitespace-regexp "[ \t\r\n\f]+")
1202 ;; A line containing just $$ is treated as a paragraph separator. 1200 ;; A line containing just $$ is treated as a paragraph separator.
1203 (set (make-local-variable 'paragraph-start) 1201 (setq-local paragraph-start "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$")
1204 "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$")
1205 ;; A line starting with $$ starts a paragraph, 1202 ;; A line starting with $$ starts a paragraph,
1206 ;; but does not separate paragraphs if it has more stuff on it. 1203 ;; but does not separate paragraphs if it has more stuff on it.
1207 (set (make-local-variable 'paragraph-separate) 1204 (setq-local paragraph-separate "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$[ \t]*$")
1208 "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$[ \t]*$") 1205 (setq-local comment-start "%")
1209 (set (make-local-variable 'comment-start) "%") 1206 (setq-local comment-add 1)
1210 (set (make-local-variable 'comment-add) 1) 1207 (setq-local comment-start-skip
1211 (set (make-local-variable 'comment-start-skip) 1208 "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(%+ *\\)")
1212 "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(%+ *\\)") 1209 (setq-local parse-sexp-ignore-comments t)
1213 (set (make-local-variable 'parse-sexp-ignore-comments) t) 1210 (setq-local compare-windows-whitespace 'tex-categorize-whitespace)
1214 (set (make-local-variable 'compare-windows-whitespace) 1211 (setq-local facemenu-add-face-function 'tex-facemenu-add-face-function)
1215 'tex-categorize-whitespace) 1212 (setq-local facemenu-end-add-face "}")
1216 (set (make-local-variable 'facemenu-add-face-function) 1213 (setq-local facemenu-remove-face-function t)
1217 'tex-facemenu-add-face-function) 1214 (setq-local font-lock-defaults
1218 (set (make-local-variable 'facemenu-end-add-face) "}") 1215 '((tex-font-lock-keywords tex-font-lock-keywords-1
1219 (set (make-local-variable 'facemenu-remove-face-function) t) 1216 tex-font-lock-keywords-2 tex-font-lock-keywords-3)
1220 (set (make-local-variable 'font-lock-defaults) 1217 nil nil nil nil
1221 '((tex-font-lock-keywords tex-font-lock-keywords-1 1218 ;; Who ever uses that anyway ???
1222 tex-font-lock-keywords-2 tex-font-lock-keywords-3) 1219 (font-lock-mark-block-function . mark-paragraph)
1223 nil nil nil nil 1220 (font-lock-syntactic-face-function
1224 ;; Who ever uses that anyway ??? 1221 . tex-font-lock-syntactic-face-function)
1225 (font-lock-mark-block-function . mark-paragraph) 1222 (font-lock-unfontify-region-function
1226 (font-lock-syntactic-face-function 1223 . tex-font-lock-unfontify-region)))
1227 . tex-font-lock-syntactic-face-function) 1224 (setq-local syntax-propertize-function
1228 (font-lock-unfontify-region-function 1225 (syntax-propertize-rules latex-syntax-propertize-rules))
1229 . tex-font-lock-unfontify-region)))
1230 (set (make-local-variable 'syntax-propertize-function)
1231 (syntax-propertize-rules latex-syntax-propertize-rules))
1232 ;; TABs in verbatim environments don't do what you think. 1226 ;; TABs in verbatim environments don't do what you think.
1233 (set (make-local-variable 'indent-tabs-mode) nil) 1227 (setq-local indent-tabs-mode nil)
1234 ;; Other vars that should be buffer-local. 1228 ;; Other vars that should be buffer-local.
1235 (make-local-variable 'tex-command) 1229 (make-local-variable 'tex-command)
1236 (make-local-variable 'tex-start-of-header) 1230 (make-local-variable 'tex-start-of-header)
@@ -1523,8 +1517,7 @@ Puts point on a blank line between them."
1523 (looking-at bibtex-reference-key)) 1517 (looking-at bibtex-reference-key))
1524 (push (match-string-no-properties 0) keys))))) 1518 (push (match-string-no-properties 0) keys)))))
1525 ;; Fill the cache. 1519 ;; Fill the cache.
1526 (set (make-local-variable 'latex-complete-bibtex-cache) 1520 (setq-local latex-complete-bibtex-cache (list files key keys)))
1527 (list files key keys)))
1528 (complete-with-action action keys key pred))))) 1521 (complete-with-action action keys key pred)))))
1529 1522
1530(defun latex-complete-envnames () 1523(defun latex-complete-envnames ()
@@ -1885,8 +1878,7 @@ Mark is left at original location."
1885;; The utility functions: 1878;; The utility functions:
1886 1879
1887(define-derived-mode tex-shell shell-mode "TeX-Shell" 1880(define-derived-mode tex-shell shell-mode "TeX-Shell"
1888 (set (make-local-variable 'compilation-error-regexp-alist) 1881 (setq-local compilation-error-regexp-alist tex-error-regexp-alist)
1889 tex-error-regexp-alist)
1890 (compilation-shell-minor-mode t)) 1882 (compilation-shell-minor-mode t))
1891 1883
1892;;;###autoload 1884;;;###autoload
@@ -2099,8 +2091,7 @@ of the current buffer."
2099 (with-no-warnings 2091 (with-no-warnings
2100 (when (boundp 'TeX-master) 2092 (when (boundp 'TeX-master)
2101 (cond ((stringp TeX-master) 2093 (cond ((stringp TeX-master)
2102 (make-local-variable 'tex-main-file) 2094 (setq-local tex-main-file TeX-master))
2103 (setq tex-main-file TeX-master))
2104 ((and (eq TeX-master t) buffer-file-name) 2095 ((and (eq TeX-master t) buffer-file-name)
2105 (file-relative-name buffer-file-name))))) 2096 (file-relative-name buffer-file-name)))))
2106 ;; Try to guess the main file. 2097 ;; Try to guess the main file.
@@ -2870,8 +2861,8 @@ There might be text before point."
2870 (cons (car x) 'doctex-font-lock-syntactic-face-function)) 2861 (cons (car x) 'doctex-font-lock-syntactic-face-function))
2871 (_ x))) 2862 (_ x)))
2872 (cdr font-lock-defaults)))) 2863 (cdr font-lock-defaults))))
2873 (set (make-local-variable 'syntax-propertize-function) 2864 (setq-local syntax-propertize-function
2874 (syntax-propertize-rules doctex-syntax-propertize-rules))) 2865 (syntax-propertize-rules doctex-syntax-propertize-rules)))
2875 2866
2876(run-hooks 'tex-mode-load-hook) 2867(run-hooks 'tex-mode-load-hook)
2877 2868
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 4e7715dcea9..91405ba0744 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -33,6 +33,15 @@
33;;; Code: 33;;; Code:
34 34
35(eval-when-compile (require 'tex-mode)) 35(eval-when-compile (require 'tex-mode))
36(declare-function tex-buffer "tex-mode" ())
37(declare-function tex-region "tex-mode" (beg end))
38(declare-function tex-send-command "tex-mode")
39(declare-function tex-recenter-output-buffer "tex-mode" (linenum))
40(declare-function tex-print "tex-mode" (&optional alt))
41(declare-function tex-view "tex-mode" ())
42(declare-function tex-shell-running "tex-mode" ())
43(declare-function tex-kill-job "tex-mode" ())
44
36(defvar outline-heading-alist) 45(defvar outline-heading-alist)
37 46
38(defgroup texinfo nil 47(defgroup texinfo nil
@@ -571,66 +580,50 @@ be the first node in the file.
571 580
572Entering Texinfo mode calls the value of `text-mode-hook', and then the 581Entering Texinfo mode calls the value of `text-mode-hook', and then the
573value of `texinfo-mode-hook'." 582value of `texinfo-mode-hook'."
574 (set (make-local-variable 'page-delimiter) 583 (setq-local page-delimiter
575 (concat 584 (concat "^@node [ \t]*[Tt]op\\|^@\\("
576 "^@node [ \t]*[Tt]op\\|^@\\(" 585 texinfo-chapter-level-regexp
577 texinfo-chapter-level-regexp 586 "\\)\\>"))
578 "\\)\\>")) 587 (setq-local require-final-newline mode-require-final-newline)
579 (make-local-variable 'require-final-newline) 588 (setq-local indent-tabs-mode nil)
580 (setq require-final-newline mode-require-final-newline) 589 (setq-local paragraph-separate
581 (make-local-variable 'indent-tabs-mode) 590 (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate))
582 (setq indent-tabs-mode nil) 591 (setq-local paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start))
583 (make-local-variable 'paragraph-separate) 592 (setq-local sentence-end-base "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
584 (setq paragraph-separate 593 (setq-local fill-column 70)
585 (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-separate)) 594 (setq-local comment-start "@c ")
586 (make-local-variable 'paragraph-start) 595 (setq-local comment-start-skip "@c +\\|@comment +")
587 (setq paragraph-start (concat "\b\\|@[a-zA-Z]*[ \n]\\|" paragraph-start)) 596 (setq-local words-include-escapes t)
588 (set (make-local-variable 'sentence-end-base) 597 (setq-local imenu-generic-expression texinfo-imenu-generic-expression)
589 "\\(@\\(end\\)?dots{}\\|[.?!]\\)[]\"'”)}]*")
590 (make-local-variable 'fill-column)
591 (setq fill-column 70)
592 (make-local-variable 'comment-start)
593 (setq comment-start "@c ")
594 (make-local-variable 'comment-start-skip)
595 (setq comment-start-skip "@c +\\|@comment +")
596 (make-local-variable 'words-include-escapes)
597 (setq words-include-escapes t)
598 (make-local-variable 'imenu-generic-expression)
599 (setq imenu-generic-expression texinfo-imenu-generic-expression)
600 (setq imenu-case-fold-search nil) 598 (setq imenu-case-fold-search nil)
601 (make-local-variable 'font-lock-defaults)
602 (setq font-lock-defaults 599 (setq font-lock-defaults
603 '(texinfo-font-lock-keywords nil nil nil backward-paragraph)) 600 '(texinfo-font-lock-keywords nil nil nil backward-paragraph))
604 (set (make-local-variable 'syntax-propertize-function) 601 (setq-local syntax-propertize-function texinfo-syntax-propertize-function)
605 texinfo-syntax-propertize-function) 602 (setq-local parse-sexp-lookup-properties t)
606 (set (make-local-variable 'parse-sexp-lookup-properties) t)
607 603
608 ;; Outline settings. 604 ;; Outline settings.
609 (set (make-local-variable 'outline-heading-alist) 605 (setq-local outline-heading-alist
610 ;; We should merge outline-heading-alist and texinfo-section-list 606 ;; We should merge `outline-heading-alist' and
611 ;; but in the mean time, let's just generate one from the other. 607 ;; `texinfo-section-list'. But in the mean time, let's
612 (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x))) 608 ;; just generate one from the other.
613 texinfo-section-list)) 609 (mapcar (lambda (x) (cons (concat "@" (car x)) (cadr x)))
614 (set (make-local-variable 'outline-regexp) 610 texinfo-section-list))
615 (concat (regexp-opt (mapcar 'car outline-heading-alist) t) 611 (setq-local outline-regexp
616 "\\>")) 612 (concat (regexp-opt (mapcar 'car outline-heading-alist) t)
617 613 "\\>"))
618 (make-local-variable 'tex-start-of-header) 614
619 (setq tex-start-of-header "%\\*\\*start") 615 (setq-local tex-start-of-header "%\\*\\*start")
620 (make-local-variable 'tex-end-of-header) 616 (setq-local tex-end-of-header "%\\*\\*end")
621 (setq tex-end-of-header "%\\*\\*end") 617 (setq-local tex-first-line-header-regexp "^\\\\input")
622 (make-local-variable 'tex-first-line-header-regexp) 618 (setq-local tex-trailer "@bye\n")
623 (setq tex-first-line-header-regexp "^\\\\input") 619
624 (make-local-variable 'tex-trailer) 620 ;; Prevent filling certain lines, in addition to ones specified by
625 (setq tex-trailer "@bye\n") 621 ;; the user.
626 622 (setq-local auto-fill-inhibit-regexp
627 ;; Prevent filling certain lines, in addition to ones specified 623 (let ((prevent-filling "^@\\(def\\|multitable\\)"))
628 ;; by the user. 624 (if (null auto-fill-inhibit-regexp)
629 (let ((prevent-filling "^@\\(def\\|multitable\\)")) 625 prevent-filling
630 (set (make-local-variable 'auto-fill-inhibit-regexp) 626 (concat auto-fill-inhibit-regexp "\\|" prevent-filling)))))
631 (if (null auto-fill-inhibit-regexp)
632 prevent-filling
633 (concat auto-fill-inhibit-regexp "\\|" prevent-filling)))))
634 627
635 628
636 629