aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2002-03-04 02:14:31 +0000
committerStefan Monnier2002-03-04 02:14:31 +0000
commit0fda8eff1e659876b27c4748d979fa4a192e05d8 (patch)
tree0499f9d048954689a207f1850c5c8ba7ca8b6887
parentcb30255a8355e0c8f3eab3431129f2385121a8bf (diff)
downloademacs-0fda8eff1e659876b27c4748d979fa4a192e05d8.tar.gz
emacs-0fda8eff1e659876b27c4748d979fa4a192e05d8.zip
Change maintainer to FSF.
(sgml-start-tag-regex, sgml-font-lock-keywords-1, sgml-mode-common) (sgml-tags-invisible, sgml-beginning-of-tag): Allow _ : and non-ASCII in tag names, as required for XML. (sgml-name-char): Don't assume anything about charsets handled by encode-char.
-rw-r--r--lisp/ChangeLog23
-rw-r--r--lisp/textmodes/sgml-mode.el41
2 files changed, 47 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8e50b4d542f..f228887a0db 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,26 @@
12002-03-03 Stefan Monnier <monnier@cs.yale.edu>
2
3 * textmodes/sgml-mode.el: Change maintainer to FSF.
4 (sgml-start-tag-regex, sgml-font-lock-keywords-1, sgml-mode-common)
5 (sgml-tags-invisible, sgml-beginning-of-tag):
6 Allow _ : and non-ASCII in tag names, as required for XML.
7 (sgml-name-char): Don't assume anything about charsets handled by
8 encode-char.
9
10 * textmodes/tex-mode.el (tex-guess-main-file): Handle the case
11 where one of the buffers is narrowed.
12
13 * hexl.el (hexlify-command, dehexlify-command): Remove.
14 (hexlify-buffer, dehexlify-buffer): Use call-process-region
15 rather than shell-command-on-region.
16
17 * newcomment.el (comment-forward): Use forward-comment to skip
18 over whitespace (or comments) even when comment-use-syntax is nil.
19
20 * progmodes/cperl-mode.el (cperl-menu): Add "-emacs" to the version.
21
22 * textmodes/xml-lite.el: New file.
23
12002-03-03 Richard M. Stallman <rms@gnu.org> 242002-03-03 Richard M. Stallman <rms@gnu.org>
2 25
3 * textmodes/artist.el (artist-system): Use make-temp-file. 26 * textmodes/artist.el (artist-system): Use make-temp-file.
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index c99bf06a908..a504e3be7f9 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1,8 +1,9 @@
1;;; sgml-mode.el --- SGML- and HTML-editing modes 1;;; sgml-mode.el --- SGML- and HTML-editing modes
2 2
3;; Copyright (C) 1992,95,96,98,2001 Free Software Foundation, Inc. 3;; Copyright (C) 1992,95,96,98,2001,2002 Free Software Foundation, Inc.
4 4
5;; Author: James Clark <jjc@jclark.com> 5;; Author: James Clark <jjc@jclark.com>
6;; Maintainer: FSF
6;; Adapted-By: ESR, Daniel Pfeiffer <occitan@esperanto.org>, 7;; Adapted-By: ESR, Daniel Pfeiffer <occitan@esperanto.org>,
7;; F.Potorti@cnuce.cnr.it 8;; F.Potorti@cnuce.cnr.it
8;; Keywords: wp, hypermedia, comm, languages 9;; Keywords: wp, hypermedia, comm, languages
@@ -225,16 +226,18 @@ separated by a space."
225 :group 'sgml) 226 :group 'sgml)
226 227
227(defconst sgml-start-tag-regex 228(defconst sgml-start-tag-regex
228 "<[A-Za-z]\\([-.A-Za-z0-9= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*" 229 "<[[:alpha:]]\\([-_.:[:alnum:]= \n\t]\\|\"[^\"]*\"\\|'[^']*'\\)*"
229 "Regular expression that matches a non-empty start tag. 230 "Regular expression that matches a non-empty start tag.
230Any terminating `>' or `/' is not matched.") 231Any terminating `>' or `/' is not matched.")
231 232
232 233
233;; internal 234;; internal
234(defconst sgml-font-lock-keywords-1 235(defconst sgml-font-lock-keywords-1
235 '(("<\\([!?][a-z][-.a-z0-9]*\\)" 1 font-lock-keyword-face) 236 '(("<\\([!?][[:alpha:]][-_.:[:alnum:]]*\\)" 1 font-lock-keyword-face)
236 ("<\\(/?[a-z][-.a-z0-9]*\\)" 1 font-lock-function-name-face) 237 ("<\\(/?[[:alpha:]][-_.:[:alnum:]]*\\)" 1 font-lock-function-name-face)
237 ("[&%][a-z][-.a-z0-9]*;?" . font-lock-variable-name-face))) 238 ;; FIXME: this doesn't cover the variable using a default value.
239 ("\\([[:alpha:]][-_.:[:alnum:]]*\\)=[\"']" 1 font-lock-variable-name-face)
240 ("[&%][[:alpha:]][-_.:[:alnum:]]*;?" . font-lock-variable-name-face)))
238 241
239(defconst sgml-font-lock-keywords-2 242(defconst sgml-font-lock-keywords-2
240 (append 243 (append
@@ -364,9 +367,9 @@ Otherwise, it is set to be buffer-local when the file has
364 ;; This is desirable because SGML discards a newline that appears 367 ;; This is desirable because SGML discards a newline that appears
365 ;; immediately after a start tag or immediately before an end tag. 368 ;; immediately after a start tag or immediately before an end tag.
366 (set (make-local-variable 'paragraph-separate) "[ \t]*$\\|\ 369 (set (make-local-variable 'paragraph-separate) "[ \t]*$\\|\
367\[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$") 370\[ \t]*</?\\([[:alpha:]]\\([-_.:[:alnum:]= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$")
368 (set (make-local-variable 'paragraph-start) "[ \t]*$\\|\ 371 (set (make-local-variable 'paragraph-start) "[ \t]*$\\|\
369\[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>") 372\[ \t]*</?\\([[:alpha:]]\\([-_.:[:alnum:]= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>")
370 (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*") 373 (set (make-local-variable 'adaptive-fill-regexp) "[ \t]*")
371 (set (make-local-variable 'comment-start) "<!-- ") 374 (set (make-local-variable 'comment-start) "<!-- ")
372 (set (make-local-variable 'comment-end) " -->") 375 (set (make-local-variable 'comment-end) " -->")
@@ -429,7 +432,7 @@ Do \\[describe-key] on the following bindings to discover what they do.
429 ;; Set `imenu-generic-expression' here, rather than in `sgml-mode-common', 432 ;; Set `imenu-generic-expression' here, rather than in `sgml-mode-common',
430 ;; because this definition probably is not useful in HTML mode. 433 ;; because this definition probably is not useful in HTML mode.
431 (set (make-local-variable 'imenu-generic-expression) 434 (set (make-local-variable 'imenu-generic-expression)
432 "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\([A-Za-z][-A-Za-z.0-9]*\\)")) 435 "<!\\(element\\|entity\\)[ \t\n]+%?[ \t\n]*\\([[:alpha:]][-_.:[:alnum:]]*\\)"))
433 436
434 437
435(defun sgml-comment-indent () 438(defun sgml-comment-indent ()
@@ -478,6 +481,9 @@ start tag, and the second `/' is the corresponding null end tag."
478 (1+ blinkpos))))))))) 481 (1+ blinkpos)))))))))
479 482
480 483
484;; Why doesn't this use the iso-cvt table or, preferably, generate the
485;; inverse of the extensive table in the SGML Quail input method? -- fx
486;; I guess that's moot since it only works with Latin-1 anyhow.
481(defun sgml-name-char (&optional char) 487(defun sgml-name-char (&optional char)
482 "Insert a symbolic character name according to `sgml-char-names'. 488 "Insert a symbolic character name according to `sgml-char-names'.
483Non-ASCII chars may be inserted either with the meta key, as in M-SPC for 489Non-ASCII chars may be inserted either with the meta key, as in M-SPC for
@@ -499,11 +505,11 @@ encoded keyboard operation."
499 ?\;)) 505 ?\;))
500 ((aref sgml-char-names-table char) 506 ((aref sgml-char-names-table char)
501 (insert ?& (aref sgml-char-names-table char) ?\;)) 507 (insert ?& (aref sgml-char-names-table char) ?\;))
502 ((memq (char-charset char) '(mule-unicode-0100-24ff 508 ((let ((c (encode-char char 'ucs)))
503 mule-unicode-2500-33ff 509 (when c
504 mule-unicode-e000-ffff)) 510 (insert (format "&#%d;" c))
505 (insert (format "&#%d;" (encode-char char 'ucs)))) 511 t)))
506 (t 512 (t ; should be an error? -- fx
507 (insert char)))) 513 (insert char))))
508 514
509(defun sgml-name-self () 515(defun sgml-name-self ()
@@ -523,7 +529,8 @@ encoded keyboard operation."
523 (self-insert-command 1))) 529 (self-insert-command 1)))
524 530
525(defun sgml-name-8bit-mode () 531(defun sgml-name-8bit-mode ()
526 "Toggle whether to insert named entities instead of non-ASCII characters." 532 "Toggle whether to insert named entities instead of non-ASCII characters.
533This only works for Latin-1 input."
527 (interactive) 534 (interactive)
528 (setq sgml-name-8bit-mode (not sgml-name-8bit-mode)) 535 (setq sgml-name-8bit-mode (not sgml-name-8bit-mode))
529 (message "sgml name entity mode is now %s" 536 (message "sgml name entity mode is now %s"
@@ -777,7 +784,7 @@ With prefix argument ARG, repeat this ARG times."
777 (if arg 784 (if arg
778 (>= (prefix-numeric-value arg) 0) 785 (>= (prefix-numeric-value arg) 0)
779 (not sgml-tags-invisible))) 786 (not sgml-tags-invisible)))
780 (while (re-search-forward "<\\([!/?A-Za-z][-A-Za-z0-9]*\\)" 787 (while (re-search-forward "<\\([!/?]?[[:alpha:]][-_.:[:alnum:]]*\\)"
781 nil t) 788 nil t)
782 (setq string 789 (setq string
783 (cdr (assq (intern-soft (downcase (match-string 1))) 790 (cdr (assq (intern-soft (downcase (match-string 1)))
@@ -850,7 +857,7 @@ If this can't be done, return t."
850 (forward-list) 857 (forward-list)
851 (point)) 858 (point))
852 0))) 859 0)))
853 (if (looking-at "<[!?/]?[[A-Za-z][A-Za-z0-9]*") 860 (if (looking-at "<[!/?]?[[:alpha:]][-_.:[:alnum:]]*")
854 (buffer-substring-no-properties 861 (buffer-substring-no-properties
855 (1+ (point)) 862 (1+ (point))
856 (match-end 0)) 863 (match-end 0))
@@ -1298,7 +1305,7 @@ To work around that, do:
1298 outline-regexp "^.*<[Hh][1-6]\\>" 1305 outline-regexp "^.*<[Hh][1-6]\\>"
1299 outline-heading-end-regexp "</[Hh][1-6]>" 1306 outline-heading-end-regexp "</[Hh][1-6]>"
1300 outline-level (lambda () 1307 outline-level (lambda ()
1301 (char-after (1- (match-end 0))))) 1308 (char-before (match-end 0))))
1302 (setq imenu-create-index-function 'html-imenu-index) 1309 (setq imenu-create-index-function 'html-imenu-index)
1303 (when sgml-xml (setq mode-name "XHTML")) 1310 (when sgml-xml (setq mode-name "XHTML"))
1304 (set (make-local-variable 'sgml-empty-tags) 1311 (set (make-local-variable 'sgml-empty-tags)