Commit a01588fc authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(sgml-mode): Call kill-local-variables

here directly, then set major-mode, then call sgml-mode-common.
Run the hooks here at the end.
(html-mode): Likewise.
(sgml-mode-common): Don't call kill-local-variables; don't run hooks.
parent 12837971
...@@ -281,7 +281,6 @@ an optional alist of possible values." ...@@ -281,7 +281,6 @@ an optional alist of possible values."
SGML-TAG-FACE-ALIST is used for calculating `sgml-font-lock-keywords-2'. SGML-TAG-FACE-ALIST is used for calculating `sgml-font-lock-keywords-2'.
SGML-DISPLAY-TEXT sets up alternate text for when tags are invisible (see SGML-DISPLAY-TEXT sets up alternate text for when tags are invisible (see
varables of same name)." varables of same name)."
(kill-all-local-variables)
(setq local-abbrev-table text-mode-abbrev-table) (setq local-abbrev-table text-mode-abbrev-table)
(set-syntax-table sgml-mode-syntax-table) (set-syntax-table sgml-mode-syntax-table)
(make-local-variable 'indent-line-function) (make-local-variable 'indent-line-function)
...@@ -346,8 +345,7 @@ varables of same name)." ...@@ -346,8 +345,7 @@ varables of same name)."
(while sgml-display-text (while sgml-display-text
(put (car (car sgml-display-text)) 'before-string (put (car (car sgml-display-text)) 'before-string
(cdr (car sgml-display-text))) (cdr (car sgml-display-text)))
(setq sgml-display-text (cdr sgml-display-text))) (setq sgml-display-text (cdr sgml-display-text))))
(run-hooks 'text-mode-hook 'sgml-mode-hook))
(defun sgml-mode-facemenu-add-face-function (face end) (defun sgml-mode-facemenu-add-face-function (face end)
...@@ -379,6 +377,9 @@ Do \\[describe-variable] sgml- SPC to see available variables. ...@@ -379,6 +377,9 @@ Do \\[describe-variable] sgml- SPC to see available variables.
Do \\[describe-key] on the following bindings to discover what they do. Do \\[describe-key] on the following bindings to discover what they do.
\\{sgml-mode-map}" \\{sgml-mode-map}"
(interactive) (interactive)
(kill-all-local-variables)
(setq mode-name "SGML"
major-mode 'sgml-mode)
(sgml-mode-common sgml-tag-face-alist sgml-display-text) (sgml-mode-common sgml-tag-face-alist sgml-display-text)
;; Set imenu-generic-expression here, rather than in sgml-mode-common, ;; Set imenu-generic-expression here, rather than in sgml-mode-common,
;; because this definition probably is not useful in HTML mode. ;; because this definition probably is not useful in HTML mode.
...@@ -386,9 +387,7 @@ Do \\[describe-key] on the following bindings to discover what they do. ...@@ -386,9 +387,7 @@ Do \\[describe-key] on the following bindings to discover what they do.
(setq imenu-generic-expression (setq imenu-generic-expression
"<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\([A-Za-z][-A-Za-z.0-9]*\\)") "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\([A-Za-z][-A-Za-z.0-9]*\\)")
(use-local-map sgml-mode-map) (use-local-map sgml-mode-map)
(setq mode-name "SGML" (run-hooks 'text-mode-hook 'sgml-mode-hook))
major-mode 'sgml-mode))
(defun sgml-comment-indent () (defun sgml-comment-indent ()
...@@ -1180,6 +1179,9 @@ To work around that, do: ...@@ -1180,6 +1179,9 @@ To work around that, do:
\\{html-mode-map}" \\{html-mode-map}"
(interactive) (interactive)
(kill-all-local-variables)
(setq mode-name "HTML"
major-mode 'html-mode)
(sgml-mode-common html-tag-face-alist html-display-text) (sgml-mode-common html-tag-face-alist html-display-text)
(use-local-map html-mode-map) (use-local-map html-mode-map)
(make-local-variable 'sgml-tag-alist) (make-local-variable 'sgml-tag-alist)
...@@ -1191,9 +1193,7 @@ To work around that, do: ...@@ -1191,9 +1193,7 @@ To work around that, do:
(make-local-variable 'sentence-end) (make-local-variable 'sentence-end)
(setq sentence-end (setq sentence-end
"[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*") "[.?!][]\"')}]*\\(<[^>]*>\\)*\\($\\| $\\|\t\\| \\)[ \t\n]*")
(setq mode-name "HTML" (setq sgml-tag-alist html-tag-alist
major-mode 'html-mode
sgml-tag-alist html-tag-alist
sgml-face-tag-alist html-face-tag-alist sgml-face-tag-alist html-face-tag-alist
sgml-tag-help html-tag-help sgml-tag-help html-tag-help
outline-regexp "^.*<[Hh][1-6]\\>" outline-regexp "^.*<[Hh][1-6]\\>"
...@@ -1203,7 +1203,7 @@ To work around that, do: ...@@ -1203,7 +1203,7 @@ To work around that, do:
(setq imenu-create-index-function 'html-imenu-index) (setq imenu-create-index-function 'html-imenu-index)
(make-local-variable 'imenu-sort-function) (make-local-variable 'imenu-sort-function)
(setq imenu-sort-function nil) ; sorting the menu defeats the purpose (setq imenu-sort-function nil) ; sorting the menu defeats the purpose
(run-hooks 'html-mode-hook)) (run-hooks 'text-mode-hook 'sgml-mode-hook 'html-mode-hook))
(defvar html-imenu-regexp (defvar html-imenu-regexp
"\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)" "\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment