1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-23 21:13:52 -08:00

(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>.
This commit is contained in:
Pavel Janík 2002-02-06 14:24:26 +00:00
parent 9f2dbe140f
commit bbb3655e04
2 changed files with 31 additions and 14 deletions

View file

@ -1,3 +1,15 @@
2002-02-06 Pavel Jan,Bm(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

View file

@ -226,17 +226,16 @@ separated by a space."
: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 ())
@ -343,9 +342,9 @@ varables of same name)."
;; 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 " -->"
@ -366,6 +365,8 @@ varables of same name)."
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]*")
@ -464,7 +465,9 @@ start tag, and the second `/' is the corresponding null end tag."
(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
@ -486,11 +489,11 @@ encoded keyboard operation."
?\;))
((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 ()
@ -509,8 +512,10 @@ encoded keyboard operation."
(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"