* lisp/files.el (auto-mode-alist): Use html-mode for *.xhtml.
[bpt/emacs.git] / lisp / textmodes / sgml-mode.el
index 6cd4121..47d2f7a 100644 (file)
@@ -100,6 +100,7 @@ This takes effect when first loading the `sgml-mode' library.")
     (define-key map "\C-c\C-d" 'sgml-delete-tag)
     (define-key map "\C-c\^?" 'sgml-delete-tag)
     (define-key map "\C-c?" 'sgml-tag-help)
+    (define-key map "\C-c]" 'sgml-close-tag)
     (define-key map "\C-c/" 'sgml-close-tag)
 
     ;; Redundant keybindings, for consistency with TeX mode.
@@ -293,11 +294,12 @@ Any terminating `>' or `/' is not matched.")
 (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1
   "*Rules for highlighting SGML code.  See also `sgml-tag-face-alist'.")
 
-(defvar sgml-font-lock-syntactic-keywords
+(defconst sgml-syntax-propertize-function
+  (syntax-propertize-rules
   ;; Use the `b' style of comments to avoid interference with the -- ... --
   ;; comments recognized when `sgml-specials' includes ?-.
   ;; FIXME: beware of <!--> blabla <!--> !!
-  '(("\\(<\\)!--" (1 "< b"))
+   ("\\(<\\)!--" (1 "< b"))
     ("--[ \t\n]*\\(>\\)" (1 "> b"))
     ;; Double quotes outside of tags should not introduce strings.
     ;; Be careful to call `syntax-ppss' on a position before the one we're
@@ -477,9 +479,9 @@ Do \\[describe-key] on the following bindings to discover what they do.
        '((sgml-font-lock-keywords
           sgml-font-lock-keywords-1
           sgml-font-lock-keywords-2)
-         nil t nil nil
-         (font-lock-syntactic-keywords
-          . sgml-font-lock-syntactic-keywords)))
+         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))
@@ -526,7 +528,7 @@ Behaves electrically if `sgml-quick-keys' is non-nil."
     (insert-char ?/ 1)
     (indent-according-to-mode))
    ((eq sgml-quick-keys 'close)
-    (delete-backward-char 1)
+    (delete-char -1)
     (sgml-close-tag))
    (t
     (sgml-slash-matching arg))))
@@ -583,7 +585,7 @@ encoded keyboard operation."
   (insert ?&)
   (or char
       (setq char (read-quoted-char "Enter char or octal number")))
-  (delete-backward-char 1)
+  (delete-char -1)
   (insert char)
   (undo-boundary)
   (sgml-namify-char))
@@ -601,7 +603,7 @@ Uses `sgml-char-names'."
           ((encode-char char 'ucs)))))
     (if (not name)
        (error "Don't know the name of `%c'" char)
-      (delete-backward-char 1)
+      (delete-char -1)
       (insert (format (if (numberp name) "&#%d;" "&%s;") name)))))
 
 (defun sgml-name-self ()
@@ -707,7 +709,7 @@ If QUIET, do not print a message when there are no attributes for TAG."
              (sgml-value (assoc (downcase attribute) alist))
              (setq i (1- i))))
          (if (eq (preceding-char) ?\s)
-             (delete-backward-char 1)))
+             (delete-char -1)))
        car)))
 
 (defun sgml-auto-attributes (arg)
@@ -1117,7 +1119,7 @@ See `sgml-tag-alist' for info about attribute rules."
          (setq alist (skeleton-read '(completing-read "Value: " (cdr alist))))
          (if (string< "" alist)
              (insert alist ?\")
-           (delete-backward-char 2)))
+           (delete-char -2)))
       (insert "=\"")
       (if (cdr alist)
           (insert (skeleton-read '(completing-read "Value: " alist)))