emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/sgml-mode.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/sgml-mode.el
Date: Sun, 03 Mar 2002 21:14:06 -0500

Index: emacs/lisp/textmodes/sgml-mode.el
diff -c emacs/lisp/textmodes/sgml-mode.el:1.65 
emacs/lisp/textmodes/sgml-mode.el:1.66
*** emacs/lisp/textmodes/sgml-mode.el:1.65      Thu Feb 28 11:14:15 2002
--- emacs/lisp/textmodes/sgml-mode.el   Sun Mar  3 21:14:06 2002
***************
*** 1,8 ****
  ;;; sgml-mode.el --- SGML- and HTML-editing modes
  
! ;; Copyright (C) 1992,95,96,98,2001  Free Software Foundation, Inc.
  
  ;; Author: James Clark <address@hidden>
  ;; Adapted-By: ESR, Daniel Pfeiffer <address@hidden>,
  ;;             address@hidden
  ;; Keywords: wp, hypermedia, comm, languages
--- 1,9 ----
  ;;; sgml-mode.el --- SGML- and HTML-editing modes
  
! ;; Copyright (C) 1992,95,96,98,2001,2002  Free Software Foundation, Inc.
  
  ;; Author: James Clark <address@hidden>
+ ;; Maintainer: FSF
  ;; Adapted-By: ESR, Daniel Pfeiffer <address@hidden>,
  ;;             address@hidden
  ;; Keywords: wp, hypermedia, comm, languages
***************
*** 225,240 ****
    :group 'sgml)
  
  (defconst sgml-start-tag-regex
!   "<[A-Za-z]\\([-.A-Za-z0-9= \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)))
  
  (defconst sgml-font-lock-keywords-2
    (append
--- 226,243 ----
    :group 'sgml)
  
  (defconst sgml-start-tag-regex
!   "<[[:alpha:]]\\([-_.:[: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
!   '(("<\\([!?][[:alpha:]][-_.:[:alnum:]]*\\)" 1 font-lock-keyword-face)
!     ("<\\(/?[[:alpha:]][-_.:[:alnum:]]*\\)" 1 font-lock-function-name-face)
!     ;; FIXME: this doesn't cover the variable using a default value.
!     ("\\([[:alpha:]][-_.:[:alnum:]]*\\)=[\"']" 1 font-lock-variable-name-face)
!     ("[&%][[:alpha:]][-_.:[:alnum:]]*;?" . font-lock-variable-name-face)))
  
  (defconst sgml-font-lock-keywords-2
    (append
***************
*** 364,372 ****
    ;; This is desirable because SGML discards a newline that appears
    ;; immediately after a start tag or immediately before an end tag.
    (set (make-local-variable 'paragraph-separate) "[ \t]*$\\|\
! \[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$")
    (set (make-local-variable 'paragraph-start) "[ \t]*$\\|\
! \[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>")
    (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*")
    (set (make-local-variable 'comment-start) "<!-- ")
    (set (make-local-variable 'comment-end) " -->")
--- 367,375 ----
    ;; This is desirable because SGML discards a newline that appears
    ;; immediately after a start tag or immediately before an end tag.
    (set (make-local-variable 'paragraph-separate) "[ \t]*$\\|\
! \[ \t]*</?\\([[:alpha:]]\\([-_.:[:alnum:]= 
\t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$")
    (set (make-local-variable 'paragraph-start) "[ \t]*$\\|\
! \[ \t]*</?\\([[:alpha:]]\\([-_.:[:alnum:]= 
\t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>")
    (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*")
    (set (make-local-variable 'comment-start) "<!-- ")
    (set (make-local-variable 'comment-end) " -->")
***************
*** 429,435 ****
    ;; Set `imenu-generic-expression' here, rather than in `sgml-mode-common',
    ;; because this definition probably is not useful in HTML mode.
    (set (make-local-variable 'imenu-generic-expression)
!        "<!\\(element\\|entity\\)[ \t\n]+%?[ 
\t\n]*\\([A-Za-z][-A-Za-z.0-9]*\\)"))
  
  
  (defun sgml-comment-indent ()
--- 432,438 ----
    ;; Set `imenu-generic-expression' here, rather than in `sgml-mode-common',
    ;; because this definition probably is not useful in HTML mode.
    (set (make-local-variable 'imenu-generic-expression)
!        "<!\\(element\\|entity\\)[ \t\n]+%?[ 
\t\n]*\\([[:alpha:]][-_.:[:alnum:]]*\\)"))
  
  
  (defun sgml-comment-indent ()
***************
*** 478,483 ****
--- 481,489 ----
                                           (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
***************
*** 499,509 ****
            ?\;))
     ((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
      (insert char))))
  
  (defun sgml-name-self ()
--- 505,515 ----
            ?\;))
     ((aref sgml-char-names-table char)
      (insert ?& (aref sgml-char-names-table char) ?\;))
!    ((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 ()
***************
*** 523,529 ****
      (self-insert-command 1)))
  
  (defun sgml-name-8bit-mode ()
!   "Toggle whether to insert named entities instead of non-ASCII characters."
    (interactive)
    (setq sgml-name-8bit-mode (not sgml-name-8bit-mode))
    (message "sgml name entity mode is now %s"
--- 529,536 ----
      (self-insert-command 1)))
  
  (defun sgml-name-8bit-mode ()
!   "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"
***************
*** 777,783 ****
                   (if arg
                       (>= (prefix-numeric-value arg) 0)
                     (not sgml-tags-invisible)))
!             (while (re-search-forward "<\\([!/?A-Za-z][-A-Za-z0-9]*\\)"
                                        nil t)
                (setq string
                      (cdr (assq (intern-soft (downcase (match-string 1)))
--- 784,790 ----
                   (if arg
                       (>= (prefix-numeric-value arg) 0)
                     (not sgml-tags-invisible)))
!             (while (re-search-forward 
"<\\([!/?]?[[:alpha:]][-_.:[:alnum:]]*\\)"
                                        nil t)
                (setq string
                      (cdr (assq (intern-soft (downcase (match-string 1)))
***************
*** 850,856 ****
                  (forward-list)
                  (point))
              0)))
!       (if (looking-at "<[!?/]?[[A-Za-z][A-Za-z0-9]*")
          (buffer-substring-no-properties
           (1+ (point))
           (match-end 0))
--- 857,863 ----
                  (forward-list)
                  (point))
              0)))
!       (if (looking-at "<[!/?]?[[:alpha:]][-_.:[:alnum:]]*")
          (buffer-substring-no-properties
           (1+ (point))
           (match-end 0))
***************
*** 1298,1304 ****
        outline-regexp "^.*<[Hh][1-6]\\>"
        outline-heading-end-regexp "</[Hh][1-6]>"
        outline-level (lambda ()
!                       (char-after (1- (match-end 0)))))
    (setq imenu-create-index-function 'html-imenu-index)
    (when sgml-xml (setq mode-name "XHTML"))
    (set (make-local-variable 'sgml-empty-tags)
--- 1305,1311 ----
        outline-regexp "^.*<[Hh][1-6]\\>"
        outline-heading-end-regexp "</[Hh][1-6]>"
        outline-level (lambda ()
!                       (char-before (match-end 0))))
    (setq imenu-create-index-function 'html-imenu-index)
    (when sgml-xml (setq mode-name "XHTML"))
    (set (make-local-variable 'sgml-empty-tags)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]