aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Steingold2001-10-26 20:29:10 +0000
committerSam Steingold2001-10-26 20:29:10 +0000
commit58203d918e68faba80433f12c86a36642dad9a42 (patch)
tree7e353469873d84b509731ebff6d0000b756031e4
parente039053df275ad1f55c20de0a13d5135a8a7cb5e (diff)
downloademacs-58203d918e68faba80433f12c86a36642dad9a42.tar.gz
emacs-58203d918e68faba80433f12c86a36642dad9a42.zip
(html-mode): Set `html-xhtml' from the DOCTYPE.
(html-tag-alist): Use `html-xhtml' for "li", "dt" and "dd". (sgml-tag): Close empty tags in XHTML.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/textmodes/sgml-mode.el28
2 files changed, 28 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 64387f5f766..cb0ffae62a7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12001-10-26 Sam Steingold <sds@gnu.org>
2
3 * textmodes/sgml-mode.el (html-mode): Set `html-xhtml' from the
4 DOCTYPE.
5 (html-tag-alist): Use `html-xhtml' for "li", "dt" and "dd".
6 (sgml-tag): Close empty tags in XHTML.
7
12001-10-26 Jason Rumney <jasonr@gnu.org> 82001-10-26 Jason Rumney <jasonr@gnu.org>
2 9
3 * w32-fns.el: (w32-charset-info-alist): Use ANSI for iso10646-1 10 * w32-fns.el: (w32-charset-info-alist): Use ANSI for iso10646-1
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 5b7baa5ffaa..8822bdb132f 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -516,14 +516,15 @@ skeleton-transformation RET upcase RET, or put this in your `.emacs':
516 (completing-read "Tag: " sgml-tag-alist)) 516 (completing-read "Tag: " sgml-tag-alist))
517 ?< str | 517 ?< str |
518 (("") -1 '(undo-boundary) (identity "&lt;")) | ; see comment above 518 (("") -1 '(undo-boundary) (identity "&lt;")) | ; see comment above
519 `(("") '(setq v2 (sgml-attributes ,str t)) ?> 519 `(("") '(setq v2 (sgml-attributes ,str t))
520 (if (and (eq major-mode html-mode) html-xhtml (eq v2 t)) "/>" ">")
520 (if (string= "![" ,str) 521 (if (string= "![" ,str)
521 (prog1 '(("") " [ " _ " ]]") 522 (prog1 '(("") " [ " _ " ]]")
522 (backward-char)) 523 (backward-char))
523 (unless (or (sgml-skip-close-p v2) ; (eq v2 t) 524 (unless (or (eq v2 t)
524 (string-match "^[/!?]" ,str)) 525 (string-match "^[/!?]" ,str))
525 (if (symbolp v2) 526 (if (symbolp v2)
526 ;; We go use `identity' to prevent skeleton from passing 527 ;; We use `identity' to prevent skeleton from passing
527 ;; `str' through skeleton-transformation a second time. 528 ;; `str' through skeleton-transformation a second time.
528 '(("") v2 _ v2 "</" (identity ',str) ?>) 529 '(("") v2 _ v2 "</" (identity ',str) ?>)
529 (if (eq (car v2) t) 530 (if (eq (car v2) t)
@@ -970,7 +971,10 @@ This takes effect when first loading the library.")
970 971
971 972
972(defcustom html-xhtml nil 973(defcustom html-xhtml nil
973 "*When non-nil, tag insertion functions will be XHTML-compliant." 974 "*When non-nil, tag insertion functions will be XHTML-compliant.
975If this variable is customized, the custom value is used always.
976Otherwise, it is set to be buffer-local when the file has
977 a DOCTYPE declaration."
974 :type 'boolean 978 :type 'boolean
975 :version "21.2" 979 :version "21.2"
976 :group 'sgml) 980 :group 'sgml)
@@ -1059,7 +1063,7 @@ This takes effect when first loading the library.")
1059 ("center" \n) 1063 ("center" \n)
1060 ("cite") 1064 ("cite")
1061 ("code" \n) 1065 ("code" \n)
1062 ("dd" t) 1066 ("dd" ,(not html-xhtml))
1063 ("del") 1067 ("del")
1064 ("dfn") 1068 ("dfn")
1065 ("div") 1069 ("div")
@@ -1067,7 +1071,8 @@ This takes effect when first loading the library.")
1067 ( "Term: " 1071 ( "Term: "
1068 "<dt>" str (if html-xhtml "</dt>") 1072 "<dt>" str (if html-xhtml "</dt>")
1069 "<dd>" _ (if html-xhtml "</dd>") \n))) 1073 "<dd>" _ (if html-xhtml "</dd>") \n)))
1070 ("dt" (t _ "<dd>")) 1074 ("dt" (t _ (if html-xhtml "</dt>")
1075 "<dd>" (if html-xhtml "</dd>") \n))
1071 ("em") 1076 ("em")
1072 ;("fn" "id" "fn") ; ??? 1077 ;("fn" "id" "fn") ; ???
1073 ("head" \n) 1078 ("head" \n)
@@ -1086,7 +1091,7 @@ This takes effect when first loading the library.")
1086 ("isindex" t ("action") ("prompt")) 1091 ("isindex" t ("action") ("prompt"))
1087 ("kbd") 1092 ("kbd")
1088 ("lang") 1093 ("lang")
1089 ("li" t) 1094 ("li" ,(not html-xhtml))
1090 ("math" \n) 1095 ("math" \n)
1091 ("nobr") 1096 ("nobr")
1092 ("option" t ("value") ("label") ("selected" t)) 1097 ("option" t ("value") ("label") ("selected" t))
@@ -1269,6 +1274,15 @@ To work around that, do:
1269 outline-level (lambda () 1274 outline-level (lambda ()
1270 (char-after (1- (match-end 0))))) 1275 (char-after (1- (match-end 0)))))
1271 (setq imenu-create-index-function 'html-imenu-index) 1276 (setq imenu-create-index-function 'html-imenu-index)
1277 (unless (get 'html-xhtml 'saved-value)
1278 ;; not customized -- set from the DocType
1279 (save-excursion
1280 (goto-char (point-min))
1281 (when (re-search-forward
1282 "<!DOCTYPE\\s-+html\\s-+PUBLIC\\s-+\"-//W3C//DTD \\(X?\\)HTML"
1283 nil t)
1284 (set (make-local-variable 'html-xhtml)
1285 (string= "X" (match-string 1))))))
1272 ;; It's for the user to decide if it defeats it or not -stef 1286 ;; It's for the user to decide if it defeats it or not -stef
1273 ;; (make-local-variable 'imenu-sort-function) 1287 ;; (make-local-variable 'imenu-sort-function)
1274 ;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose 1288 ;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose