/[emacs]/emacs/lisp/textmodes/sgml-mode.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/sgml-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.54.4.1 by eliz, Mon Oct 22 11:12:57 2001 UTC revision 1.54.4.2 by pj, Wed Feb 6 14:23:48 2002 UTC
# Line 226  separated by a space." Line 226  separated by a space."
226    :group 'sgml)    :group 'sgml)
227    
228  (defconst sgml-start-tag-regex  (defconst sgml-start-tag-regex
229    "<[A-Za-z]\\([-.A-Za-z0-9= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"    "<[[:alnum:]]\\([-_.:[:alnum:]= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
230    "Regular expression that matches a non-empty start tag.    "Regular expression that matches a non-empty start tag.
231  Any terminating `>' or `/' is not matched.")  Any terminating `>' or `/' is not matched.")
232    
233    
234  ;; internal  ;; internal
235  (defconst sgml-font-lock-keywords-1  (defconst sgml-font-lock-keywords-1
236    '(("<\\([!?][a-z][-.a-z0-9]*\\)" 1 font-lock-keyword-face)    '(("<\\([!?][[:alnum:]][-_.:[:alnum:]]*\\)" 1 font-lock-keyword-face)
237      ("<\\(/?[a-z][-.a-z0-9]*\\)" 1 font-lock-function-name-face)      ("<\\(/?[[:alnum:]][-_.:[:alnum:]]*\\)" 1 font-lock-function-name-face)
238      ("[&%][a-z][-.a-z0-9]*;?" . font-lock-variable-name-face)      ("[&%][[:alpha:]][-_.:[:alnum:]]*;?" . font-lock-variable-name-face)))
     ("<! *--.*-- *>" . font-lock-comment-face)))  
239    
240  (defconst sgml-font-lock-keywords-2 ())  (defconst sgml-font-lock-keywords-2 ())
241    
# Line 343  varables of same name)." Line 342  varables of same name)."
342          ;; This is desirable because SGML discards a newline that appears          ;; This is desirable because SGML discards a newline that appears
343          ;; immediately after a start tag or immediately before an end tag.          ;; immediately after a start tag or immediately before an end tag.
344          paragraph-separate "[ \t]*$\\|\          paragraph-separate "[ \t]*$\\|\
345  \[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$"  \[ \t]*</?\\([A-Za-z]\\([-_.:[:alnum:]= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$"
346          paragraph-start "[ \t]*$\\|\          paragraph-start "[ \t]*$\\|\
347  \[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>"  \[ \t]*</?\\([A-Za-z]\\([-_.:[:alnum:]]= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>"
348          adaptive-fill-regexp "[ \t]*"          adaptive-fill-regexp "[ \t]*"
349          comment-start "<!-- "          comment-start "<!-- "
350          comment-end " -->"          comment-end " -->"
# Line 366  varables of same name)." Line 365  varables of same name)."
365                               nil                               nil
366                               t)                               t)
367          facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)          facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
368      (set (make-local-variable 'font-lock-syntactic-keywords)
369           '(("\\(<\\)! *--.*-- *\\(>\\)" (1 "!") (2 "!"))))
370    ;; This will allow existing comments within declarations to be    ;; This will allow existing comments within declarations to be
371    ;; recognized.    ;; recognized.
372    (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*")    (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*")
# Line 464  start tag, and the second `/' is the cor Line 465  start tag, and the second `/' is the cor
465                                                 (point))                                                 (point))
466                                               (1+ blinkpos))))))))))                                               (1+ blinkpos))))))))))
467    
468    ;; Why doesn't this use the iso-cvt table or, preferably, generate the
469    ;; inverse of the extensive table in the SGML Quail input method?  -- fx
470    ;; I guess that's moot since it only works with Latin-1 anyhow.
471  (defun sgml-name-char (&optional char)  (defun sgml-name-char (&optional char)
472    "Insert a symbolic character name according to `sgml-char-names'.    "Insert a symbolic character name according to `sgml-char-names'.
473  Non-ASCII chars may be inserted either with the meta key, as in M-SPC for  Non-ASCII chars may be inserted either with the meta key, as in M-SPC for
# Line 486  encoded keyboard operation." Line 489  encoded keyboard operation."
489              ?\;))              ?\;))
490     ((aref sgml-char-names-table char)     ((aref sgml-char-names-table char)
491      (insert ?& (aref sgml-char-names-table char) ?\;))      (insert ?& (aref sgml-char-names-table char) ?\;))
492     ((memq (char-charset char) '(mule-unicode-0100-24ff     ((let ((c (encode-char char 'ucs)))
493                                  mule-unicode-2500-33ff        (when c
494                                  mule-unicode-e000-ffff))          (insert (format "&#%d;" c))
495      (insert (format "&#%d;" (encode-char char 'ucs))))          t)))
496     (t     (t                                   ; should be an error?  -- fx
497      (insert char))))      (insert char))))
498    
499  (defun sgml-name-self ()  (defun sgml-name-self ()
# Line 509  encoded keyboard operation." Line 512  encoded keyboard operation."
512          (sgml-name-char mc))          (sgml-name-char mc))
513      (self-insert-command 1)))      (self-insert-command 1)))
514    
515    ;; Fixme: This should sanity-check for use of Latin-1.
516  (defun sgml-name-8bit-mode ()  (defun sgml-name-8bit-mode ()
517    "Toggle whether to insert named entities instead of non-ASCII characters."    "Toggle whether to insert named entities instead of non-ASCII characters.
518    This only works for Latin-1 input."
519    (interactive)    (interactive)
520    (setq sgml-name-8bit-mode (not sgml-name-8bit-mode))    (setq sgml-name-8bit-mode (not sgml-name-8bit-mode))
521    (message "sgml name entity mode is now %s"    (message "sgml name entity mode is now %s"

Legend:
Removed from v.1.54.4.1  
changed lines
  Added in v.1.54.4.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26