+2002-02-06 Pavel Jan\e,Bm\e(Bk <Pavel@Janik.cz>
+
+ * textmodes/sgml-mode.el (sgml-start-tag-regex)
+ (sgml-font-lock-keywords-1, sgml-mode-common): Allow underscore,
+ colon, non-ASCII letters.
+ (sgml-name-char): Don't assume anything about charsets handled by
+ encode-char.
+ (sgml-name-8bit-mode): Doc fix.
+ (sgml-font-lock-keywords-1): Remove comment pattern.
+ (sgml-mode-common): Set font-lock-syntactic-keywords.
+ From Dave Love <fx@gnu.org>.
+
2002-02-06 Eli Zaretskii <eliz@is.elta.co.il>
* play/pong.el (pong-height): Don't use height that exceeds the
:group 'sgml)
(defconst sgml-start-tag-regex
- "<[A-Za-z]\\([-.A-Za-z0-9= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
+ "<[[:alnum:]]\\([-_.:[:alnum:]= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
"Regular expression that matches a non-empty start tag.
Any terminating `>' or `/' is not matched.")
;; internal
(defconst sgml-font-lock-keywords-1
- '(("<\\([!?][a-z][-.a-z0-9]*\\)" 1 font-lock-keyword-face)
- ("<\\(/?[a-z][-.a-z0-9]*\\)" 1 font-lock-function-name-face)
- ("[&%][a-z][-.a-z0-9]*;?" . font-lock-variable-name-face)
- ("<! *--.*-- *>" . font-lock-comment-face)))
+ '(("<\\([!?][[:alnum:]][-_.:[:alnum:]]*\\)" 1 font-lock-keyword-face)
+ ("<\\(/?[[:alnum:]][-_.:[:alnum:]]*\\)" 1 font-lock-function-name-face)
+ ("[&%][[:alpha:]][-_.:[:alnum:]]*;?" . font-lock-variable-name-face)))
(defconst sgml-font-lock-keywords-2 ())
;; This is desirable because SGML discards a newline that appears
;; immediately after a start tag or immediately before an end tag.
paragraph-separate "[ \t]*$\\|\
-\[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$"
+\[ \t]*</?\\([A-Za-z]\\([-_.:[:alnum:]= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$"
paragraph-start "[ \t]*$\\|\
-\[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>"
+\[ \t]*</?\\([A-Za-z]\\([-_.:[:alnum:]]= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>"
adaptive-fill-regexp "[ \t]*"
comment-start "<!-- "
comment-end " -->"
nil
t)
facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
+ (set (make-local-variable 'font-lock-syntactic-keywords)
+ '(("\\(<\\)! *--.*-- *\\(>\\)" (1 "!") (2 "!"))))
;; This will allow existing comments within declarations to be
;; recognized.
(set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*")
(point))
(1+ blinkpos))))))))))
-
+;; Why doesn't this use the iso-cvt table or, preferably, generate the
+;; inverse of the extensive table in the SGML Quail input method? -- fx
+;; I guess that's moot since it only works with Latin-1 anyhow.
(defun sgml-name-char (&optional char)
"Insert a symbolic character name according to `sgml-char-names'.
Non-ASCII chars may be inserted either with the meta key, as in M-SPC for
?\;))
((aref sgml-char-names-table char)
(insert ?& (aref sgml-char-names-table char) ?\;))
- ((memq (char-charset char) '(mule-unicode-0100-24ff
- mule-unicode-2500-33ff
- mule-unicode-e000-ffff))
- (insert (format "&#%d;" (encode-char char 'ucs))))
- (t
+ ((let ((c (encode-char char 'ucs)))
+ (when c
+ (insert (format "&#%d;" c))
+ t)))
+ (t ; should be an error? -- fx
(insert char))))
(defun sgml-name-self ()
(sgml-name-char mc))
(self-insert-command 1)))
+;; Fixme: This should sanity-check for use of Latin-1.
(defun sgml-name-8bit-mode ()
- "Toggle whether to insert named entities instead of non-ASCII characters."
+ "Toggle whether to insert named entities instead of non-ASCII characters.
+This only works for Latin-1 input."
(interactive)
(setq sgml-name-8bit-mode (not sgml-name-8bit-mode))
(message "sgml name entity mode is now %s"