diff options
| author | Juanma Barranquero | 2008-07-03 12:25:23 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2008-07-03 12:25:23 +0000 |
| commit | 10545bd83d3b5c7f6082d56a59449ff1eddae2ff (patch) | |
| tree | e6a516cfc9c44e80a6874a534f0e9a9908d0ba1f /lisp | |
| parent | 946598bf94b5a0fac989f3108a6ee2bc425611de (diff) | |
| download | emacs-10545bd83d3b5c7f6082d56a59449ff1eddae2ff.tar.gz emacs-10545bd83d3b5c7f6082d56a59449ff1eddae2ff.zip | |
Fix typos, and general docstring cleanup.
* nxml/nxml-glyph.el (nxml-glyph-set-hook):
* nxml/nxml-uchnm.el (nxml-unicode-blocks)
(nxml-unicode-block-char-name-set):
* nxml/nxml-util.el (nxml-debug, nxml-make-namespace):
* nxml/rng-nxml.el (rng-set-state-after):
* nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring.
* nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary)
(rng-c-parse-annotation-body):
* nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings.
* nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1)
(nxml-extend-region, nxml-merge-indent-context-type, nxml-complete)
(nxml-forward-balanced-item, nxml-dynamic-markup-word)
(nxml-define-char-name-set, nxml-toggle-char-ref-extra-display):
Fix typos in docstrings.
(nxml-attribute-indent): Reflow docstring.
(nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end)
(nxml-default-buffer-file-coding-system): Doc fixes.
* nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state)
(nxml-ns-set-prefix): Fix typos in docstrings.
(nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default):
Reflow docstring.
(nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes.
* nxml/nxml-outln.el (nxml-hide-all-text-content)
(nxml-show-direct-text-content, nxml-show-direct-subheadings)
(nxml-hide-direct-text-content, nxml-hide-subheadings)
(nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other)
(nxml-outline-display-rest, nxml-outline-set-overlay)
(nxml-section-tag-forward, nxml-section-tag-backward)
(nxml-back-to-section-start): Fix typos in docstrings.
* nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file):
Doc fixes.
* nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards)
(nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes.
(nxml-scan-after-change): Fix typo in docstring.
* nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list)
(rng-name-class-possible-names): Doc fixes.
(rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris)
(rng-match-possible-start-tag-names, rng-match-possible-value-strings):
Fix typos in docstrings.
(rng-intern-group-shortcut, rng-intern-choice-shortcut):
Reflow docstrings.
* nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes.
(rng-substq, rng-complete-before-point): Fix typos in docstrings.
* nxml/rng-xsd.el (rng-xsd-make-date-time-regexp)
(rng-xsd-convert-date-time): Reflow docstrings.
(rng-xsd-compile): Fix typo in docstring.
* nxml/rng-loc.el (rng-current-schema-file-name)
(rng-locate-schema-file-using, rng-locate-schema-file-from-type-id):
Doc fixes.
(rng-set-schema-file): Fix typo in docstring.
* nxml/rng-valid.el (rng-error-count, rng-validate-mode)
(rng-do-some-validation, rng-process-start-tag, rng-process-text):
Fix typos in docstrings.
(rng-message-overlay, rng-conditional-up-to-date-start)
(rng-conditional-up-to-date-end): Doc fixes.
(rng-next-error, rng-previous-error): Reflow docstrings.
* nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix.
(xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs)
(xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog)
(xmltok-merge-attributes): Fix typos in docstrings.
(xmltok-make-attribute, xmltok-forward-special)
(xmltok-get-declared-encoding-position): Reflow docstrings.
* nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix.
(xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp):
Fix typos in docstrings.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 81 | ||||
| -rw-r--r-- | lisp/nxml/nxml-glyph.el | 16 | ||||
| -rw-r--r-- | lisp/nxml/nxml-mode.el | 94 | ||||
| -rw-r--r-- | lisp/nxml/nxml-ns.el | 48 | ||||
| -rw-r--r-- | lisp/nxml/nxml-outln.el | 46 | ||||
| -rw-r--r-- | lisp/nxml/nxml-parse.el | 22 | ||||
| -rw-r--r-- | lisp/nxml/nxml-rap.el | 49 | ||||
| -rw-r--r-- | lisp/nxml/nxml-uchnm.el | 6 | ||||
| -rw-r--r-- | lisp/nxml/nxml-util.el | 4 | ||||
| -rw-r--r-- | lisp/nxml/rng-cmpct.el | 33 | ||||
| -rw-r--r-- | lisp/nxml/rng-dt.el | 14 | ||||
| -rw-r--r-- | lisp/nxml/rng-loc.el | 14 | ||||
| -rw-r--r-- | lisp/nxml/rng-match.el | 74 | ||||
| -rw-r--r-- | lisp/nxml/rng-nxml.el | 6 | ||||
| -rw-r--r-- | lisp/nxml/rng-uri.el | 8 | ||||
| -rw-r--r-- | lisp/nxml/rng-util.el | 10 | ||||
| -rw-r--r-- | lisp/nxml/rng-valid.el | 72 | ||||
| -rw-r--r-- | lisp/nxml/rng-xsd.el | 89 | ||||
| -rw-r--r-- | lisp/nxml/xmltok.el | 81 | ||||
| -rw-r--r-- | lisp/nxml/xsd-regexp.el | 44 |
20 files changed, 448 insertions, 363 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 71175db03d4..6891f69f07e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,84 @@ | |||
| 1 | 2008-07-03 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * nxml/nxml-glyph.el (nxml-glyph-set-hook): | ||
| 4 | * nxml/nxml-uchnm.el (nxml-unicode-blocks) | ||
| 5 | (nxml-unicode-block-char-name-set): | ||
| 6 | * nxml/nxml-util.el (nxml-debug, nxml-make-namespace): | ||
| 7 | * nxml/rng-nxml.el (rng-set-state-after): | ||
| 8 | * nxml/rng-uri.el (rng-file-name-uri): Fix typo in docstring. | ||
| 9 | |||
| 10 | * nxml/rng-cmpct.el (rng-c-lookup-create, rng-c-parse-primary) | ||
| 11 | (rng-c-parse-annotation-body): | ||
| 12 | * nxml/rng-dt.el (rng-dt-namespace-context-getter): Reflow docstrings. | ||
| 13 | |||
| 14 | * nxml/nxml-mode.el (nxml, nxml-mode, nxml-after-change1) | ||
| 15 | (nxml-extend-region, nxml-merge-indent-context-type, nxml-complete) | ||
| 16 | (nxml-forward-balanced-item, nxml-dynamic-markup-word) | ||
| 17 | (nxml-define-char-name-set, nxml-toggle-char-ref-extra-display): | ||
| 18 | Fix typos in docstrings. | ||
| 19 | (nxml-attribute-indent): Reflow docstring. | ||
| 20 | (nxml-bind-meta-tab-to-complete-flag, nxml-last-fontify-end) | ||
| 21 | (nxml-default-buffer-file-coding-system): Doc fixes. | ||
| 22 | |||
| 23 | * nxml/nxml-ns.el (nxml-ns-state, nxml-ns-initial-state) | ||
| 24 | (nxml-ns-set-prefix): Fix typos in docstrings. | ||
| 25 | (nxml-ns-push-state, nxml-ns-pop-state, nxml-ns-set-default): | ||
| 26 | Reflow docstring. | ||
| 27 | (nxml-ns-get-prefix, nxml-ns-get-default): Doc fixes. | ||
| 28 | |||
| 29 | * nxml/nxml-outln.el (nxml-hide-all-text-content) | ||
| 30 | (nxml-show-direct-text-content, nxml-show-direct-subheadings) | ||
| 31 | (nxml-hide-direct-text-content, nxml-hide-subheadings) | ||
| 32 | (nxml-hide-text-content, nxml-show-subheadings, nxml-hide-other) | ||
| 33 | (nxml-outline-display-rest, nxml-outline-set-overlay) | ||
| 34 | (nxml-section-tag-forward, nxml-section-tag-backward) | ||
| 35 | (nxml-back-to-section-start): Fix typos in docstrings. | ||
| 36 | |||
| 37 | * nxml/nxml-parse.el (nxml-validate-function, nxml-parse-file): | ||
| 38 | Doc fixes. | ||
| 39 | |||
| 40 | * nxml/nxml-rap.el (nxml-scan-end, nxml-move-tag-backwards) | ||
| 41 | (nxml-scan-element-forward, nxml-scan-element-backward): Doc fixes. | ||
| 42 | (nxml-scan-after-change): Fix typo in docstring. | ||
| 43 | |||
| 44 | * nxml/rng-match.el (rng-being-compiled, rng-normalize-choice-list) | ||
| 45 | (rng-name-class-possible-names): Doc fixes. | ||
| 46 | (rng-memo-map-add, rng-intern-group, rng-match-possible-namespace-uris) | ||
| 47 | (rng-match-possible-start-tag-names, rng-match-possible-value-strings): | ||
| 48 | Fix typos in docstrings. | ||
| 49 | (rng-intern-group-shortcut, rng-intern-choice-shortcut): | ||
| 50 | Reflow docstrings. | ||
| 51 | |||
| 52 | * nxml/rng-util.el (rng-uniquify-eq, rng-uniquify-equal): Doc fixes. | ||
| 53 | (rng-substq, rng-complete-before-point): Fix typos in docstrings. | ||
| 54 | |||
| 55 | * nxml/rng-xsd.el (rng-xsd-make-date-time-regexp) | ||
| 56 | (rng-xsd-convert-date-time): Reflow docstrings. | ||
| 57 | (rng-xsd-compile): Fix typo in docstring. | ||
| 58 | |||
| 59 | * nxml/rng-loc.el (rng-current-schema-file-name) | ||
| 60 | (rng-locate-schema-file-using, rng-locate-schema-file-from-type-id): | ||
| 61 | Doc fixes. | ||
| 62 | (rng-set-schema-file): Fix typo in docstring. | ||
| 63 | |||
| 64 | * nxml/rng-valid.el (rng-error-count, rng-validate-mode) | ||
| 65 | (rng-do-some-validation, rng-process-start-tag, rng-process-text): | ||
| 66 | Fix typos in docstrings. | ||
| 67 | (rng-message-overlay, rng-conditional-up-to-date-start) | ||
| 68 | (rng-conditional-up-to-date-end): Doc fixes. | ||
| 69 | (rng-next-error, rng-previous-error): Reflow docstrings. | ||
| 70 | |||
| 71 | * nxml/xmltok.el (xmltok-attribute-raw-normalized-value): Doc fix. | ||
| 72 | (xmltok-dtd, xmltok-dependent-regions, xmltok-attribute-refs) | ||
| 73 | (xmltok-valid-char-p, xmltok-standalone, xmltok-forward-prolog) | ||
| 74 | (xmltok-merge-attributes): Fix typos in docstrings. | ||
| 75 | (xmltok-make-attribute, xmltok-forward-special) | ||
| 76 | (xmltok-get-declared-encoding-position): Reflow docstrings. | ||
| 77 | |||
| 78 | * nxml/xsd-regexp.el (xsdre-char-class-to-range-list): Doc fix. | ||
| 79 | (xsdre-range-list-union, xsdre-check-range-list, xsdre-current-regexp): | ||
| 80 | Fix typos in docstrings. | ||
| 81 | |||
| 1 | 2008-07-02 John Paul Wallington <jpw@pobox.com> | 82 | 2008-07-02 John Paul Wallington <jpw@pobox.com> |
| 2 | 83 | ||
| 3 | * ibuffer.el (ibuffer-buffer-file-name): | 84 | * ibuffer.el (ibuffer-buffer-file-name): |
diff --git a/lisp/nxml/nxml-glyph.el b/lisp/nxml/nxml-glyph.el index 790e558e5ed..ee5da1531d7 100644 --- a/lisp/nxml/nxml-glyph.el +++ b/lisp/nxml/nxml-glyph.el | |||
| @@ -271,7 +271,7 @@ This repertoire is supported for the following fonts: | |||
| 271 | "Glyph set for TARGET3 glyph repertoire of the misc-fixed-* fonts. | 271 | "Glyph set for TARGET3 glyph repertoire of the misc-fixed-* fonts. |
| 272 | This repertoire is supported for the following fonts: | 272 | This repertoire is supported for the following fonts: |
| 273 | 6x13.bdf 8x13.bdf 9x15.bdf 9x18.bdf 10x20.bdf") | 273 | 6x13.bdf 8x13.bdf 9x15.bdf 9x18.bdf 10x20.bdf") |
| 274 | 274 | ||
| 275 | (defconst nxml-wgl4-glyph-set | 275 | (defconst nxml-wgl4-glyph-set |
| 276 | [(#x0020 . #x007E) | 276 | [(#x0020 . #x007E) |
| 277 | (#x00A0 . #x017F) | 277 | (#x00A0 . #x017F) |
| @@ -334,14 +334,14 @@ This repertoire is supported for the following fonts: | |||
| 334 | 334 | ||
| 335 | (defvar nxml-glyph-set-hook nil | 335 | (defvar nxml-glyph-set-hook nil |
| 336 | "*Hook for determining the set of glyphs in a face. | 336 | "*Hook for determining the set of glyphs in a face. |
| 337 | The hook will receive a single argument FACE. If it can determine the | 337 | The hook will receive a single argument FACE. If it can determine |
| 338 | set of glyphs representable by FACE, it must set the variable | 338 | the set of glyphs representable by FACE, it must set the variable |
| 339 | `nxml-glyph-set' and return non-nil. Otherwise, it must return | 339 | `nxml-glyph-set' and return non-nil. Otherwise, it must return nil. |
| 340 | nil. The hook will be run until success. The constants | 340 | The hook will be run until success. The constants |
| 341 | `nxml-ascii-glyph-set', `nxml-latin1-glyph-set', | 341 | `nxml-ascii-glyph-set', `nxml-latin1-glyph-set', |
| 342 | `nxml-misc-fixed-1-glyph-set', `nxml-misc-fixed-2-glyph-set', | 342 | `nxml-misc-fixed-1-glyph-set', `nxml-misc-fixed-2-glyph-set', |
| 343 | `nxml-misc-fixed-3-glyph-set' and `nxml-wgl4-glyph-set' are predefined | 343 | `nxml-misc-fixed-3-glyph-set' and `nxml-wgl4-glyph-set' are |
| 344 | for use by `nxml-glyph-set-hook'.") | 344 | predefined for use by `nxml-glyph-set-hook'.") |
| 345 | 345 | ||
| 346 | (defvar nxml-glyph-set nil | 346 | (defvar nxml-glyph-set nil |
| 347 | "Used by `nxml-glyph-set-hook' to return set of glyphs in a FACE. | 347 | "Used by `nxml-glyph-set-hook' to return set of glyphs in a FACE. |
| @@ -386,7 +386,7 @@ Return nil if the face cannot display a glyph for N." | |||
| 386 | (nxml-glyph-set-contains-p n nxml-glyph-set) | 386 | (nxml-glyph-set-contains-p n nxml-glyph-set) |
| 387 | (let ((ch (decode-char 'ucs n))) | 387 | (let ((ch (decode-char 'ucs n))) |
| 388 | (and ch (string ch)))))) | 388 | (and ch (string ch)))))) |
| 389 | 389 | ||
| 390 | (defun nxml-glyph-set-contains-p (n v) | 390 | (defun nxml-glyph-set-contains-p (n v) |
| 391 | (let ((start 0) | 391 | (let ((start 0) |
| 392 | (end (length v)) | 392 | (end (length v)) |
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index e4fa008f9aa..49dcaecaab5 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el | |||
| @@ -44,7 +44,7 @@ | |||
| 44 | ;;; Customization | 44 | ;;; Customization |
| 45 | 45 | ||
| 46 | (defgroup nxml nil | 46 | (defgroup nxml nil |
| 47 | "New XML editing mode" | 47 | "New XML editing mode." |
| 48 | :group 'languages | 48 | :group 'languages |
| 49 | :group 'wp) | 49 | :group 'wp) |
| 50 | 50 | ||
| @@ -86,9 +86,9 @@ nothing else other than that start-tag." | |||
| 86 | 86 | ||
| 87 | (defcustom nxml-attribute-indent 4 | 87 | (defcustom nxml-attribute-indent 4 |
| 88 | "*Indentation for the attributes of an element relative to the start-tag. | 88 | "*Indentation for the attributes of an element relative to the start-tag. |
| 89 | This only applies when the first attribute of a tag starts a line. In other | 89 | This only applies when the first attribute of a tag starts a line. |
| 90 | cases, the first attribute on one line is indented the same as the first | 90 | In other cases, the first attribute on one line is indented the same |
| 91 | attribute on the previous line." | 91 | as the first attribute on the previous line." |
| 92 | :group 'nxml | 92 | :group 'nxml |
| 93 | :type 'integer) | 93 | :type 'integer) |
| 94 | 94 | ||
| @@ -97,7 +97,7 @@ attribute on the previous line." | |||
| 97 | C-return will be bound to `nxml-complete' in any case. | 97 | C-return will be bound to `nxml-complete' in any case. |
| 98 | M-TAB gets swallowed by many window systems/managers, and | 98 | M-TAB gets swallowed by many window systems/managers, and |
| 99 | `documentation' will show M-TAB rather than C-return as the | 99 | `documentation' will show M-TAB rather than C-return as the |
| 100 | binding `rng-complete' when both are bound. So it's better | 100 | binding for `nxml-complete' when both are bound. So it's better |
| 101 | to bind M-TAB only when it will work." | 101 | to bind M-TAB only when it will work." |
| 102 | :group 'nxml | 102 | :group 'nxml |
| 103 | :set (lambda (sym flag) | 103 | :set (lambda (sym flag) |
| @@ -125,7 +125,7 @@ and when the encoding declaration specifies `UTF-16'." | |||
| 125 | 125 | ||
| 126 | (defcustom nxml-default-buffer-file-coding-system nil | 126 | (defcustom nxml-default-buffer-file-coding-system nil |
| 127 | "*Default value for `buffer-file-coding-system' for a buffer for a new file. | 127 | "*Default value for `buffer-file-coding-system' for a buffer for a new file. |
| 128 | Nil means use the default value of `buffer-file-coding-system' as normal. | 128 | A value of nil means use the default value of `buffer-file-coding-system' as normal. |
| 129 | A buffer's `buffer-file-coding-system' affects what \\[nxml-insert-xml-declaration] inserts." | 129 | A buffer's `buffer-file-coding-system' affects what \\[nxml-insert-xml-declaration] inserts." |
| 130 | :group 'nxml | 130 | :group 'nxml |
| 131 | :type 'coding-system) | 131 | :type 'coding-system) |
| @@ -263,7 +263,7 @@ This includes ths `x' in hex references." | |||
| 263 | '((t (:inherit nxml-delimiter))) | 263 | '((t (:inherit nxml-delimiter))) |
| 264 | "Face used for the colon in attribute names." | 264 | "Face used for the colon in attribute names." |
| 265 | :group 'nxml-faces) | 265 | :group 'nxml-faces) |
| 266 | 266 | ||
| 267 | (defface nxml-attribute-local-name | 267 | (defface nxml-attribute-local-name |
| 268 | '((t (:inherit font-lock-variable-name-face))) | 268 | '((t (:inherit font-lock-variable-name-face))) |
| 269 | "Face used for the local name of attributes." | 269 | "Face used for the local name of attributes." |
| @@ -339,7 +339,7 @@ The delimiters are <! and >." | |||
| 339 | :foreground | 339 | :foreground |
| 340 | "black" | 340 | "black" |
| 341 | :weight | 341 | :weight |
| 342 | normal | 342 | normal |
| 343 | :slant | 343 | :slant |
| 344 | normal)) | 344 | normal)) |
| 345 | (t | 345 | (t |
| @@ -348,7 +348,7 @@ The delimiters are <! and >." | |||
| 348 | :foreground | 348 | :foreground |
| 349 | "black" | 349 | "black" |
| 350 | :weight | 350 | :weight |
| 351 | normal | 351 | normal |
| 352 | :slant | 352 | :slant |
| 353 | normal))) | 353 | normal))) |
| 354 | "Face used for glyph for char references." | 354 | "Face used for glyph for char references." |
| @@ -363,7 +363,7 @@ See the function `xmltok-forward-prolog' for more information.") | |||
| 363 | 363 | ||
| 364 | (defvar nxml-last-fontify-end nil | 364 | (defvar nxml-last-fontify-end nil |
| 365 | "Position where fontification last ended. | 365 | "Position where fontification last ended. |
| 366 | Nil if the buffer changed since the last fontification.") | 366 | It is nil if the buffer changed since the last fontification.") |
| 367 | (make-variable-buffer-local 'nxml-last-fontify-end) | 367 | (make-variable-buffer-local 'nxml-last-fontify-end) |
| 368 | 368 | ||
| 369 | (defvar nxml-degraded nil | 369 | (defvar nxml-degraded nil |
| @@ -416,7 +416,7 @@ reference.") | |||
| 416 | (define-key map "\C-c\C-o" nxml-outline-prefix-map) | 416 | (define-key map "\C-c\C-o" nxml-outline-prefix-map) |
| 417 | (define-key map [S-mouse-2] 'nxml-mouse-hide-direct-text-content) | 417 | (define-key map [S-mouse-2] 'nxml-mouse-hide-direct-text-content) |
| 418 | (define-key map "/" 'nxml-electric-slash) | 418 | (define-key map "/" 'nxml-electric-slash) |
| 419 | (define-key map [C-return] 'nxml-complete) | 419 | (define-key map [C-return] 'nxml-complete) |
| 420 | (when nxml-bind-meta-tab-to-complete-flag | 420 | (when nxml-bind-meta-tab-to-complete-flag |
| 421 | (define-key map "\M-\t" 'nxml-complete)) | 421 | (define-key map "\M-\t" 'nxml-complete)) |
| 422 | map) | 422 | map) |
| @@ -439,7 +439,7 @@ reference.") | |||
| 439 | 439 | ||
| 440 | \\[nxml-finish-element] finishes the current element by inserting an end-tag. | 440 | \\[nxml-finish-element] finishes the current element by inserting an end-tag. |
| 441 | C-c C-i closes a start-tag with `>' and then inserts a balancing end-tag | 441 | C-c C-i closes a start-tag with `>' and then inserts a balancing end-tag |
| 442 | leaving point between the start-tag and end-tag. | 442 | leaving point between the start-tag and end-tag. |
| 443 | \\[nxml-balanced-close-start-tag-block] is similar but for block rather than inline elements: | 443 | \\[nxml-balanced-close-start-tag-block] is similar but for block rather than inline elements: |
| 444 | the start-tag, point, and end-tag are all left on separate lines. | 444 | the start-tag, point, and end-tag are all left on separate lines. |
| 445 | If `nxml-slash-auto-complete-flag' is non-nil, then inserting a `</' | 445 | If `nxml-slash-auto-complete-flag' is non-nil, then inserting a `</' |
| @@ -459,8 +459,8 @@ instead of C-c. | |||
| 459 | Validation is provided by the related minor-mode `rng-validate-mode'. | 459 | Validation is provided by the related minor-mode `rng-validate-mode'. |
| 460 | This also makes completion schema- and context- sensitive. Element | 460 | This also makes completion schema- and context- sensitive. Element |
| 461 | names, attribute names, attribute values and namespace URIs can all be | 461 | names, attribute names, attribute values and namespace URIs can all be |
| 462 | completed. By default, `rng-validate-mode' is automatically enabled. You | 462 | completed. By default, `rng-validate-mode' is automatically enabled. |
| 463 | can toggle it using \\[rng-validate-mode] or change the default by | 463 | You can toggle it using \\[rng-validate-mode] or change the default by |
| 464 | customizing `rng-nxml-auto-validate-flag'. | 464 | customizing `rng-nxml-auto-validate-flag'. |
| 465 | 465 | ||
| 466 | \\[indent-for-tab-command] indents the current line appropriately. | 466 | \\[indent-for-tab-command] indents the current line appropriately. |
| @@ -468,8 +468,8 @@ This can be customized using the variable `nxml-child-indent' | |||
| 468 | and the variable `nxml-attribute-indent'. | 468 | and the variable `nxml-attribute-indent'. |
| 469 | 469 | ||
| 470 | \\[nxml-insert-named-char] inserts a character reference using | 470 | \\[nxml-insert-named-char] inserts a character reference using |
| 471 | the character's name (by default, the Unicode name). \\[universal-argument] \\[nxml-insert-named-char] | 471 | the character's name (by default, the Unicode name). |
| 472 | inserts the character directly. | 472 | \\[universal-argument] \\[nxml-insert-named-char] inserts the character directly. |
| 473 | 473 | ||
| 474 | The Emacs commands that normally operate on balanced expressions will | 474 | The Emacs commands that normally operate on balanced expressions will |
| 475 | operate on XML markup items. Thus \\[forward-sexp] will move forward | 475 | operate on XML markup items. Thus \\[forward-sexp] will move forward |
| @@ -609,10 +609,10 @@ Many aspects this mode can be customized using | |||
| 609 | start end pre-change-length))))))))) | 609 | start end pre-change-length))))))))) |
| 610 | 610 | ||
| 611 | (defun nxml-after-change1 (start end pre-change-length) | 611 | (defun nxml-after-change1 (start end pre-change-length) |
| 612 | "After-change bookkeeping. Returns a cons cell containing a | 612 | "After-change bookkeeping. |
| 613 | possibly-enlarged change region. You must call | 613 | Returns a cons cell containing a possibly-enlarged change region. |
| 614 | nxml-extend-region on this expanded region to obtain the full | 614 | You must call `nxml-extend-region' on this expanded region to obtain |
| 615 | extent of the area needing refontification. | 615 | the full extent of the area needing refontification. |
| 616 | 616 | ||
| 617 | For bookkeeping, call this function even when fontification is | 617 | For bookkeeping, call this function even when fontification is |
| 618 | disabled." | 618 | disabled." |
| @@ -800,7 +800,7 @@ The XML declaration will declare an encoding depending on the buffer's | |||
| 800 | (setq suitable-coding-systems (cdr suitable-coding-systems)))) | 800 | (setq suitable-coding-systems (cdr suitable-coding-systems)))) |
| 801 | ret))) | 801 | ret))) |
| 802 | 802 | ||
| 803 | (defun nxml-choose-utf-coding-system () | 803 | (defun nxml-choose-utf-coding-system () |
| 804 | (let ((cur (and (local-variable-p 'buffer-file-coding-system) | 804 | (let ((cur (and (local-variable-p 'buffer-file-coding-system) |
| 805 | buffer-file-coding-system | 805 | buffer-file-coding-system |
| 806 | (coding-system-base buffer-file-coding-system)))) | 806 | (coding-system-base buffer-file-coding-system)))) |
| @@ -840,7 +840,7 @@ The XML declaration will declare an encoding depending on the buffer's | |||
| 840 | (defvar font-lock-beg) (defvar font-lock-end) | 840 | (defvar font-lock-beg) (defvar font-lock-end) |
| 841 | (defun nxml-extend-region () | 841 | (defun nxml-extend-region () |
| 842 | "Extend the region to hold the minimum area we can fontify with nXML. | 842 | "Extend the region to hold the minimum area we can fontify with nXML. |
| 843 | Called with font-lock-beg and font-lock-end dynamically bound." | 843 | Called with `font-lock-beg' and `font-lock-end' dynamically bound." |
| 844 | (let ((start font-lock-beg) | 844 | (let ((start font-lock-beg) |
| 845 | (end font-lock-end)) | 845 | (end font-lock-end)) |
| 846 | 846 | ||
| @@ -1278,7 +1278,7 @@ No extra whitespace is inserted." | |||
| 1278 | (insert "\n") | 1278 | (insert "\n") |
| 1279 | (indent-line-to (+ nxml-child-indent indent))) | 1279 | (indent-line-to (+ nxml-child-indent indent))) |
| 1280 | (goto-char pos))))) | 1280 | (goto-char pos))))) |
| 1281 | 1281 | ||
| 1282 | (defun nxml-finish-element () | 1282 | (defun nxml-finish-element () |
| 1283 | "Finish the current element by inserting an end-tag." | 1283 | "Finish the current element by inserting an end-tag." |
| 1284 | (interactive "*") | 1284 | (interactive "*") |
| @@ -1480,8 +1480,8 @@ its line. Otherwise return nil." | |||
| 1480 | (defun nxml-merge-indent-context-type (context) | 1480 | (defun nxml-merge-indent-context-type (context) |
| 1481 | "Merge the indent context type CONTEXT with the token in `xmltok-type'. | 1481 | "Merge the indent context type CONTEXT with the token in `xmltok-type'. |
| 1482 | Return the merged indent context type. An indent context type is | 1482 | Return the merged indent context type. An indent context type is |
| 1483 | either nil or one of the symbols start-tag, end-tag, markup, comment, | 1483 | either nil or one of the symbols `start-tag', `end-tag', `markup', |
| 1484 | mixed." | 1484 | `comment', `mixed'." |
| 1485 | (cond ((memq xmltok-type '(start-tag partial-start-tag)) | 1485 | (cond ((memq xmltok-type '(start-tag partial-start-tag)) |
| 1486 | (if (memq context '(nil start-tag comment)) | 1486 | (if (memq context '(nil start-tag comment)) |
| 1487 | 'start-tag | 1487 | 'start-tag |
| @@ -1573,7 +1573,7 @@ xmltok-* variables to be set up as by `xmltok-forward'." | |||
| 1573 | (setq atts nil)) | 1573 | (setq atts nil)) |
| 1574 | (t (setq atts (cdr atts))))) | 1574 | (t (setq atts (cdr atts))))) |
| 1575 | value-boundary)) | 1575 | value-boundary)) |
| 1576 | 1576 | ||
| 1577 | (defun nxml-compute-indent-in-delimited-token (pos open-delim close-delim) | 1577 | (defun nxml-compute-indent-in-delimited-token (pos open-delim close-delim) |
| 1578 | "Return the indent for a line that starts inside a token with delimiters. | 1578 | "Return the indent for a line that starts inside a token with delimiters. |
| 1579 | OPEN-DELIM and CLOSE-DELIM are strings giving the opening and closing | 1579 | OPEN-DELIM and CLOSE-DELIM are strings giving the opening and closing |
| @@ -1604,7 +1604,7 @@ of the line. This expects the xmltok-* variables to be set up as by | |||
| 1604 | Inserts as many characters as can be completed. However, if not even | 1604 | Inserts as many characters as can be completed. However, if not even |
| 1605 | one character can be completed, then a buffer with the possibilities | 1605 | one character can be completed, then a buffer with the possibilities |
| 1606 | is popped up and the symbol is read from the minibuffer with | 1606 | is popped up and the symbol is read from the minibuffer with |
| 1607 | completion. If the symbol is complete, then any characters that must | 1607 | completion. If the symbol is complete, then any characters that must |
| 1608 | follow the symbol are also inserted. | 1608 | follow the symbol are also inserted. |
| 1609 | 1609 | ||
| 1610 | The name space used for completion and what is treated as a symbol | 1610 | The name space used for completion and what is treated as a symbol |
| @@ -1626,11 +1626,11 @@ This is the equivalent of `forward-sexp' for XML. | |||
| 1626 | 1626 | ||
| 1627 | An element contains as items strings with no markup, tags, processing | 1627 | An element contains as items strings with no markup, tags, processing |
| 1628 | instructions, comments, CDATA sections, entity references and | 1628 | instructions, comments, CDATA sections, entity references and |
| 1629 | characters references. However, if the variable | 1629 | characters references. However, if the variable |
| 1630 | `nxml-sexp-element-flag' is non-nil, then an element is treated as a | 1630 | `nxml-sexp-element-flag' is non-nil, then an element is treated as a |
| 1631 | single markup item. A start-tag contains an element name followed by | 1631 | single markup item. A start-tag contains an element name followed by |
| 1632 | one or more attributes. An end-tag contains just an element name. An | 1632 | one or more attributes. An end-tag contains just an element name. |
| 1633 | attribute value literals contains strings with no markup, entity | 1633 | An attribute value literals contains strings with no markup, entity |
| 1634 | references and character references. A processing instruction | 1634 | references and character references. A processing instruction |
| 1635 | consists of a target and a content string. A comment or a CDATA | 1635 | consists of a target and a content string. A comment or a CDATA |
| 1636 | section contains a single string. An entity reference contains a | 1636 | section contains a single string. An entity reference contains a |
| @@ -2130,7 +2130,7 @@ HAD-DATA says whether there have been non-whitespace data characters yet." | |||
| 2130 | (goto-char (+ xmltok-start offset)) | 2130 | (goto-char (+ xmltok-start offset)) |
| 2131 | (and (re-search-forward "^[ \t]*$" end t) | 2131 | (and (re-search-forward "^[ \t]*$" end t) |
| 2132 | (match-beginning 0))))) | 2132 | (match-beginning 0))))) |
| 2133 | ((and (memq xmltok-type '(start-tag | 2133 | ((and (memq xmltok-type '(start-tag |
| 2134 | end-tag | 2134 | end-tag |
| 2135 | empty-element | 2135 | empty-element |
| 2136 | comment | 2136 | comment |
| @@ -2146,7 +2146,7 @@ HAD-DATA says whether there have been non-whitespace data characters yet." | |||
| 2146 | (looking-at "[ \t]*$") | 2146 | (looking-at "[ \t]*$") |
| 2147 | (not (nxml-in-mixed-content-p t))) | 2147 | (not (nxml-in-mixed-content-p t))) |
| 2148 | (save-excursion | 2148 | (save-excursion |
| 2149 | (or (search-forward "\n" nil t) | 2149 | (or (search-forward "\n" nil t) |
| 2150 | (point-max)))))) | 2150 | (point-max)))))) |
| 2151 | 2151 | ||
| 2152 | (defun nxml-paragraph-start-pos (had-data offset) | 2152 | (defun nxml-paragraph-start-pos (had-data offset) |
| @@ -2186,7 +2186,7 @@ HAD-DATA says whether there have been non-whitespace data characters yet." | |||
| 2186 | (goto-char (- (point) offset)) | 2186 | (goto-char (- (point) offset)) |
| 2187 | (and (re-search-backward "^[ \t]*$" xmltok-start t) | 2187 | (and (re-search-backward "^[ \t]*$" xmltok-start t) |
| 2188 | (match-beginning 0)))) | 2188 | (match-beginning 0)))) |
| 2189 | ((and (memq xmltok-type '(start-tag | 2189 | ((and (memq xmltok-type '(start-tag |
| 2190 | end-tag | 2190 | end-tag |
| 2191 | empty-element | 2191 | empty-element |
| 2192 | comment | 2192 | comment |
| @@ -2194,7 +2194,7 @@ HAD-DATA says whether there have been non-whitespace data characters yet." | |||
| 2194 | entity-ref)) | 2194 | entity-ref)) |
| 2195 | (nxml-token-ends-line-p) | 2195 | (nxml-token-ends-line-p) |
| 2196 | (nxml-token-begins-line-p)) | 2196 | (nxml-token-begins-line-p)) |
| 2197 | (or (search-forward "\n" nil t) | 2197 | (or (search-forward "\n" nil t) |
| 2198 | (point-max))) | 2198 | (point-max))) |
| 2199 | ((and (eq xmltok-type 'start-tag) | 2199 | ((and (eq xmltok-type 'start-tag) |
| 2200 | (nxml-token-begins-line-p) | 2200 | (nxml-token-begins-line-p) |
| @@ -2334,7 +2334,7 @@ ENDP is t in the former case, nil in the latter." | |||
| 2334 | (fill-region-as-paragraph start end arg)) | 2334 | (fill-region-as-paragraph start end arg)) |
| 2335 | (skip-line-prefix fill-prefix) | 2335 | (skip-line-prefix fill-prefix) |
| 2336 | fill-prefix)) | 2336 | fill-prefix)) |
| 2337 | 2337 | ||
| 2338 | (defun nxml-newline-and-indent (soft) | 2338 | (defun nxml-newline-and-indent (soft) |
| 2339 | (delete-horizontal-space) | 2339 | (delete-horizontal-space) |
| 2340 | (if soft (insert-and-inherit ?\n) (newline 1)) | 2340 | (if soft (insert-and-inherit ?\n) (newline 1)) |
| @@ -2356,10 +2356,10 @@ point. The start-tag will be inserted at or before the beginning of | |||
| 2356 | the word before point; the contents of the current buffer is used to | 2356 | the word before point; the contents of the current buffer is used to |
| 2357 | decide where. | 2357 | decide where. |
| 2358 | 2358 | ||
| 2359 | It works in a similar way to \\[dabbrev-expand]. It searches first | 2359 | It works in a similar way to \\[dabbrev-expand]. It searches first |
| 2360 | backwards from point, then forwards from point for an element whose | 2360 | backwards from point, then forwards from point for an element whose |
| 2361 | content is a string which matches the contents of the buffer before | 2361 | content is a string which matches the contents of the buffer before |
| 2362 | point and which includes at least the word before point. It then | 2362 | point and which includes at least the word before point. It then |
| 2363 | copies the start- and end-tags from that element and uses them to | 2363 | copies the start- and end-tags from that element and uses them to |
| 2364 | surround the matching string before point. | 2364 | surround the matching string before point. |
| 2365 | 2365 | ||
| @@ -2465,7 +2465,7 @@ and attempts to find another possible way to do the markup." | |||
| 2465 | (- start-tag-close-pos xmltok-start))) | 2465 | (- start-tag-close-pos xmltok-start))) |
| 2466 | (insert "</" name ">") | 2466 | (insert "</" name ">") |
| 2467 | (setq nxml-dynamic-markup-prev-pos (point)))))))))) | 2467 | (setq nxml-dynamic-markup-prev-pos (point)))))))))) |
| 2468 | 2468 | ||
| 2469 | 2469 | ||
| 2470 | ;;; Character names | 2470 | ;;; Character names |
| 2471 | 2471 | ||
| @@ -2494,10 +2494,10 @@ and NAME is a string naming a character.") | |||
| 2494 | (defvar nxml-autoload-char-name-set-list nil | 2494 | (defvar nxml-autoload-char-name-set-list nil |
| 2495 | "List of char namesets that can be autoloaded.") | 2495 | "List of char namesets that can be autoloaded.") |
| 2496 | 2496 | ||
| 2497 | (defun nxml-enable-char-name-set (nameset) | 2497 | (defun nxml-enable-char-name-set (nameset) |
| 2498 | (put nameset 'nxml-char-name-set-enabled t)) | 2498 | (put nameset 'nxml-char-name-set-enabled t)) |
| 2499 | 2499 | ||
| 2500 | (defun nxml-disable-char-name-set (nameset) | 2500 | (defun nxml-disable-char-name-set (nameset) |
| 2501 | (put nameset 'nxml-char-name-set-enabled nil)) | 2501 | (put nameset 'nxml-char-name-set-enabled nil)) |
| 2502 | 2502 | ||
| 2503 | (defun nxml-char-name-set-enabled-p (nameset) | 2503 | (defun nxml-char-name-set-enabled-p (nameset) |
| @@ -2512,9 +2512,9 @@ and NAME is a string naming a character.") | |||
| 2512 | (defun nxml-define-char-name-set (nameset alist) | 2512 | (defun nxml-define-char-name-set (nameset alist) |
| 2513 | "Define a set of character names. | 2513 | "Define a set of character names. |
| 2514 | NAMESET is a symbol identifying the set. | 2514 | NAMESET is a symbol identifying the set. |
| 2515 | Alist is a list where each member has the form (NAME CODE), | 2515 | ALIST is a list where each member has the form (NAME CODE), |
| 2516 | where NAME is a string naming a character and code | 2516 | where NAME is a string naming a character and code is an |
| 2517 | is an integer giving the Unicode scalar value of the character." | 2517 | integer giving the Unicode scalar value of the character." |
| 2518 | (when (get nameset 'nxml-char-name-set-defined) | 2518 | (when (get nameset 'nxml-char-name-set-defined) |
| 2519 | (error "Nameset `%s' already defined" nameset)) | 2519 | (error "Nameset `%s' already defined" nameset)) |
| 2520 | (let ((iter alist)) | 2520 | (let ((iter alist)) |
| @@ -2573,7 +2573,7 @@ With a prefix argument, inserts the character directly." | |||
| 2573 | (error "Character %x is not supported by Emacs" | 2573 | (error "Character %x is not supported by Emacs" |
| 2574 | code)) | 2574 | code)) |
| 2575 | (format "&#x%X;" code)))))) | 2575 | (format "&#x%X;" code)))))) |
| 2576 | 2576 | ||
| 2577 | (defun nxml-maybe-load-char-name-set (sym) | 2577 | (defun nxml-maybe-load-char-name-set (sym) |
| 2578 | (when (and (get sym 'nxml-char-name-set-enabled) | 2578 | (when (and (get sym 'nxml-char-name-set-enabled) |
| 2579 | (not (get sym 'nxml-char-name-set-defined)) | 2579 | (not (get sym 'nxml-char-name-set-defined)) |
| @@ -2581,7 +2581,7 @@ With a prefix argument, inserts the character directly." | |||
| 2581 | (load (get sym 'nxml-char-name-set-file)))) | 2581 | (load (get sym 'nxml-char-name-set-file)))) |
| 2582 | 2582 | ||
| 2583 | (defun nxml-toggle-char-ref-extra-display (arg) | 2583 | (defun nxml-toggle-char-ref-extra-display (arg) |
| 2584 | "*Toggle the display of extra information for character references." | 2584 | "Toggle the display of extra information for character references." |
| 2585 | (interactive "P") | 2585 | (interactive "P") |
| 2586 | (let ((new (if (null arg) | 2586 | (let ((new (if (null arg) |
| 2587 | (not nxml-char-ref-extra-display) | 2587 | (not nxml-char-ref-extra-display) |
| @@ -2619,7 +2619,7 @@ With a prefix argument, inserts the character directly." | |||
| 2619 | (defun nxml-start-delimiter-length (type) | 2619 | (defun nxml-start-delimiter-length (type) |
| 2620 | (or (get type 'nxml-start-delimiter-length) | 2620 | (or (get type 'nxml-start-delimiter-length) |
| 2621 | 0)) | 2621 | 0)) |
| 2622 | 2622 | ||
| 2623 | (put 'cdata-section 'nxml-start-delimiter-length 9) | 2623 | (put 'cdata-section 'nxml-start-delimiter-length 9) |
| 2624 | (put 'comment 'nxml-start-delimiter-length 4) | 2624 | (put 'comment 'nxml-start-delimiter-length 4) |
| 2625 | (put 'processing-instruction 'nxml-start-delimiter-length 2) | 2625 | (put 'processing-instruction 'nxml-start-delimiter-length 2) |
| @@ -2632,7 +2632,7 @@ With a prefix argument, inserts the character directly." | |||
| 2632 | (defun nxml-end-delimiter-length (type) | 2632 | (defun nxml-end-delimiter-length (type) |
| 2633 | (or (get type 'nxml-end-delimiter-length) | 2633 | (or (get type 'nxml-end-delimiter-length) |
| 2634 | 0)) | 2634 | 0)) |
| 2635 | 2635 | ||
| 2636 | (put 'cdata-section 'nxml-end-delimiter-length 3) | 2636 | (put 'cdata-section 'nxml-end-delimiter-length 3) |
| 2637 | (put 'comment 'nxml-end-delimiter-length 3) | 2637 | (put 'comment 'nxml-end-delimiter-length 3) |
| 2638 | (put 'processing-instruction 'nxml-end-delimiter-length 2) | 2638 | (put 'processing-instruction 'nxml-end-delimiter-length 2) |
diff --git a/lisp/nxml/nxml-ns.el b/lisp/nxml/nxml-ns.el index 1c7068faf21..2eca2f46a00 100644 --- a/lisp/nxml/nxml-ns.el +++ b/lisp/nxml/nxml-ns.el | |||
| @@ -29,22 +29,22 @@ | |||
| 29 | (require 'nxml-util) | 29 | (require 'nxml-util) |
| 30 | 30 | ||
| 31 | (defvar nxml-ns-state nil | 31 | (defvar nxml-ns-state nil |
| 32 | "Contains the state of namespace processing. The state | 32 | "Contains the state of namespace processing. |
| 33 | is never modified destructively and so can be saved and restored | 33 | The state is never modified destructively and so can be saved and |
| 34 | without copying. | 34 | restored without copying. |
| 35 | 35 | ||
| 36 | The value is a stack represented by a list. The list has length N + 1 | 36 | The value is a stack represented by a list. The list has length |
| 37 | where N is the number of open elements. Each member of the list | 37 | N + 1 where N is the number of open elements. Each member of the |
| 38 | represents the bindings in effect for a particular element. Each | 38 | list represents the bindings in effect for a particular element. |
| 39 | member is itself a list whose car is the default namespace | 39 | Each member is itself a list whose car is the default namespace |
| 40 | \(a symbol or nil) and whose cdr is an alist of (PREFIX . NS) pairs | 40 | \(a symbol or nil) and whose cdr is an alist of (PREFIX . NS) pairs |
| 41 | where PREFIX is a string (never nil) and NS is the namespace URI | 41 | where PREFIX is a string (never nil) and NS is the namespace URI |
| 42 | symbol.") | 42 | symbol.") |
| 43 | 43 | ||
| 44 | (defconst nxml-ns-initial-state | 44 | (defconst nxml-ns-initial-state |
| 45 | (list (list nil (cons "xml" nxml-xml-namespace-uri))) | 45 | (list (list nil (cons "xml" nxml-xml-namespace-uri))) |
| 46 | "A list to be used as the initial value of nxml-ns-state. This | 46 | "A list to be used as the initial value of `nxml-ns-state'. |
| 47 | represents the state with no open elements and with the default | 47 | This represents the state with no open elements and with the default |
| 48 | namespace bindings (no default namespace and only the xml prefix bound).") | 48 | namespace bindings (no default namespace and only the xml prefix bound).") |
| 49 | 49 | ||
| 50 | (defsubst nxml-ns-state () nxml-ns-state) | 50 | (defsubst nxml-ns-state () nxml-ns-state) |
| @@ -66,25 +66,25 @@ namespace bindings (no default namespace and only the xml prefix bound).") | |||
| 66 | (setq nxml-ns-state nxml-ns-initial-state)) | 66 | (setq nxml-ns-state nxml-ns-initial-state)) |
| 67 | 67 | ||
| 68 | (defun nxml-ns-push-state () | 68 | (defun nxml-ns-push-state () |
| 69 | "Change the state by starting a new element. Namespace declarations | 69 | "Change the state by starting a new element. |
| 70 | are inherited from the parent state." | 70 | Namespace declarations are inherited from the parent state." |
| 71 | (setq nxml-ns-state (cons (car nxml-ns-state) nxml-ns-state))) | 71 | (setq nxml-ns-state (cons (car nxml-ns-state) nxml-ns-state))) |
| 72 | 72 | ||
| 73 | (defun nxml-ns-pop-state () | 73 | (defun nxml-ns-pop-state () |
| 74 | "Change the state by ending an element. The behavior is undefined | 74 | "Change the state by ending an element. |
| 75 | if there is no open element." | 75 | The behavior is undefined if there is no open element." |
| 76 | (setq nxml-ns-state (cdr nxml-ns-state))) | 76 | (setq nxml-ns-state (cdr nxml-ns-state))) |
| 77 | 77 | ||
| 78 | (defun nxml-ns-get-prefix (prefix) | 78 | (defun nxml-ns-get-prefix (prefix) |
| 79 | "Return the symbol for namespace bound to PREFIX, or nil if PREFIX | 79 | "Return the symbol for namespace bound to PREFIX. |
| 80 | is unbound. PREFIX is a string, never nil." | 80 | Return nil if PREFIX is unbound. PREFIX is a string, never nil." |
| 81 | (let ((binding (assoc prefix (cdar nxml-ns-state)))) | 81 | (let ((binding (assoc prefix (cdar nxml-ns-state)))) |
| 82 | (and binding (cdr binding)))) | 82 | (and binding (cdr binding)))) |
| 83 | 83 | ||
| 84 | (defun nxml-ns-set-prefix (prefix ns) | 84 | (defun nxml-ns-set-prefix (prefix ns) |
| 85 | "Change the binding of PREFIX. PREFIX is a string (never nil). NS | 85 | "Change the binding of PREFIX. |
| 86 | is a symbol (never nil). The change will be in effect until the end of | 86 | PREFIX is a string (never nil). NS is a symbol (never nil). |
| 87 | the current element." | 87 | The change will be in effect until the end of the current element." |
| 88 | (setq nxml-ns-state | 88 | (setq nxml-ns-state |
| 89 | (let ((bindings (car nxml-ns-state))) | 89 | (let ((bindings (car nxml-ns-state))) |
| 90 | (cons (cons (car bindings) | 90 | (cons (cons (car bindings) |
| @@ -92,13 +92,13 @@ the current element." | |||
| 92 | (cdr nxml-ns-state))))) | 92 | (cdr nxml-ns-state))))) |
| 93 | 93 | ||
| 94 | (defun nxml-ns-get-default () | 94 | (defun nxml-ns-get-default () |
| 95 | "Return the current default namespace as a symbol, or nil | 95 | "Return the current default namespace as a symbol. |
| 96 | if there is no default namespace." | 96 | Return nil if there is no default namespace." |
| 97 | (caar nxml-ns-state)) | 97 | (caar nxml-ns-state)) |
| 98 | 98 | ||
| 99 | (defun nxml-ns-set-default (ns) | 99 | (defun nxml-ns-set-default (ns) |
| 100 | "Changes the current default namespace. The change | 100 | "Changes the current default namespace. |
| 101 | will be in effect until the end of the current element. | 101 | The change will be in effect until the end of the current element. |
| 102 | NS is a symbol or nil." | 102 | NS is a symbol or nil." |
| 103 | (setq nxml-ns-state | 103 | (setq nxml-ns-state |
| 104 | (cons (cons ns (cdar nxml-ns-state)) | 104 | (cons (cons ns (cdar nxml-ns-state)) |
| @@ -142,7 +142,7 @@ NS is a symbol or nil." | |||
| 142 | (cons (caar new) changed)) | 142 | (cons (caar new) changed)) |
| 143 | (setq new (cdr new)))) | 143 | (setq new (cdr new)))) |
| 144 | changed)) | 144 | changed)) |
| 145 | 145 | ||
| 146 | (provide 'nxml-ns) | 146 | (provide 'nxml-ns) |
| 147 | 147 | ||
| 148 | ;; arch-tag: 5968e4b7-fb37-46ce-8621-c65db9793028 | 148 | ;; arch-tag: 5968e4b7-fb37-46ce-8621-c65db9793028 |
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el index 2888737e54e..8ce9769b255 100644 --- a/lisp/nxml/nxml-outln.el +++ b/lisp/nxml/nxml-outln.el | |||
| @@ -161,7 +161,7 @@ See the variable `nxml-section-element-name-regexp' for more details." | |||
| 161 | (defun nxml-hide-all-text-content () | 161 | (defun nxml-hide-all-text-content () |
| 162 | "Hide all text content in the buffer. | 162 | "Hide all text content in the buffer. |
| 163 | Anything that is in a section but is not a heading will be hidden. | 163 | Anything that is in a section but is not a heading will be hidden. |
| 164 | The visibility of headings at any level will not be changed. See the | 164 | The visibility of headings at any level will not be changed. See the |
| 165 | variable `nxml-section-element-name-regexp' for more details on how to | 165 | variable `nxml-section-element-name-regexp' for more details on how to |
| 166 | customize which elements are recognized as sections and headings." | 166 | customize which elements are recognized as sections and headings." |
| 167 | (interactive) | 167 | (interactive) |
| @@ -170,8 +170,8 @@ customize which elements are recognized as sections and headings." | |||
| 170 | (defun nxml-show-direct-text-content () | 170 | (defun nxml-show-direct-text-content () |
| 171 | "Show the text content that is directly part of the section containing point. | 171 | "Show the text content that is directly part of the section containing point. |
| 172 | Each subsection will be shown according to its individual state, which | 172 | Each subsection will be shown according to its individual state, which |
| 173 | will not be changed. The section containing point is the innermost | 173 | will not be changed. The section containing point is the innermost |
| 174 | section that contains the character following point. See the variable | 174 | section that contains the character following point. See the variable |
| 175 | `nxml-section-element-name-regexp' for more details on how to | 175 | `nxml-section-element-name-regexp' for more details on how to |
| 176 | customize which elements are recognized as sections and headings." | 176 | customize which elements are recognized as sections and headings." |
| 177 | (interactive) | 177 | (interactive) |
| @@ -183,7 +183,7 @@ customize which elements are recognized as sections and headings." | |||
| 183 | (defun nxml-show-direct-subheadings () | 183 | (defun nxml-show-direct-subheadings () |
| 184 | "Show the immediate subheadings of the section containing point. | 184 | "Show the immediate subheadings of the section containing point. |
| 185 | The section containing point is the innermost section that contains | 185 | The section containing point is the innermost section that contains |
| 186 | the character following point. See the variable | 186 | the character following point. See the variable |
| 187 | `nxml-section-element-name-regexp' for more details on how to | 187 | `nxml-section-element-name-regexp' for more details on how to |
| 188 | customize which elements are recognized as sections and headings." | 188 | customize which elements are recognized as sections and headings." |
| 189 | (interactive) | 189 | (interactive) |
| @@ -197,7 +197,7 @@ customize which elements are recognized as sections and headings." | |||
| 197 | "Hide the text content that is directly part of the section containing point. | 197 | "Hide the text content that is directly part of the section containing point. |
| 198 | The heading of the section will remain visible. The state of | 198 | The heading of the section will remain visible. The state of |
| 199 | subsections will not be changed. The section containing point is the | 199 | subsections will not be changed. The section containing point is the |
| 200 | innermost section that contains the character following point. See the | 200 | innermost section that contains the character following point. See the |
| 201 | variable `nxml-section-element-name-regexp' for more details on how to | 201 | variable `nxml-section-element-name-regexp' for more details on how to |
| 202 | customize which elements are recognized as sections and headings." | 202 | customize which elements are recognized as sections and headings." |
| 203 | (interactive) | 203 | (interactive) |
| @@ -212,7 +212,7 @@ customize which elements are recognized as sections and headings." | |||
| 212 | The text content will also be hidden, leaving only the heading of the | 212 | The text content will also be hidden, leaving only the heading of the |
| 213 | section itself visible. The state of the subsections will also be | 213 | section itself visible. The state of the subsections will also be |
| 214 | changed to hide their headings, so that \\[nxml-show-direct-text-content] | 214 | changed to hide their headings, so that \\[nxml-show-direct-text-content] |
| 215 | would show only the heading of the subsections. The section containing | 215 | would show only the heading of the subsections. The section containing |
| 216 | point is the innermost section that contains the character following | 216 | point is the innermost section that contains the character following |
| 217 | point. See the variable `nxml-section-element-name-regexp' for more | 217 | point. See the variable `nxml-section-element-name-regexp' for more |
| 218 | details on how to customize which elements are recognized as sections | 218 | details on how to customize which elements are recognized as sections |
| @@ -235,7 +235,7 @@ sections and headings." | |||
| 235 | (defun nxml-hide-text-content () | 235 | (defun nxml-hide-text-content () |
| 236 | "Hide text content at all levels in the section containing point. | 236 | "Hide text content at all levels in the section containing point. |
| 237 | The section containing point is the innermost section that contains | 237 | The section containing point is the innermost section that contains |
| 238 | the character following point. See the variable | 238 | the character following point. See the variable |
| 239 | `nxml-section-element-name-regexp' for more details on how to | 239 | `nxml-section-element-name-regexp' for more details on how to |
| 240 | customize which elements are recognized as sections and headings." | 240 | customize which elements are recognized as sections and headings." |
| 241 | (interactive) | 241 | (interactive) |
| @@ -245,7 +245,7 @@ customize which elements are recognized as sections and headings." | |||
| 245 | "Show the subheadings at all levels of the section containing point. | 245 | "Show the subheadings at all levels of the section containing point. |
| 246 | The visibility of the text content at all levels in the section is not | 246 | The visibility of the text content at all levels in the section is not |
| 247 | changed. The section containing point is the innermost section that | 247 | changed. The section containing point is the innermost section that |
| 248 | contains the character following point. See the variable | 248 | contains the character following point. See the variable |
| 249 | `nxml-section-element-name-regexp' for more details on how to | 249 | `nxml-section-element-name-regexp' for more details on how to |
| 250 | customize which elements are recognized as sections and headings." | 250 | customize which elements are recognized as sections and headings." |
| 251 | (interactive) | 251 | (interactive) |
| @@ -255,7 +255,7 @@ customize which elements are recognized as sections and headings." | |||
| 255 | "Hide text content other than that directly in the section containing point. | 255 | "Hide text content other than that directly in the section containing point. |
| 256 | Hide headings other than those of ancestors of that section and their | 256 | Hide headings other than those of ancestors of that section and their |
| 257 | immediate subheadings. The section containing point is the innermost | 257 | immediate subheadings. The section containing point is the innermost |
| 258 | section that contains the character following point. See the variable | 258 | section that contains the character following point. See the variable |
| 259 | `nxml-section-element-name-regexp' for more details on how to | 259 | `nxml-section-element-name-regexp' for more details on how to |
| 260 | customize which elements are recognized as sections and headings." | 260 | customize which elements are recognized as sections and headings." |
| 261 | (interactive) | 261 | (interactive) |
| @@ -349,7 +349,7 @@ customize which elements are recognized as sections and headings." | |||
| 349 | (when change | 349 | (when change |
| 350 | (nxml-set-outline-state section-start-pos | 350 | (nxml-set-outline-state section-start-pos |
| 351 | (cdr change))))) | 351 | (cdr change))))) |
| 352 | 352 | ||
| 353 | (defun nxml-section-tag-transform-outline-state (startp | 353 | (defun nxml-section-tag-transform-outline-state (startp |
| 354 | section-start-pos | 354 | section-start-pos |
| 355 | &optional | 355 | &optional |
| @@ -418,7 +418,7 @@ customize which elements are recognized as sections and headings." | |||
| 418 | (or (eq xmltok-type 'end-tag) | 418 | (or (eq xmltok-type 'end-tag) |
| 419 | (eq xmltok-type 'partial-end-tag))) | 419 | (eq xmltok-type 'partial-end-tag))) |
| 420 | 420 | ||
| 421 | (defun nxml-refresh-outline () | 421 | (defun nxml-refresh-outline () |
| 422 | "Refresh the outline to correspond to the current XML element structure." | 422 | "Refresh the outline to correspond to the current XML element structure." |
| 423 | (interactive) | 423 | (interactive) |
| 424 | (save-excursion | 424 | (save-excursion |
| @@ -438,7 +438,7 @@ OUTLINE-STATE can be nil, t, hide-children. START-TAG-INDENT is the | |||
| 438 | indent of the start-tag of the current element, or nil if no | 438 | indent of the start-tag of the current element, or nil if no |
| 439 | containing element has a non-nil OUTLINE-STATE. TAG-QNAMES is a list | 439 | containing element has a non-nil OUTLINE-STATE. TAG-QNAMES is a list |
| 440 | of the qnames of the open elements. Point is after the title content. | 440 | of the qnames of the open elements. Point is after the title content. |
| 441 | Leave point after the closing end-tag Return t if we had a | 441 | Leave point after the closing end-tag. Return t if we had a |
| 442 | non-transparent child section." | 442 | non-transparent child section." |
| 443 | (let ((last-pos (point)) | 443 | (let ((last-pos (point)) |
| 444 | (transparent-depth 0) | 444 | (transparent-depth 0) |
| @@ -661,7 +661,7 @@ non-transparent child section." | |||
| 661 | t) | 661 | t) |
| 662 | 'display | 662 | 'display |
| 663 | nxml-highlighted-empty-end-tag)) | 663 | nxml-highlighted-empty-end-tag)) |
| 664 | 664 | ||
| 665 | (defun nxml-outline-display-multi-line-end-tag (last-pos start-tag-indent) | 665 | (defun nxml-outline-display-multi-line-end-tag (last-pos start-tag-indent) |
| 666 | (let ((indentp (save-excursion | 666 | (let ((indentp (save-excursion |
| 667 | (goto-char last-pos) | 667 | (goto-char last-pos) |
| @@ -765,12 +765,12 @@ non-transparent child section." | |||
| 765 | &optional | 765 | &optional |
| 766 | front-advance | 766 | front-advance |
| 767 | rear-advance) | 767 | rear-advance) |
| 768 | "Replace any nxml-outline-display overlays between START and END. | 768 | "Replace any `nxml-outline-display' overlays between START and END. |
| 769 | Overlays are removed if they overlay the region between START and END, | 769 | Overlays are removed if they overlay the region between START and END, |
| 770 | and have a non-nil nxml-outline-display property (typically via their | 770 | and have a non-nil `nxml-outline-display' property (typically via their |
| 771 | category). If CATEGORY is non-nil, they will be replaced with a new overlay | 771 | category). If CATEGORY is non-nil, they will be replaced with a new |
| 772 | with that category from START to END. If CATEGORY is nil, no new | 772 | overlay with that category from START to END. If CATEGORY is nil, |
| 773 | overlay will be created." | 773 | no new overlay will be created." |
| 774 | (when (< start end) | 774 | (when (< start end) |
| 775 | (let ((overlays (overlays-in start end)) | 775 | (let ((overlays (overlays-in start end)) |
| 776 | overlay) | 776 | overlay) |
| @@ -837,7 +837,7 @@ Do not move past the end of the line." | |||
| 837 | 837 | ||
| 838 | (defun nxml-section-tag-forward () | 838 | (defun nxml-section-tag-forward () |
| 839 | "Move forward past the first tag that is a section start- or end-tag. | 839 | "Move forward past the first tag that is a section start- or end-tag. |
| 840 | Return xmltok-type for tag. | 840 | Return `xmltok-type' for tag. |
| 841 | If no tag found, return nil and move to the end of the buffer." | 841 | If no tag found, return nil and move to the end of the buffer." |
| 842 | (let ((case-fold-search nil) | 842 | (let ((case-fold-search nil) |
| 843 | (tag-regexp (nxml-make-section-tag-regexp)) | 843 | (tag-regexp (nxml-make-section-tag-regexp)) |
| @@ -866,10 +866,10 @@ If no tag found, return nil and move to the end of the buffer." | |||
| 866 | nil) | 866 | nil) |
| 867 | (t)))) | 867 | (t)))) |
| 868 | xmltok-type) | 868 | xmltok-type) |
| 869 | 869 | ||
| 870 | (defun nxml-section-tag-backward () | 870 | (defun nxml-section-tag-backward () |
| 871 | "Move backward to the end of a tag that is a section start- or end-tag. | 871 | "Move backward to the end of a tag that is a section start- or end-tag. |
| 872 | The position of the end of the tag must be <= point | 872 | The position of the end of the tag must be <= point. |
| 873 | Point is at the end of the tag. `xmltok-start' is the start." | 873 | Point is at the end of the tag. `xmltok-start' is the start." |
| 874 | (let ((case-fold-search nil) | 874 | (let ((case-fold-search nil) |
| 875 | (start (point)) | 875 | (start (point)) |
| @@ -922,7 +922,7 @@ Signal an error on failure." | |||
| 922 | "Try to move back to the start of the section containing point. | 922 | "Try to move back to the start of the section containing point. |
| 923 | The start of the section must be <= point. | 923 | The start of the section must be <= point. |
| 924 | Only visible sections are included unless INVISIBLE-OK is non-nil. | 924 | Only visible sections are included unless INVISIBLE-OK is non-nil. |
| 925 | If found, return t. Otherwise move to point-min and return nil. | 925 | If found, return t. Otherwise move to `point-min' and return nil. |
| 926 | If unbalanced section tags are found, signal an `nxml-outline-error'." | 926 | If unbalanced section tags are found, signal an `nxml-outline-error'." |
| 927 | (when (or (nxml-after-section-start-tag) | 927 | (when (or (nxml-after-section-start-tag) |
| 928 | (nxml-section-tag-backward)) | 928 | (nxml-section-tag-backward)) |
| @@ -970,7 +970,7 @@ immediately after the section's start-tag." | |||
| 970 | (heading-regexp (concat "\\`\\(" | 970 | (heading-regexp (concat "\\`\\(" |
| 971 | nxml-heading-element-name-regexp | 971 | nxml-heading-element-name-regexp |
| 972 | "\\)\\'")) | 972 | "\\)\\'")) |
| 973 | 973 | ||
| 974 | (section-regexp (concat "\\`\\(" | 974 | (section-regexp (concat "\\`\\(" |
| 975 | nxml-section-element-name-regexp | 975 | nxml-section-element-name-regexp |
| 976 | "\\)\\'")) | 976 | "\\)\\'")) |
diff --git a/lisp/nxml/nxml-parse.el b/lisp/nxml/nxml-parse.el index 3b4c2e29597..e225e220180 100644 --- a/lisp/nxml/nxml-parse.el +++ b/lisp/nxml/nxml-parse.el | |||
| @@ -34,17 +34,17 @@ | |||
| 34 | (defvar nxml-parse-file-name nil) | 34 | (defvar nxml-parse-file-name nil) |
| 35 | 35 | ||
| 36 | (defvar nxml-validate-function nil | 36 | (defvar nxml-validate-function nil |
| 37 | "Nil or a function to be called by `nxml-parse-file' to perform validation. | 37 | "Either nil or a function called by `nxml-parse-file' to perform validation. |
| 38 | The function will be called once for each start-tag or end-tag. The | 38 | The function will be called once for each start-tag or end-tag. The |
| 39 | function is passed two arguments TEXT and START-TAG. For a start-tag, | 39 | function is passed two arguments TEXT and START-TAG. For a start-tag, |
| 40 | START-TAG is a list (NAME ATTRIBUTES) where NAME and ATTRIBUTES are in | 40 | START-TAG is a list (NAME ATTRIBUTES) where NAME and ATTRIBUTES are in |
| 41 | the same form as returned by `nxml-parse-file. For an end-tag, | 41 | the same form as returned by `nxml-parse-file'. For an end-tag, |
| 42 | START-TAG is nil. TEXT is a string containing the text immediately | 42 | START-TAG is nil. TEXT is a string containing the text immediately |
| 43 | preceding the tag, or nil if there was no such text. An empty element | 43 | preceding the tag, or nil if there was no such text. An empty element |
| 44 | is treated as a start-tag followed by an end-tag. | 44 | is treated as a start-tag followed by an end-tag. |
| 45 | 45 | ||
| 46 | For a start-tag, the namespace state will be the state after | 46 | For a start-tag, the namespace state will be the state after |
| 47 | processing the namespace declarations in the start-tag. For an | 47 | processing the namespace declarations in the start-tag. For an |
| 48 | end-tag, the namespace state will be the state before popping the | 48 | end-tag, the namespace state will be the state before popping the |
| 49 | namespace declarations for the corresponding start-tag. | 49 | namespace declarations for the corresponding start-tag. |
| 50 | 50 | ||
| @@ -75,7 +75,7 @@ An XML element is represented as a list (NAME ATTRIBUTES . CHILDREN). | |||
| 75 | NAME is either a string, in the case where the name does not have a | 75 | NAME is either a string, in the case where the name does not have a |
| 76 | namespace, or a cons (NAMESPACE . LOCAL-NAME), where NAMESPACE is a | 76 | namespace, or a cons (NAMESPACE . LOCAL-NAME), where NAMESPACE is a |
| 77 | symbol and LOCAL-NAME is a string, in the case where the name does | 77 | symbol and LOCAL-NAME is a string, in the case where the name does |
| 78 | have a namespace. NAMESPACE is a keyword whose name is `:URI', where | 78 | have a namespace. NAMESPACE is a keyword whose name is `:URI', where |
| 79 | URI is the namespace name. ATTRIBUTES is an alist of attributes where | 79 | URI is the namespace name. ATTRIBUTES is an alist of attributes where |
| 80 | each attribute has the form (NAME . VALUE), where NAME has the same | 80 | each attribute has the form (NAME . VALUE), where NAME has the same |
| 81 | form as an element name, and VALUE is a string. A namespace | 81 | form as an element name, and VALUE is a string. A namespace |
| @@ -88,16 +88,16 @@ list representing the document element. | |||
| 88 | 88 | ||
| 89 | If the XML document is not well-formed, an error having the condition | 89 | If the XML document is not well-formed, an error having the condition |
| 90 | `nxml-file-parse-error' will be signaled; the error data will be a | 90 | `nxml-file-parse-error' will be signaled; the error data will be a |
| 91 | list of the \(FILE POSITION MESSAGE), where POSITION is an integer | 91 | list of the form \(FILE POSITION MESSAGE), where POSITION is an |
| 92 | specifying the position where the error was detected, and MESSAGE is a | 92 | integer specifying the position where the error was detected, and |
| 93 | string describing the error. | 93 | MESSAGE is a string describing the error. |
| 94 | 94 | ||
| 95 | The current contents of FILE will be parsed even if there is a | 95 | The current contents of FILE will be parsed even if there is a |
| 96 | modified buffer currently visiting FILE. | 96 | modified buffer currently visiting FILE. |
| 97 | 97 | ||
| 98 | If the variable `nxml-validation-function' is non-nil, it will be | 98 | If the variable `nxml-validate-function' is non-nil, it will be called |
| 99 | called twice for each element, and any reported error will be signaled | 99 | twice for each element, and any reported error will be signaled in the |
| 100 | in the same way as well-formedness error." | 100 | same way as well-formedness error." |
| 101 | (save-excursion | 101 | (save-excursion |
| 102 | (set-buffer (nxml-parse-find-file file)) | 102 | (set-buffer (nxml-parse-find-file file)) |
| 103 | (unwind-protect | 103 | (unwind-protect |
| @@ -112,7 +112,7 @@ in the same way as well-formedness error." | |||
| 112 | (let ((set-auto-coding-function 'nxml-set-xml-coding)) | 112 | (let ((set-auto-coding-function 'nxml-set-xml-coding)) |
| 113 | (insert-file-contents file)) | 113 | (insert-file-contents file)) |
| 114 | (current-buffer))) | 114 | (current-buffer))) |
| 115 | 115 | ||
| 116 | (defun nxml-parse-instance () | 116 | (defun nxml-parse-instance () |
| 117 | (let (xmltok-dtd) | 117 | (let (xmltok-dtd) |
| 118 | (xmltok-save | 118 | (xmltok-save |
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el index 7d6078f1119..73991a46824 100644 --- a/lisp/nxml/nxml-rap.el +++ b/lisp/nxml/nxml-rap.el | |||
| @@ -94,16 +94,16 @@ | |||
| 94 | (defvar nxml-scan-end nil | 94 | (defvar nxml-scan-end nil |
| 95 | "Marker giving position up to which we have scanned. | 95 | "Marker giving position up to which we have scanned. |
| 96 | nxml-scan-end must be >= nxml-prolog-end. Furthermore, nxml-scan-end | 96 | nxml-scan-end must be >= nxml-prolog-end. Furthermore, nxml-scan-end |
| 97 | must not an inside position in the following sense. A position is | 97 | must not be an inside position in the following sense. A position is |
| 98 | inside if the following character is a part of, but not the first | 98 | inside if the following character is a part of, but not the first |
| 99 | character of, a CDATA section, comment or processing instruction. | 99 | character of, a CDATA section, comment or processing instruction. |
| 100 | Furthermore all positions >= nxml-prolog-end and < nxml-scan-end that | 100 | Furthermore all positions >= nxml-prolog-end and < nxml-scan-end that |
| 101 | are inside positions must have a non-nil nxml-inside property whose | 101 | are inside positions must have a non-nil `nxml-inside' property whose |
| 102 | value is a symbol specifying what it is inside. Any characters with a | 102 | value is a symbol specifying what it is inside. Any characters with a |
| 103 | non-nil fontified property must have position < nxml-scan-end and the | 103 | non-nil `fontified' property must have position < nxml-scan-end and |
| 104 | correct face. Dependent regions must also be established for any | 104 | the correct face. Dependent regions must also be established for any |
| 105 | unclosed constructs starting before nxml-scan-end. | 105 | unclosed constructs starting before nxml-scan-end. |
| 106 | There must be no nxml-inside properties after nxml-scan-end.") | 106 | There must be no `nxml-inside' properties after nxml-scan-end.") |
| 107 | (make-variable-buffer-local 'nxml-scan-end) | 107 | (make-variable-buffer-local 'nxml-scan-end) |
| 108 | 108 | ||
| 109 | (defsubst nxml-get-inside (pos) | 109 | (defsubst nxml-get-inside (pos) |
| @@ -139,7 +139,7 @@ Return nil if the character at POS is not inside." | |||
| 139 | "Restore `nxml-scan-end' invariants after a change. | 139 | "Restore `nxml-scan-end' invariants after a change. |
| 140 | The change happened between START and END. | 140 | The change happened between START and END. |
| 141 | Return position after which lexical state is unchanged. | 141 | Return position after which lexical state is unchanged. |
| 142 | END must be > nxml-prolog-end. START must be outside | 142 | END must be > `nxml-prolog-end'. START must be outside |
| 143 | any 'inside' regions and at the beginning of a token." | 143 | any 'inside' regions and at the beginning of a token." |
| 144 | (if (>= start nxml-scan-end) | 144 | (if (>= start nxml-scan-end) |
| 145 | nxml-scan-end | 145 | nxml-scan-end |
| @@ -301,10 +301,11 @@ Sets variables like `nxml-token-after'." | |||
| 301 | xmltok-type)) | 301 | xmltok-type)) |
| 302 | 302 | ||
| 303 | (defun nxml-move-tag-backwards (bound) | 303 | (defun nxml-move-tag-backwards (bound) |
| 304 | "Move point backwards outside any 'inside' regions or tags, up | 304 | "Move point backwards outside any 'inside' regions or tags. |
| 305 | to nxml-prolog-end. Point will either be at bound or a '<' | 305 | Point will not move past `nxml-prolog-end'. |
| 306 | character starting a tag outside any 'inside' regions. Ignores | 306 | Point will either be at BOUND or a '<' character starting a tag |
| 307 | dependent regions. As a precondition, point must be >= bound." | 307 | outside any 'inside' regions. Ignores dependent regions. |
| 308 | As a precondition, point must be >= BOUND." | ||
| 308 | (nxml-move-outside-backwards) | 309 | (nxml-move-outside-backwards) |
| 309 | (when (not (equal (char-after) ?<)) | 310 | (when (not (equal (char-after) ?<)) |
| 310 | (if (search-backward "<" bound t) | 311 | (if (search-backward "<" bound t) |
| @@ -353,12 +354,12 @@ Leave point unmoved if it is not inside anything special." | |||
| 353 | 354 | ||
| 354 | (defun nxml-scan-element-forward (from &optional up) | 355 | (defun nxml-scan-element-forward (from &optional up) |
| 355 | "Scan forward from FROM over a single balanced element. | 356 | "Scan forward from FROM over a single balanced element. |
| 356 | Point must between tokens. Return the position of the end of the tag | 357 | Point must be between tokens. Return the position of the end of |
| 357 | that ends the element. `xmltok-start' will contain the position of the | 358 | the tag that ends the element. `xmltok-start' will contain the |
| 358 | start of the tag. If UP is non-nil, then scan past end-tag of element | 359 | position of the start of the tag. If UP is non-nil, then scan |
| 359 | containing point. If no element is found, return nil. If a | 360 | past end-tag of element containing point. If no element is |
| 360 | well-formedness error prevents scanning, signal an nxml-scan-error. | 361 | found, return nil. If a well-formedness error prevents scanning, |
| 361 | Point is not moved." | 362 | signal an `nxml-scan-error'. Point is not moved." |
| 362 | (let ((open-tags (and up t)) | 363 | (let ((open-tags (and up t)) |
| 363 | found) | 364 | found) |
| 364 | (save-excursion | 365 | (save-excursion |
| @@ -404,13 +405,13 @@ expected `%s'" | |||
| 404 | 405 | ||
| 405 | (defun nxml-scan-element-backward (from &optional up bound) | 406 | (defun nxml-scan-element-backward (from &optional up bound) |
| 406 | "Scan backward from FROM over a single balanced element. | 407 | "Scan backward from FROM over a single balanced element. |
| 407 | Point must between tokens. Return the position of the end of the tag | 408 | Point must be between tokens. Return the position of the end of |
| 408 | that starts the element. `xmltok-start' will contain the position of | 409 | the tag that starts the element. `xmltok-start' will contain the |
| 409 | the start of the tag. If UP is non-nil, then scan past start-tag of | 410 | position of the start of the tag. If UP is non-nil, then scan |
| 410 | element containing point. If BOUND is non-nil, then don't scan back | 411 | past start-tag of element containing point. If BOUND is non-nil, |
| 411 | past BOUND. If no element is found, return nil. If a well-formedness | 412 | then don't scan back past BOUND. If no element is found, return |
| 412 | error prevents scanning, signal an nxml-scan-error. Point is not | 413 | nil. If a well-formedness error prevents scanning, signal an |
| 413 | moved." | 414 | `nxml-scan-error'. Point is not moved." |
| 414 | (let ((open-tags (and up t)) | 415 | (let ((open-tags (and up t)) |
| 415 | token-end found) | 416 | token-end found) |
| 416 | (save-excursion | 417 | (save-excursion |
diff --git a/lisp/nxml/nxml-uchnm.el b/lisp/nxml/nxml-uchnm.el index b9ceb504bdf..e56ae6fdbf7 100644 --- a/lisp/nxml/nxml-uchnm.el +++ b/lisp/nxml/nxml-uchnm.el | |||
| @@ -145,13 +145,13 @@ | |||
| 145 | ) | 145 | ) |
| 146 | "List of Unicode blocks. | 146 | "List of Unicode blocks. |
| 147 | For each block there is a list (NAME FIRST LAST), where | 147 | For each block there is a list (NAME FIRST LAST), where |
| 148 | NAME is a string giving the offical name of the block, | 148 | NAME is a string giving the official name of the block, |
| 149 | FIRST is the first code-point and LAST is the last code-point. | 149 | FIRST is the first code-point and LAST is the last code-point. |
| 150 | Blocks containing only characters with algorithmic names or no names | 150 | Blocks containing only characters with algorithmic names or no names |
| 151 | are omitted.") | 151 | are omitted.") |
| 152 | 152 | ||
| 153 | (defun nxml-unicode-block-char-name-set (name) | 153 | (defun nxml-unicode-block-char-name-set (name) |
| 154 | "Return a symbol for a block whose offical Unicode name is NAME. | 154 | "Return a symbol for a block whose official Unicode name is NAME. |
| 155 | The symbol is generated by downcasing and replacing each space | 155 | The symbol is generated by downcasing and replacing each space |
| 156 | by a hyphen." | 156 | by a hyphen." |
| 157 | (intern (replace-regexp-in-string " " "-" (downcase name)))) | 157 | (intern (replace-regexp-in-string " " "-" (downcase name)))) |
| @@ -209,7 +209,7 @@ by a hyphen." | |||
| 209 | nxml-unicode-blocks) | 209 | nxml-unicode-blocks) |
| 210 | 210 | ||
| 211 | ;; Internal flag to control whether customize reloads the character tables. | 211 | ;; Internal flag to control whether customize reloads the character tables. |
| 212 | ;; Should be set the first time the | 212 | ;; Should be set the first time the |
| 213 | (defvar nxml-internal-unicode-char-name-sets-enabled nil) | 213 | (defvar nxml-internal-unicode-char-name-sets-enabled nil) |
| 214 | 214 | ||
| 215 | (defcustom nxml-enabled-unicode-blocks nxml-enabled-unicode-blocks-default | 215 | (defcustom nxml-enabled-unicode-blocks nxml-enabled-unicode-blocks-default |
diff --git a/lisp/nxml/nxml-util.el b/lisp/nxml/nxml-util.el index 1f904a2272f..4d35d88db57 100644 --- a/lisp/nxml/nxml-util.el +++ b/lisp/nxml/nxml-util.el | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | 26 | ||
| 27 | (defconst nxml-debug nil | 27 | (defconst nxml-debug nil |
| 28 | "enable nxml debugging. effective only at compile time") | 28 | "Enable nxml debugging. Effective only at compile time.") |
| 29 | 29 | ||
| 30 | (defsubst nxml-debug (format &rest args) | 30 | (defsubst nxml-debug (format &rest args) |
| 31 | (when nxml-debug | 31 | (when nxml-debug |
| @@ -52,7 +52,7 @@ | |||
| 52 | 52 | ||
| 53 | (defun nxml-make-namespace (str) | 53 | (defun nxml-make-namespace (str) |
| 54 | "Return a symbol for the namespace URI STR. | 54 | "Return a symbol for the namespace URI STR. |
| 55 | STR must be a string. If STR is the empty string, return nil. | 55 | STR must be a string. If STR is the empty string, return nil. |
| 56 | Otherwise, return the symbol whose name is STR prefixed with a colon." | 56 | Otherwise, return the symbol whose name is STR prefixed with a colon." |
| 57 | (if (string-equal str "") | 57 | (if (string-equal str "") |
| 58 | nil | 58 | nil |
diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el index c2e0a9eb2e1..53a11caa4de 100644 --- a/lisp/nxml/rng-cmpct.el +++ b/lisp/nxml/rng-cmpct.el | |||
| @@ -245,14 +245,16 @@ and URI is a symbol.") | |||
| 245 | (defconst rng-c-about-combine-slot 1) | 245 | (defconst rng-c-about-combine-slot 1) |
| 246 | 246 | ||
| 247 | (defun rng-c-lookup-create (name grammar) | 247 | (defun rng-c-lookup-create (name grammar) |
| 248 | "Return a def object for NAME. A def object is a pair | 248 | "Return a def object for NAME. |
| 249 | \(ABOUT . REF) where REF is returned by `rng-make-ref'. ABOUT is a | 249 | A def object is a pair \(ABOUT . REF) where REF is returned by |
| 250 | two-element vector [OVERRIDE COMBINE]. COMBINE is either nil, choice | 250 | `rng-make-ref'. |
| 251 | or interleave. OVERRIDE is either nil, require or t." | 251 | ABOUT is a two-element vector [OVERRIDE COMBINE]. |
| 252 | COMBINE is either nil, choice or interleave. | ||
| 253 | OVERRIDE is either nil, require or t." | ||
| 252 | (let ((def (gethash name grammar))) | 254 | (let ((def (gethash name grammar))) |
| 253 | (if def | 255 | (if def |
| 254 | def | 256 | def |
| 255 | (progn | 257 | (progn |
| 256 | (setq def (cons (vector nil nil) (rng-make-ref name))) | 258 | (setq def (cons (vector nil nil) (rng-make-ref name))) |
| 257 | (puthash name def grammar) | 259 | (puthash name def grammar) |
| 258 | def)))) | 260 | def)))) |
| @@ -470,14 +472,14 @@ or interleave. OVERRIDE is either nil, require or t." | |||
| 470 | (cons (cons prefix | 472 | (cons (cons prefix |
| 471 | (rng-make-datatypes-uri (rng-c-parse-literal))) | 473 | (rng-make-datatypes-uri (rng-c-parse-literal))) |
| 472 | rng-c-datatype-decls)))) | 474 | rng-c-datatype-decls)))) |
| 473 | 475 | ||
| 474 | (defun rng-c-parse-namespace () | 476 | (defun rng-c-parse-namespace () |
| 475 | (rng-c-declare-namespace nil | 477 | (rng-c-declare-namespace nil |
| 476 | (rng-c-parse-identifier-or-keyword))) | 478 | (rng-c-parse-identifier-or-keyword))) |
| 477 | 479 | ||
| 478 | (defun rng-c-parse-default () | 480 | (defun rng-c-parse-default () |
| 479 | (rng-c-expect "namespace") | 481 | (rng-c-expect "namespace") |
| 480 | (rng-c-declare-namespace t | 482 | (rng-c-declare-namespace t |
| 481 | (if (string-equal rng-c-current-token "=") | 483 | (if (string-equal rng-c-current-token "=") |
| 482 | nil | 484 | nil |
| 483 | (rng-c-parse-identifier-or-keyword)))) | 485 | (rng-c-parse-identifier-or-keyword)))) |
| @@ -615,9 +617,10 @@ or interleave. OVERRIDE is either nil, require or t." | |||
| 615 | p))) | 617 | p))) |
| 616 | 618 | ||
| 617 | (defun rng-c-parse-primary () | 619 | (defun rng-c-parse-primary () |
| 618 | "Parse a primary expression. The current token must be the first | 620 | "Parse a primary expression. |
| 619 | token of the expression. After parsing the current token should be | 621 | The current token must be the first token of the expression. |
| 620 | token following the primary expression." | 622 | After parsing the current token should be the token following |
| 623 | the primary expression." | ||
| 621 | (cond ((rng-c-current-token-keyword-p) | 624 | (cond ((rng-c-current-token-keyword-p) |
| 622 | (let ((parse-function (get (intern rng-c-current-token) | 625 | (let ((parse-function (get (intern rng-c-current-token) |
| 623 | 'rng-c-pattern))) | 626 | 'rng-c-pattern))) |
| @@ -691,7 +694,7 @@ token following the primary expression." | |||
| 691 | ((rng-c-current-token-quoted-identifier-p) | 694 | ((rng-c-current-token-quoted-identifier-p) |
| 692 | (rng-c-advance-with (substring rng-c-current-token 1))) | 695 | (rng-c-advance-with (substring rng-c-current-token 1))) |
| 693 | (t (rng-c-error "Expected identifier or keyword")))) | 696 | (t (rng-c-error "Expected identifier or keyword")))) |
| 694 | 697 | ||
| 695 | (put 'string 'rng-c-pattern 'rng-c-parse-string) | 698 | (put 'string 'rng-c-pattern 'rng-c-parse-string) |
| 696 | (put 'token 'rng-c-pattern 'rng-c-parse-token) | 699 | (put 'token 'rng-c-pattern 'rng-c-parse-token) |
| 697 | (put 'element 'rng-c-pattern 'rng-c-parse-element) | 700 | (put 'element 'rng-c-pattern 'rng-c-parse-element) |
| @@ -740,7 +743,7 @@ token following the primary expression." | |||
| 740 | (string-equal rng-c-current-token "|"))) | 743 | (string-equal rng-c-current-token "|"))) |
| 741 | (rng-make-choice-name-class name-classes)) | 744 | (rng-make-choice-name-class name-classes)) |
| 742 | name-class))) | 745 | name-class))) |
| 743 | 746 | ||
| 744 | (defun rng-c-parse-primary-name-class (attribute) | 747 | (defun rng-c-parse-primary-name-class (attribute) |
| 745 | (cond ((rng-c-current-token-ncname-p) | 748 | (cond ((rng-c-current-token-ncname-p) |
| 746 | (rng-c-advance-with | 749 | (rng-c-advance-with |
| @@ -901,8 +904,8 @@ token following the primary expression." | |||
| 901 | ;; XXX don't allow attributes after text | 904 | ;; XXX don't allow attributes after text |
| 902 | 905 | ||
| 903 | (defun rng-c-parse-annotation-body (&optional allow-text) | 906 | (defun rng-c-parse-annotation-body (&optional allow-text) |
| 904 | "Current token is [. Parse up to matching ]. Current token after | 907 | "Current token is [. Parse up to matching ]. |
| 905 | parse is token following ]." | 908 | Current token after parse is token following ]." |
| 906 | (or (string-equal rng-c-current-token "[") | 909 | (or (string-equal rng-c-current-token "[") |
| 907 | (rng-c-error "Expected [")) | 910 | (rng-c-error "Expected [")) |
| 908 | (rng-c-advance) | 911 | (rng-c-advance) |
| @@ -922,7 +925,7 @@ parse is token following ]." | |||
| 922 | (rng-c-parse-literal)) | 925 | (rng-c-parse-literal)) |
| 923 | (t (rng-c-error "Expected = or [")))))) | 926 | (t (rng-c-error "Expected = or [")))))) |
| 924 | (rng-c-advance)) | 927 | (rng-c-advance)) |
| 925 | 928 | ||
| 926 | (defun rng-c-advance-with (pattern) | 929 | (defun rng-c-advance-with (pattern) |
| 927 | (rng-c-advance) | 930 | (rng-c-advance) |
| 928 | pattern) | 931 | pattern) |
diff --git a/lisp/nxml/rng-dt.el b/lisp/nxml/rng-dt.el index 1dda35dd1fc..aa37a93789c 100644 --- a/lisp/nxml/rng-dt.el +++ b/lisp/nxml/rng-dt.el | |||
| @@ -34,13 +34,13 @@ | |||
| 34 | nil)) | 34 | nil)) |
| 35 | 35 | ||
| 36 | (defvar rng-dt-namespace-context-getter nil | 36 | (defvar rng-dt-namespace-context-getter nil |
| 37 | "A list used by datatype libraries to expand names. The car of the | 37 | "A list used by datatype libraries to expand names. |
| 38 | list is a symbol which is the name of a function. This function is | 38 | The car of the list is a symbol which is the name of a function. |
| 39 | applied to the cdr of the list. The function must return a list whose | 39 | This function is applied to the cdr of the list. The function must |
| 40 | car is the default namespace and whose cdr is an alist of (PREFIX | 40 | return a list whose car is the default namespace and whose cdr is an |
| 41 | . NAMESPACE) pairs, where PREFIX is a string and NAMESPACE is a | 41 | alist of (PREFIX . NAMESPACE) pairs, where PREFIX is a string and |
| 42 | symbol. This must be dynamically bound before calling a datatype | 42 | NAMESPACE is a symbol. This must be dynamically bound before calling |
| 43 | library.") | 43 | a datatype library.") |
| 44 | 44 | ||
| 45 | (defsubst rng-dt-make-value (dt str) | 45 | (defsubst rng-dt-make-value (dt str) |
| 46 | (apply (car dt) (cons str (cdr dt)))) | 46 | (apply (car dt) (cons str (cdr dt)))) |
diff --git a/lisp/nxml/rng-loc.el b/lisp/nxml/rng-loc.el index cb49b301dc9..9ae94d6470a 100644 --- a/lisp/nxml/rng-loc.el +++ b/lisp/nxml/rng-loc.el | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | (defvar rng-current-schema-file-name nil | 34 | (defvar rng-current-schema-file-name nil |
| 35 | "Filename of schema being used for current buffer. | 35 | "Filename of schema being used for current buffer. |
| 36 | Nil if using a vacuous schema.") | 36 | It is nil if using a vacuous schema.") |
| 37 | (make-variable-buffer-local 'rng-current-schema-file-name) | 37 | (make-variable-buffer-local 'rng-current-schema-file-name) |
| 38 | 38 | ||
| 39 | (defvar rng-schema-locating-files-default | 39 | (defvar rng-schema-locating-files-default |
| @@ -91,7 +91,7 @@ Nil if using a vacuous schema.") | |||
| 91 | FILENAME must be the name of a file containing a schema. | 91 | FILENAME must be the name of a file containing a schema. |
| 92 | The extension of FILENAME is used to determine what kind of schema it | 92 | The extension of FILENAME is used to determine what kind of schema it |
| 93 | is. The variable `rng-schema-loader-alist' maps from schema | 93 | is. The variable `rng-schema-loader-alist' maps from schema |
| 94 | extensions to schema loader functions. The function | 94 | extensions to schema loader functions. The function |
| 95 | `rng-c-load-schema' is the loader for RELAX NG compact syntax. The | 95 | `rng-c-load-schema' is the loader for RELAX NG compact syntax. The |
| 96 | association is between the buffer and the schema: the association is | 96 | association is between the buffer and the schema: the association is |
| 97 | lost when the buffer is killed." | 97 | lost when the buffer is killed." |
| @@ -117,7 +117,7 @@ lost when the buffer is killed." | |||
| 117 | rng-any-element)) | 117 | rng-any-element)) |
| 118 | (setq rng-current-schema-file-name filename) | 118 | (setq rng-current-schema-file-name filename) |
| 119 | (run-hooks 'rng-schema-change-hook)) | 119 | (run-hooks 'rng-schema-change-hook)) |
| 120 | 120 | ||
| 121 | (defun rng-load-schema (filename) | 121 | (defun rng-load-schema (filename) |
| 122 | (let* ((extension (file-name-extension filename)) | 122 | (let* ((extension (file-name-extension filename)) |
| 123 | (loader (cdr (assoc extension rng-schema-loader-alist)))) | 123 | (loader (cdr (assoc extension rng-schema-loader-alist)))) |
| @@ -132,7 +132,7 @@ lost when the buffer is killed." | |||
| 132 | "Display a message saying what schema `rng-validate-mode' is using." | 132 | "Display a message saying what schema `rng-validate-mode' is using." |
| 133 | (interactive) | 133 | (interactive) |
| 134 | (if rng-current-schema-file-name | 134 | (if rng-current-schema-file-name |
| 135 | (message "Using schema %s" | 135 | (message "Using schema %s" |
| 136 | (abbreviate-file-name rng-current-schema-file-name)) | 136 | (abbreviate-file-name rng-current-schema-file-name)) |
| 137 | (message "Using vacuous schema"))) | 137 | (message "Using vacuous schema"))) |
| 138 | 138 | ||
| @@ -188,7 +188,7 @@ If TYPE-ID is non-nil, then locate the schema for this TYPE-ID." | |||
| 188 | (defun rng-locate-schema-file-using (files) | 188 | (defun rng-locate-schema-file-using (files) |
| 189 | "Locate a schema using the schema locating files FILES. | 189 | "Locate a schema using the schema locating files FILES. |
| 190 | FILES is a list of file-names. | 190 | FILES is a list of file-names. |
| 191 | Return either a URI, a list (TYPE-ID) where TYPE-ID is a string | 191 | Return either a URI, a list (TYPE-ID) where TYPE-ID is a string, |
| 192 | or nil." | 192 | or nil." |
| 193 | (let (rules | 193 | (let (rules |
| 194 | ;; List of types that override normal order-based | 194 | ;; List of types that override normal order-based |
| @@ -381,7 +381,7 @@ NS is t if the document has a non-nil, but not otherwise known namespace." | |||
| 381 | 381 | ||
| 382 | (defun rng-locate-schema-file-from-type-id (type-id file) | 382 | (defun rng-locate-schema-file-from-type-id (type-id file) |
| 383 | "Locate the schema for type id TYPE-ID using schema locating file FILE. | 383 | "Locate the schema for type id TYPE-ID using schema locating file FILE. |
| 384 | Return either a URI, a list (TYPE-ID) where TYPE-ID is a string | 384 | Return either a URI, a list (TYPE-ID) where TYPE-ID is a string, |
| 385 | or nil." | 385 | or nil." |
| 386 | (let ((rules (rng-get-parsed-schema-locating-file file)) | 386 | (let ((rules (rng-get-parsed-schema-locating-file file)) |
| 387 | schema rule) | 387 | schema rule) |
| @@ -425,7 +425,7 @@ or nil." | |||
| 425 | (cons (list file mtime parsed) | 425 | (cons (list file mtime parsed) |
| 426 | rng-schema-locating-file-alist))) | 426 | rng-schema-locating-file-alist))) |
| 427 | parsed)))) | 427 | parsed)))) |
| 428 | 428 | ||
| 429 | (defconst rng-locate-namespace-uri | 429 | (defconst rng-locate-namespace-uri |
| 430 | (nxml-make-namespace "http://thaiopensource.com/ns/locating-rules/1.0")) | 430 | (nxml-make-namespace "http://thaiopensource.com/ns/locating-rules/1.0")) |
| 431 | 431 | ||
diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el index e5749124cf4..006fdf537c1 100644 --- a/lisp/nxml/rng-match.el +++ b/lisp/nxml/rng-match.el | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | 43 | ||
| 44 | (defvar rng-being-compiled nil | 44 | (defvar rng-being-compiled nil |
| 45 | "Contains a list of ref patterns currently being compiled. | 45 | "Contains a list of ref patterns currently being compiled. |
| 46 | Used to detect illegal recursive references.") | 46 | Used to detect invalid recursive references.") |
| 47 | 47 | ||
| 48 | (defvar rng-ipattern-table nil) | 48 | (defvar rng-ipattern-table nil) |
| 49 | 49 | ||
| @@ -67,7 +67,7 @@ Used to detect illegal recursive references.") | |||
| 67 | (defun rng-ipattern-slot-accessor-name (slot-name) | 67 | (defun rng-ipattern-slot-accessor-name (slot-name) |
| 68 | (intern (concat "rng-ipattern-get-" | 68 | (intern (concat "rng-ipattern-get-" |
| 69 | (symbol-name slot-name)))) | 69 | (symbol-name slot-name)))) |
| 70 | 70 | ||
| 71 | (defun rng-ipattern-slot-setter-name (slot-name) | 71 | (defun rng-ipattern-slot-setter-name (slot-name) |
| 72 | (intern (concat "rng-ipattern-set-" | 72 | (intern (concat "rng-ipattern-set-" |
| 73 | (symbol-name slot-name))))) | 73 | (symbol-name slot-name))))) |
| @@ -112,13 +112,13 @@ Used to detect illegal recursive references.") | |||
| 112 | "Associate KEY with VALUE in memo-map MM and return the new memo-map. | 112 | "Associate KEY with VALUE in memo-map MM and return the new memo-map. |
| 113 | The new memo-map may or may not be a different object from MM. | 113 | The new memo-map may or may not be a different object from MM. |
| 114 | 114 | ||
| 115 | Alists are better for small maps. Hash tables are better for large | 115 | Alists are better for small maps. Hash tables are better for large |
| 116 | maps. A memo-map therefore starts off as an alist and switches to a | 116 | maps. A memo-map therefore starts off as an alist and switches to a |
| 117 | hash table for large memo-maps. A memo-map is always a list. An empty | 117 | hash table for large memo-maps. A memo-map is always a list. An empty |
| 118 | memo-map is represented by nil. A large memo-map is represented by a | 118 | memo-map is represented by nil. A large memo-map is represented by a |
| 119 | list containing just a hash-table. A small memo map is represented by | 119 | list containing just a hash-table. A small memo map is represented by |
| 120 | a list whose cdr is an alist and whose car is the number of entries in | 120 | a list whose cdr is an alist and whose car is the number of entries in |
| 121 | the alist. The complete memo-map can be passed to assoc without | 121 | the alist. The complete memo-map can be passed to `assoc' without |
| 122 | problems: assoc ignores any members that are not cons cells. There is | 122 | problems: assoc ignores any members that are not cons cells. There is |
| 123 | therefore minimal overhead in successful lookups on small lists | 123 | therefore minimal overhead in successful lookups on small lists |
| 124 | \(which is the most common case)." | 124 | \(which is the most common case)." |
| @@ -141,7 +141,7 @@ therefore minimal overhead in successful lookups on small lists | |||
| 141 | (t (cons (1+ head) | 141 | (t (cons (1+ head) |
| 142 | (cons (cons key value) | 142 | (cons (cons key value) |
| 143 | (cdr mm)))))))) | 143 | (cdr mm)))))))) |
| 144 | 144 | ||
| 145 | (defsubst rng-make-ipattern (type index name-class child nullable) | 145 | (defsubst rng-make-ipattern (type index name-class child nullable) |
| 146 | (vector type index name-class child nullable | 146 | (vector type index name-class child nullable |
| 147 | ;; 5 memo-text-typed | 147 | ;; 5 memo-text-typed |
| @@ -216,7 +216,7 @@ therefore minimal overhead in successful lookups on small lists | |||
| 216 | after | 216 | after |
| 217 | child | 217 | child |
| 218 | nil))))) | 218 | nil))))) |
| 219 | 219 | ||
| 220 | (defun rng-intern-attribute (name-class ipattern) | 220 | (defun rng-intern-attribute (name-class ipattern) |
| 221 | (if (eq ipattern rng-not-allowed-ipattern) | 221 | (if (eq ipattern rng-not-allowed-ipattern) |
| 222 | rng-not-allowed-ipattern | 222 | rng-not-allowed-ipattern |
| @@ -293,7 +293,7 @@ therefore minimal overhead in successful lookups on small lists | |||
| 293 | nil))))) | 293 | nil))))) |
| 294 | 294 | ||
| 295 | (defun rng-intern-group (ipatterns) | 295 | (defun rng-intern-group (ipatterns) |
| 296 | "Return a ipattern for the list of group members in IPATTERNS." | 296 | "Return an ipattern for the list of group members in IPATTERNS." |
| 297 | (or (rng-intern-group-shortcut ipatterns) | 297 | (or (rng-intern-group-shortcut ipatterns) |
| 298 | (let* ((tem (rng-normalize-group-list ipatterns)) | 298 | (let* ((tem (rng-normalize-group-list ipatterns)) |
| 299 | (normalized (cdr tem))) | 299 | (normalized (cdr tem))) |
| @@ -308,8 +308,8 @@ therefore minimal overhead in successful lookups on small lists | |||
| 308 | (car tem)))))))) | 308 | (car tem)))))))) |
| 309 | 309 | ||
| 310 | (defun rng-intern-group-shortcut (ipatterns) | 310 | (defun rng-intern-group-shortcut (ipatterns) |
| 311 | "Try to shortcut interning a group list. If successful, return the | 311 | "Try to shortcut interning a group list. |
| 312 | interned pattern. Otherwise return nil." | 312 | If successful, return the interned pattern. Otherwise return nil." |
| 313 | (while (and ipatterns | 313 | (while (and ipatterns |
| 314 | (eq (car ipatterns) rng-empty-ipattern)) | 314 | (eq (car ipatterns) rng-empty-ipattern)) |
| 315 | (setq ipatterns (cdr ipatterns))) | 315 | (setq ipatterns (cdr ipatterns))) |
| @@ -430,10 +430,10 @@ May alter IPATTERNS." | |||
| 430 | nil | 430 | nil |
| 431 | normalized | 431 | normalized |
| 432 | nullable)))) | 432 | nullable)))) |
| 433 | 433 | ||
| 434 | (defun rng-intern-choice-shortcut (ipatterns) | 434 | (defun rng-intern-choice-shortcut (ipatterns) |
| 435 | "Try to shortcut interning a choice list. If successful, return the | 435 | "Try to shortcut interning a choice list. |
| 436 | interned pattern. Otherwise return nil." | 436 | If successful, return the interned pattern. Otherwise return nil." |
| 437 | (while (and ipatterns | 437 | (while (and ipatterns |
| 438 | (eq (car ipatterns) | 438 | (eq (car ipatterns) |
| 439 | rng-not-allowed-ipattern)) | 439 | rng-not-allowed-ipattern)) |
| @@ -450,10 +450,10 @@ interned pattern. Otherwise return nil." | |||
| 450 | rng-not-allowed-ipattern)) | 450 | rng-not-allowed-ipattern)) |
| 451 | 451 | ||
| 452 | (defun rng-normalize-choice-list (ipatterns) | 452 | (defun rng-normalize-choice-list (ipatterns) |
| 453 | "Normalize a list of choices, expanding nested choices, removing | 453 | "Normalize a list of choices. |
| 454 | not-allowed members, sorting by index and removing duplicates. Return | 454 | Expands nested choices, removes not-allowed members, sorts by index |
| 455 | a pair whose car says whether the list is nullable and whose cdr is | 455 | and removes duplicates. Return a pair whose car says whether the |
| 456 | the normalized list." | 456 | list is nullable and whose cdr is the normalized list." |
| 457 | (let ((sorted t) | 457 | (let ((sorted t) |
| 458 | (nullable nil) | 458 | (nullable nil) |
| 459 | (head (cons nil ipatterns))) | 459 | (head (cons nil ipatterns))) |
| @@ -537,9 +537,9 @@ the normalized list." | |||
| 537 | 537 | ||
| 538 | Each possible name should be returned as a (NAMESPACE . LOCAL-NAME) | 538 | Each possible name should be returned as a (NAMESPACE . LOCAL-NAME) |
| 539 | pair, where NAMESPACE is a symbol or nil and LOCAL-NAME is a string. | 539 | pair, where NAMESPACE is a symbol or nil and LOCAL-NAME is a string. |
| 540 | nil for NAMESPACE matches the absent namespace. ACCUM is a list of | 540 | NAMESPACE, if nil, matches the absent namespace. ACCUM is a list of |
| 541 | names which should be appended to the returned list. The returned list | 541 | names which should be appended to the returned list. The returned |
| 542 | may contain duplicates." | 542 | list may contain duplicates." |
| 543 | (if (consp nc) | 543 | (if (consp nc) |
| 544 | (cons nc accum) | 544 | (cons nc accum) |
| 545 | (when (eq (aref nc 0) 'choice) | 545 | (when (eq (aref nc 0) 'choice) |
| @@ -682,7 +682,7 @@ may contain duplicates." | |||
| 682 | (rng-compile pattern) | 682 | (rng-compile pattern) |
| 683 | (setq rng-being-compiled | 683 | (setq rng-being-compiled |
| 684 | (cdr rng-being-compiled)))) | 684 | (cdr rng-being-compiled)))) |
| 685 | 685 | ||
| 686 | (defun rng-compile-one-or-more (pattern) | 686 | (defun rng-compile-one-or-more (pattern) |
| 687 | (rng-intern-one-or-more (rng-compile pattern))) | 687 | (rng-intern-one-or-more (rng-compile pattern))) |
| 688 | 688 | ||
| @@ -734,7 +734,7 @@ may contain duplicates." | |||
| 734 | (rng-compile-error "Value %s is not a valid instance of the datatype %s" | 734 | (rng-compile-error "Value %s is not a valid instance of the datatype %s" |
| 735 | str | 735 | str |
| 736 | name)))) | 736 | name)))) |
| 737 | 737 | ||
| 738 | (defun rng-compile-name-class (nc) | 738 | (defun rng-compile-name-class (nc) |
| 739 | (let ((type (car nc))) | 739 | (let ((type (car nc))) |
| 740 | (cond ((eq type 'name) (nth 1 nc)) | 740 | (cond ((eq type 'name) (nth 1 nc)) |
| @@ -871,16 +871,16 @@ may contain duplicates." | |||
| 871 | ((eq type 'after) | 871 | ((eq type 'after) |
| 872 | (rng-ipattern-text-typed-p (rng-ipattern-get-child ipattern))) | 872 | (rng-ipattern-text-typed-p (rng-ipattern-get-child ipattern))) |
| 873 | (t (and (memq type '(value list data data-except)) t))))) | 873 | (t (and (memq type '(value list data data-except)) t))))) |
| 874 | 874 | ||
| 875 | (defun rng-start-tag-open-deriv (ipattern nm) | 875 | (defun rng-start-tag-open-deriv (ipattern nm) |
| 876 | (or (rng-memo-map-get | 876 | (or (rng-memo-map-get |
| 877 | nm | 877 | nm |
| 878 | (rng-ipattern-get-memo-map-start-tag-open-deriv ipattern)) | 878 | (rng-ipattern-get-memo-map-start-tag-open-deriv ipattern)) |
| 879 | (rng-ipattern-memo-start-tag-open-deriv | 879 | (rng-ipattern-memo-start-tag-open-deriv |
| 880 | ipattern | 880 | ipattern |
| 881 | nm | 881 | nm |
| 882 | (rng-compute-start-tag-open-deriv ipattern nm)))) | 882 | (rng-compute-start-tag-open-deriv ipattern nm)))) |
| 883 | 883 | ||
| 884 | (defun rng-ipattern-memo-start-tag-open-deriv (ipattern nm deriv) | 884 | (defun rng-ipattern-memo-start-tag-open-deriv (ipattern nm deriv) |
| 885 | (or (memq ipattern rng-const-ipatterns) | 885 | (or (memq ipattern rng-const-ipatterns) |
| 886 | (rng-ipattern-set-memo-map-start-tag-open-deriv | 886 | (rng-ipattern-set-memo-map-start-tag-open-deriv |
| @@ -907,7 +907,7 @@ may contain duplicates." | |||
| 907 | ((eq type 'group) | 907 | ((eq type 'group) |
| 908 | (rng-transform-group-nullable | 908 | (rng-transform-group-nullable |
| 909 | `(lambda (p) (rng-start-tag-open-deriv p ',nm)) | 909 | `(lambda (p) (rng-start-tag-open-deriv p ',nm)) |
| 910 | 'rng-cons-group-after | 910 | 'rng-cons-group-after |
| 911 | ipattern)) | 911 | ipattern)) |
| 912 | ((eq type 'interleave) | 912 | ((eq type 'interleave) |
| 913 | (rng-transform-interleave-single | 913 | (rng-transform-interleave-single |
| @@ -935,9 +935,9 @@ may contain duplicates." | |||
| 935 | (rng-ipattern-get-memo-map-start-attribute-deriv ipattern)) | 935 | (rng-ipattern-get-memo-map-start-attribute-deriv ipattern)) |
| 936 | (rng-ipattern-memo-start-attribute-deriv | 936 | (rng-ipattern-memo-start-attribute-deriv |
| 937 | ipattern | 937 | ipattern |
| 938 | nm | 938 | nm |
| 939 | (rng-compute-start-attribute-deriv ipattern nm)))) | 939 | (rng-compute-start-attribute-deriv ipattern nm)))) |
| 940 | 940 | ||
| 941 | (defun rng-ipattern-memo-start-attribute-deriv (ipattern nm deriv) | 941 | (defun rng-ipattern-memo-start-attribute-deriv (ipattern nm deriv) |
| 942 | (or (memq ipattern rng-const-ipatterns) | 942 | (or (memq ipattern rng-const-ipatterns) |
| 943 | (rng-ipattern-set-memo-map-start-attribute-deriv | 943 | (rng-ipattern-set-memo-map-start-attribute-deriv |
| @@ -964,7 +964,7 @@ may contain duplicates." | |||
| 964 | ((eq type 'group) | 964 | ((eq type 'group) |
| 965 | (rng-transform-interleave-single | 965 | (rng-transform-interleave-single |
| 966 | `(lambda (p) (rng-start-attribute-deriv p ',nm)) | 966 | `(lambda (p) (rng-start-attribute-deriv p ',nm)) |
| 967 | 'rng-subst-group-after | 967 | 'rng-subst-group-after |
| 968 | ipattern)) | 968 | ipattern)) |
| 969 | ((eq type 'interleave) | 969 | ((eq type 'interleave) |
| 970 | (rng-transform-interleave-single | 970 | (rng-transform-interleave-single |
| @@ -1045,7 +1045,7 @@ may contain duplicates." | |||
| 1045 | 'rng-ignore-attributes-deriv | 1045 | 'rng-ignore-attributes-deriv |
| 1046 | ipattern) | 1046 | ipattern) |
| 1047 | ipattern))))) | 1047 | ipattern))))) |
| 1048 | 1048 | ||
| 1049 | (defun rng-text-only-deriv (ipattern) | 1049 | (defun rng-text-only-deriv (ipattern) |
| 1050 | (or (rng-ipattern-get-memo-text-only-deriv ipattern) | 1050 | (or (rng-ipattern-get-memo-text-only-deriv ipattern) |
| 1051 | (rng-ipattern-set-memo-text-only-deriv | 1051 | (rng-ipattern-set-memo-text-only-deriv |
| @@ -1305,7 +1305,7 @@ nullable and y1 isn't, return a choice | |||
| 1305 | (setq list1 (cdr list1)) | 1305 | (setq list1 (cdr list1)) |
| 1306 | (setq list2 (cdr list2))) | 1306 | (setq list2 (cdr list2))) |
| 1307 | (and (null list1) (null list2))) | 1307 | (and (null list1) (null list2))) |
| 1308 | 1308 | ||
| 1309 | 1309 | ||
| 1310 | (defun rng-ipattern-after (ipattern) | 1310 | (defun rng-ipattern-after (ipattern) |
| 1311 | (let ((type (rng-ipattern-get-type ipattern))) | 1311 | (let ((type (rng-ipattern-get-type ipattern))) |
| @@ -1556,7 +1556,7 @@ nullable and y1 isn't, return a choice | |||
| 1556 | 1556 | ||
| 1557 | (defsubst rng-set-match-state (state) | 1557 | (defsubst rng-set-match-state (state) |
| 1558 | (setq rng-match-state state)) | 1558 | (setq rng-match-state state)) |
| 1559 | 1559 | ||
| 1560 | (defsubst rng-match-state-equal (state) | 1560 | (defsubst rng-match-state-equal (state) |
| 1561 | (eq state rng-match-state)) | 1561 | (eq state rng-match-state)) |
| 1562 | 1562 | ||
| @@ -1618,7 +1618,7 @@ nullable and y1 isn't, return a choice | |||
| 1618 | 1618 | ||
| 1619 | (defun rng-match-possible-namespace-uris () | 1619 | (defun rng-match-possible-namespace-uris () |
| 1620 | "Return a list of all the namespace URIs used in the current schema. | 1620 | "Return a list of all the namespace URIs used in the current schema. |
| 1621 | The absent URI is not included, so the result is always list of symbols." | 1621 | The absent URI is not included, so the result is always a list of symbols." |
| 1622 | (rng-map-element-attribute (lambda (pattern accum) | 1622 | (rng-map-element-attribute (lambda (pattern accum) |
| 1623 | (rng-find-name-class-uris (nth 1 pattern) | 1623 | (rng-find-name-class-uris (nth 1 pattern) |
| 1624 | accum)) | 1624 | accum)) |
| @@ -1681,7 +1681,7 @@ for an end-tag is equivalent to empty." | |||
| 1681 | 1681 | ||
| 1682 | Each possible name is returned as a (NAMESPACE . LOCAL-NAME) pair, | 1682 | Each possible name is returned as a (NAMESPACE . LOCAL-NAME) pair, |
| 1683 | where NAMESPACE is a symbol or nil (meaning the absent namespace) and | 1683 | where NAMESPACE is a symbol or nil (meaning the absent namespace) and |
| 1684 | LOCAL-NAME is a string. The returned list may contain duplicates." | 1684 | LOCAL-NAME is a string. The returned list may contain duplicates." |
| 1685 | (rng-ipattern-possible-start-tags rng-match-state nil)) | 1685 | (rng-ipattern-possible-start-tags rng-match-state nil)) |
| 1686 | 1686 | ||
| 1687 | ;; This is no longer used. It might be useful so leave it in for now. | 1687 | ;; This is no longer used. It might be useful so leave it in for now. |
| @@ -1698,7 +1698,7 @@ more information." | |||
| 1698 | 1698 | ||
| 1699 | (defun rng-match-possible-value-strings () | 1699 | (defun rng-match-possible-value-strings () |
| 1700 | "Return a list of strings that would be valid as content. | 1700 | "Return a list of strings that would be valid as content. |
| 1701 | The list may contain duplicates. Typically, the list will not | 1701 | The list may contain duplicates. Typically, the list will not |
| 1702 | be exhaustive." | 1702 | be exhaustive." |
| 1703 | (rng-ipattern-possible-values rng-match-state nil)) | 1703 | (rng-ipattern-possible-values rng-match-state nil)) |
| 1704 | 1704 | ||
| @@ -1735,6 +1735,6 @@ be exhaustive." | |||
| 1735 | (def-edebug-spec rng-match-with-schema t) | 1735 | (def-edebug-spec rng-match-with-schema t) |
| 1736 | 1736 | ||
| 1737 | (provide 'rng-match) | 1737 | (provide 'rng-match) |
| 1738 | 1738 | ||
| 1739 | ;; arch-tag: c8c50733-edcf-49fb-85e2-0aac8749b7f8 | 1739 | ;; arch-tag: c8c50733-edcf-49fb-85e2-0aac8749b7f8 |
| 1740 | ;;; rng-match.el ends here | 1740 | ;;; rng-match.el ends here |
diff --git a/lisp/nxml/rng-nxml.el b/lisp/nxml/rng-nxml.el index 9fb69b66a49..28a746fa93d 100644 --- a/lisp/nxml/rng-nxml.el +++ b/lisp/nxml/rng-nxml.el | |||
| @@ -372,7 +372,7 @@ If unsure, return non-nil." | |||
| 372 | (defun rng-set-state-after (&optional pos) | 372 | (defun rng-set-state-after (&optional pos) |
| 373 | "Set the state for after parsing the first token with endpoint >= POS. | 373 | "Set the state for after parsing the first token with endpoint >= POS. |
| 374 | This does not change the xmltok state or point. However, it does | 374 | This does not change the xmltok state or point. However, it does |
| 375 | set `xmltok-dtd'. Returns the position of the end of the token." | 375 | set `xmltok-dtd'. Returns the position of the end of the token." |
| 376 | (unless pos (setq pos (point))) | 376 | (unless pos (setq pos (point))) |
| 377 | (when (< rng-validate-up-to-date-end pos) | 377 | (when (< rng-validate-up-to-date-end pos) |
| 378 | (message "Parsing...") | 378 | (message "Parsing...") |
| @@ -448,7 +448,7 @@ set `xmltok-dtd'. Returns the position of the end of the token." | |||
| 448 | (rng-process-start-tag 'stop) | 448 | (rng-process-start-tag 'stop) |
| 449 | (rng-find-undeclared-prefixes) | 449 | (rng-find-undeclared-prefixes) |
| 450 | t))))) | 450 | t))))) |
| 451 | 451 | ||
| 452 | (defun rng-find-undeclared-prefixes () | 452 | (defun rng-find-undeclared-prefixes () |
| 453 | ;; Start with the newly effective namespace declarations. | 453 | ;; Start with the newly effective namespace declarations. |
| 454 | ;; (Includes declarations added during recovery.) | 454 | ;; (Includes declarations added during recovery.) |
| @@ -567,7 +567,7 @@ set `xmltok-dtd'. Returns the position of the end of the token." | |||
| 567 | (list (cdr name)))) | 567 | (list (cdr name)))) |
| 568 | rng-complete-target-names))) | 568 | rng-complete-target-names))) |
| 569 | 'string<)))) | 569 | 'string<)))) |
| 570 | 570 | ||
| 571 | (defun rng-get-preferred-unused-prefix (ns) | 571 | (defun rng-get-preferred-unused-prefix (ns) |
| 572 | (let ((ns-prefix (assoc (symbol-name ns) rng-preferred-prefix-alist)) | 572 | (let ((ns-prefix (assoc (symbol-name ns) rng-preferred-prefix-alist)) |
| 573 | iter prefix) | 573 | iter prefix) |
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el index c37ac32710a..340f855a289 100644 --- a/lisp/nxml/rng-uri.el +++ b/lisp/nxml/rng-uri.el | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | (defun rng-file-name-uri (f) | 27 | (defun rng-file-name-uri (f) |
| 28 | "Return a URI for the filename F. | 28 | "Return a URI for the filename F. |
| 29 | Multibyte characters are left as is. Use `rng-uri-escape-multibyte' to | 29 | Multibyte characters are left as is. Use `rng-uri-escape-multibyte' to |
| 30 | escape them using %HH." | 30 | escape them using %HH." |
| 31 | (setq f (expand-file-name f)) | 31 | (setq f (expand-file-name f)) |
| 32 | (let ((url | 32 | (let ((url |
| @@ -102,7 +102,7 @@ Signal an error if URI is not a valid file URL." | |||
| 102 | (setq path (substring path 1))) | 102 | (setq path (substring path 1))) |
| 103 | (when (and pattern (string-match "\\`\\./" path)) | 103 | (when (and pattern (string-match "\\`\\./" path)) |
| 104 | (setq path (substring path 2))) | 104 | (setq path (substring path 2))) |
| 105 | (setq path | 105 | (setq path |
| 106 | (cond ((eq pattern 'match) | 106 | (cond ((eq pattern 'match) |
| 107 | (rng-uri-unescape-unibyte-match path)) | 107 | (rng-uri-unescape-unibyte-match path)) |
| 108 | ((eq pattern 'replace) | 108 | ((eq pattern 'replace) |
| @@ -162,7 +162,7 @@ Signal an error if URI is not a valid file URL." | |||
| 162 | (cons scheme | 162 | (cons scheme |
| 163 | (cons ":" parts)))) | 163 | (cons ":" parts)))) |
| 164 | (apply 'concat parts)))) | 164 | (apply 'concat parts)))) |
| 165 | 165 | ||
| 166 | (defun rng-uri-resolve (uri-ref base-uri) | 166 | (defun rng-uri-resolve (uri-ref base-uri) |
| 167 | "Resolve a possibly relative URI reference into absolute form. | 167 | "Resolve a possibly relative URI reference into absolute form. |
| 168 | URI-REF is the URI reference to be resolved. | 168 | URI-REF is the URI reference to be resolved. |
| @@ -308,7 +308,7 @@ Both FULL and BASE must be absolute URIs." | |||
| 308 | (mapcar (lambda (h) (string-to-number h 16)) | 308 | (mapcar (lambda (h) (string-to-number h 16)) |
| 309 | (split-string str "%"))) | 309 | (split-string str "%"))) |
| 310 | 'utf-8)) | 310 | 'utf-8)) |
| 311 | 311 | ||
| 312 | (defun rng-uri-unescape-unibyte (str) | 312 | (defun rng-uri-unescape-unibyte (str) |
| 313 | (replace-regexp-in-string "%[0-7][0-9a-fA-F]" | 313 | (replace-regexp-in-string "%[0-7][0-9a-fA-F]" |
| 314 | (lambda (h) | 314 | (lambda (h) |
diff --git a/lisp/nxml/rng-util.el b/lisp/nxml/rng-util.el index 6c88d694b7f..3dc68e05f1e 100644 --- a/lisp/nxml/rng-util.el +++ b/lisp/nxml/rng-util.el | |||
| @@ -37,8 +37,7 @@ | |||
| 37 | (defconst rng-builtin-datatypes-uri (rng-make-datatypes-uri "")) | 37 | (defconst rng-builtin-datatypes-uri (rng-make-datatypes-uri "")) |
| 38 | 38 | ||
| 39 | (defun rng-uniquify-eq (list) | 39 | (defun rng-uniquify-eq (list) |
| 40 | "Destructively remove any element from LIST that is eq to | 40 | "Destructively remove `eq' duplicates from LIST." |
| 41 | its predecessor." | ||
| 42 | (and list | 41 | (and list |
| 43 | (let ((head list)) | 42 | (let ((head list)) |
| 44 | (while (cdr head) | 43 | (while (cdr head) |
| @@ -48,8 +47,7 @@ its predecessor." | |||
| 48 | list))) | 47 | list))) |
| 49 | 48 | ||
| 50 | (defun rng-uniquify-equal (list) | 49 | (defun rng-uniquify-equal (list) |
| 51 | "Destructively remove any element from LIST that is equal to | 50 | "Destructively remove `equal' duplicates from LIST." |
| 52 | its predecessor." | ||
| 53 | (and list | 51 | (and list |
| 54 | (let ((head list)) | 52 | (let ((head list)) |
| 55 | (while (cdr head) | 53 | (while (cdr head) |
| @@ -61,7 +59,7 @@ its predecessor." | |||
| 61 | (defun rng-blank-p (str) (string-match "\\`[ \t\n\r]*\\'" str)) | 59 | (defun rng-blank-p (str) (string-match "\\`[ \t\n\r]*\\'" str)) |
| 62 | 60 | ||
| 63 | (defun rng-substq (new old list) | 61 | (defun rng-substq (new old list) |
| 64 | "Replace first member of LIST (if any) that is eq to OLD by NEW. | 62 | "Replace first member of LIST (if any) that is `eq' to OLD by NEW. |
| 65 | LIST is not modified." | 63 | LIST is not modified." |
| 66 | (cond ((null list) nil) | 64 | (cond ((null list) nil) |
| 67 | ((eq (car list) old) | 65 | ((eq (car list) old) |
| @@ -90,7 +88,7 @@ Replaces the text between START and point with a string chosen using a | |||
| 90 | completion table and, when needed, input read from the user with the | 88 | completion table and, when needed, input read from the user with the |
| 91 | minibuffer. | 89 | minibuffer. |
| 92 | Returns the new string if either a complete and unique completion was | 90 | Returns the new string if either a complete and unique completion was |
| 93 | determined automatically or input was read from the user. Otherwise, | 91 | determined automatically or input was read from the user. Otherwise, |
| 94 | returns nil. | 92 | returns nil. |
| 95 | TABLE is an alist, a symbol bound to a function or an obarray as with | 93 | TABLE is an alist, a symbol bound to a function or an obarray as with |
| 96 | the function `completing-read'. | 94 | the function `completing-read'. |
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el index eac8172b2ba..2d3e9fdd3ce 100644 --- a/lisp/nxml/rng-valid.el +++ b/lisp/nxml/rng-valid.el | |||
| @@ -148,13 +148,13 @@ A quick validation validates at most one chunk." | |||
| 148 | (put 'rng-validate-quick-timer 'permanent-local t) | 148 | (put 'rng-validate-quick-timer 'permanent-local t) |
| 149 | 149 | ||
| 150 | (defvar rng-error-count nil | 150 | (defvar rng-error-count nil |
| 151 | "Number of errors in the current buffer. Always equal to number of | 151 | "Number of errors in the current buffer. |
| 152 | overlays with category rng-error.") | 152 | Always equal to number of overlays with category `rng-error'.") |
| 153 | (make-variable-buffer-local 'rng-error-count) | 153 | (make-variable-buffer-local 'rng-error-count) |
| 154 | 154 | ||
| 155 | (defvar rng-message-overlay nil | 155 | (defvar rng-message-overlay nil |
| 156 | "Overlay in this buffer whose help-echo property was last printed. | 156 | "Overlay in this buffer whose `help-echo' property was last printed. |
| 157 | Nil if none.") | 157 | It is nil if none.") |
| 158 | (make-variable-buffer-local 'rng-message-overlay) | 158 | (make-variable-buffer-local 'rng-message-overlay) |
| 159 | 159 | ||
| 160 | (defvar rng-message-overlay-inhibit-point nil | 160 | (defvar rng-message-overlay-inhibit-point nil |
| @@ -189,19 +189,19 @@ indicating an unresolvable entity or character reference.") | |||
| 189 | 189 | ||
| 190 | (defvar rng-conditional-up-to-date-start nil | 190 | (defvar rng-conditional-up-to-date-start nil |
| 191 | "Marker for the start of the conditionally up-to-date region. | 191 | "Marker for the start of the conditionally up-to-date region. |
| 192 | Nil if there is no conditionally up-to-date region. The conditionally | 192 | It is nil if there is no conditionally up-to-date region. The |
| 193 | up-to-date region must be such that for any cached state S with | 193 | conditionally up-to-date region must be such that for any cached |
| 194 | position P in the conditionally up-to-date region, if at some point it | 194 | state S with position P in the conditionally up-to-date region, |
| 195 | is determined that S becomes correct for P, then all states with | 195 | if at some point it is determined that S becomes correct for P, |
| 196 | position >= P in the conditionally up to date region must also then be | 196 | then all states with position >= P in the conditionally up to |
| 197 | correct and all errors between P and the end of the region must then | 197 | date region must also then be correct and all errors between P |
| 198 | be correctly marked.") | 198 | and the end of the region must then be correctly marked.") |
| 199 | (make-variable-buffer-local 'rng-conditional-up-to-date-start) | 199 | (make-variable-buffer-local 'rng-conditional-up-to-date-start) |
| 200 | 200 | ||
| 201 | (defvar rng-conditional-up-to-date-end nil | 201 | (defvar rng-conditional-up-to-date-end nil |
| 202 | "Marker for the end of the conditionally up-to-date region. | 202 | "Marker for the end of the conditionally up-to-date region. |
| 203 | Nil if there is no conditionally up-to-date region. See the variable | 203 | It is nil if there is no conditionally up-to-date region. |
| 204 | `rng-conditional-up-to-date-start'.") | 204 | See the variable `rng-conditional-up-to-date-start'.") |
| 205 | (make-variable-buffer-local 'rng-conditional-up-to-date-end) | 205 | (make-variable-buffer-local 'rng-conditional-up-to-date-end) |
| 206 | 206 | ||
| 207 | (defvar rng-parsing-for-state nil | 207 | (defvar rng-parsing-for-state nil |
| @@ -220,17 +220,17 @@ Should be dynamically bound.") | |||
| 220 | 220 | ||
| 221 | Checks whether the buffer is a well-formed XML 1.0 document, | 221 | Checks whether the buffer is a well-formed XML 1.0 document, |
| 222 | conforming to the XML Namespaces Recommendation and valid against a | 222 | conforming to the XML Namespaces Recommendation and valid against a |
| 223 | RELAX NG schema. The mode-line indicates whether it is or not. Any | 223 | RELAX NG schema. The mode-line indicates whether it is or not. Any |
| 224 | parts of the buffer that cause it not to be are considered errors and | 224 | parts of the buffer that cause it not to be are considered errors and |
| 225 | are highlighted with face `rng-error'. A description of each error is | 225 | are highlighted with face `rng-error'. A description of each error is |
| 226 | available as a tooltip. \\[rng-next-error] goes to the next error | 226 | available as a tooltip. \\[rng-next-error] goes to the next error |
| 227 | after point. Clicking mouse-1 on the word `Invalid' in the mode-line | 227 | after point. Clicking mouse-1 on the word `Invalid' in the mode-line |
| 228 | goes to the first error in the buffer. If the buffer changes, then it | 228 | goes to the first error in the buffer. If the buffer changes, then it |
| 229 | will be automatically rechecked when Emacs becomes idle; the | 229 | will be automatically rechecked when Emacs becomes idle; the |
| 230 | rechecking will be paused whenever there is input pending.. | 230 | rechecking will be paused whenever there is input pending. |
| 231 | 231 | ||
| 232 | By default, uses a vacuous schema that allows any well-formed XML | 232 | By default, uses a vacuous schema that allows any well-formed XML |
| 233 | document. A schema can be specified explictly using | 233 | document. A schema can be specified explictly using |
| 234 | \\[rng-set-schema-file-and-validate], or implicitly based on the buffer's | 234 | \\[rng-set-schema-file-and-validate], or implicitly based on the buffer's |
| 235 | file name or on the root element name. In each case the schema must | 235 | file name or on the root element name. In each case the schema must |
| 236 | be a RELAX NG schema using the compact schema \(such schemas | 236 | be a RELAX NG schema using the compact schema \(such schemas |
| @@ -295,7 +295,7 @@ The schema is set like `rng-set-schema'." | |||
| 295 | (interactive (list (rng-read-type-id))) | 295 | (interactive (list (rng-read-type-id))) |
| 296 | (and (rng-set-document-type type-id) | 296 | (and (rng-set-document-type type-id) |
| 297 | (or rng-validate-mode (rng-validate-mode)))) | 297 | (or rng-validate-mode (rng-validate-mode)))) |
| 298 | 298 | ||
| 299 | (defun rng-auto-set-schema-and-validate () | 299 | (defun rng-auto-set-schema-and-validate () |
| 300 | "Set the schema for this buffer automatically and turn on `rng-validate-mode'. | 300 | "Set the schema for this buffer automatically and turn on `rng-validate-mode'. |
| 301 | The schema is set like `rng-auto-set-schema'." | 301 | The schema is set like `rng-auto-set-schema'." |
| @@ -365,7 +365,7 @@ The schema is set like `rng-auto-set-schema'." | |||
| 365 | 'mouse-1 | 365 | 'mouse-1 |
| 366 | 'rng-mouse-first-error)))) | 366 | 'rng-mouse-first-error)))) |
| 367 | (t " Valid"))) | 367 | (t " Valid"))) |
| 368 | 368 | ||
| 369 | (defun rng-cancel-timers () | 369 | (defun rng-cancel-timers () |
| 370 | (let ((inhibit-quit t)) | 370 | (let ((inhibit-quit t)) |
| 371 | (when rng-validate-timer | 371 | (when rng-validate-timer |
| @@ -389,7 +389,7 @@ The schema is set like `rng-auto-set-schema'." | |||
| 389 | (when rng-validate-quick-timer | 389 | (when rng-validate-quick-timer |
| 390 | (cancel-timer rng-validate-quick-timer)) | 390 | (cancel-timer rng-validate-quick-timer)) |
| 391 | (kill-local-variable 'rng-validate-quick-timer))) | 391 | (kill-local-variable 'rng-validate-quick-timer))) |
| 392 | 392 | ||
| 393 | (defun rng-activate-timers () | 393 | (defun rng-activate-timers () |
| 394 | (unless rng-validate-timer | 394 | (unless rng-validate-timer |
| 395 | (let ((inhibit-quit t)) | 395 | (let ((inhibit-quit t)) |
| @@ -465,13 +465,13 @@ The schema is set like `rng-auto-set-schema'." | |||
| 465 | (defun rng-validate-done () | 465 | (defun rng-validate-done () |
| 466 | (when (or (not (current-message)) | 466 | (when (or (not (current-message)) |
| 467 | (rng-current-message-from-error-overlay-p)) | 467 | (rng-current-message-from-error-overlay-p)) |
| 468 | (rng-error-overlay-message (or (rng-error-overlay-after (point)) | 468 | (rng-error-overlay-message (or (rng-error-overlay-after (point)) |
| 469 | (rng-error-overlay-after (1- (point)))))) | 469 | (rng-error-overlay-after (1- (point)))))) |
| 470 | (rng-cancel-timers) | 470 | (rng-cancel-timers) |
| 471 | (force-mode-line-update)) | 471 | (force-mode-line-update)) |
| 472 | 472 | ||
| 473 | (defun rng-do-some-validation (&optional continue-p-function) | 473 | (defun rng-do-some-validation (&optional continue-p-function) |
| 474 | "Do some validation work. Return t if more to do, nil otherwise." | 474 | "Do some validation work. Return t if more to do, nil otherwise." |
| 475 | (save-excursion | 475 | (save-excursion |
| 476 | (save-restriction | 476 | (save-restriction |
| 477 | (widen) | 477 | (widen) |
| @@ -605,7 +605,7 @@ Return t if there is work to do, nil otherwise." | |||
| 605 | (set-marker rng-conditional-up-to-date-start | 605 | (set-marker rng-conditional-up-to-date-start |
| 606 | pos))))))))) | 606 | pos))))))))) |
| 607 | have-remaining-chars)) | 607 | have-remaining-chars)) |
| 608 | 608 | ||
| 609 | (defun rng-clear-conditional-region () | 609 | (defun rng-clear-conditional-region () |
| 610 | (when rng-conditional-up-to-date-start | 610 | (when rng-conditional-up-to-date-start |
| 611 | (set-marker rng-conditional-up-to-date-start nil) | 611 | (set-marker rng-conditional-up-to-date-start nil) |
| @@ -784,7 +784,7 @@ Return t if there is work to do, nil otherwise." | |||
| 784 | (setq rng-message-overlay-current nil)) | 784 | (setq rng-message-overlay-current nil)) |
| 785 | 785 | ||
| 786 | ;;; Error navigation | 786 | ;;; Error navigation |
| 787 | 787 | ||
| 788 | (defun rng-maybe-echo-error-at-point () | 788 | (defun rng-maybe-echo-error-at-point () |
| 789 | (when (or (not (current-message)) | 789 | (when (or (not (current-message)) |
| 790 | (rng-current-message-from-error-overlay-p)) | 790 | (rng-current-message-from-error-overlay-p)) |
| @@ -830,8 +830,8 @@ Turn on `rng-validate-mode' if it is not already on." | |||
| 830 | (defun rng-next-error (arg) | 830 | (defun rng-next-error (arg) |
| 831 | "Go to the next validation error after point. | 831 | "Go to the next validation error after point. |
| 832 | Turn on `rng-validate-mode' if it is not already on. | 832 | Turn on `rng-validate-mode' if it is not already on. |
| 833 | A prefix ARG specifies how many errors to move. A negative ARG | 833 | A prefix ARG specifies how many errors to move. |
| 834 | moves backwards. Just \\[universal-argument] as a prefix | 834 | A negative ARG moves backwards. Just \\[universal-argument] as a prefix |
| 835 | means goto the first error." | 835 | means goto the first error." |
| 836 | (interactive "P") | 836 | (interactive "P") |
| 837 | (if (consp arg) | 837 | (if (consp arg) |
| @@ -845,8 +845,8 @@ means goto the first error." | |||
| 845 | (defun rng-previous-error (arg) | 845 | (defun rng-previous-error (arg) |
| 846 | "Go to the previous validation error before point. | 846 | "Go to the previous validation error before point. |
| 847 | Turn on `rng-validate-mode' if it is not already on. | 847 | Turn on `rng-validate-mode' if it is not already on. |
| 848 | A prefix ARG specifies how many errors to move. A negative ARG | 848 | A prefix ARG specifies how many errors to move. |
| 849 | moves forwards. Just \\[universal-argument] as a prefix | 849 | A negative ARG moves forwards. Just \\[universal-argument] as a prefix |
| 850 | means goto the first error." | 850 | means goto the first error." |
| 851 | (interactive "P") | 851 | (interactive "P") |
| 852 | (if (consp arg) | 852 | (if (consp arg) |
| @@ -866,7 +866,7 @@ means goto the first error." | |||
| 866 | (setq last-err err) | 866 | (setq last-err err) |
| 867 | (setq pos (overlay-start err))) | 867 | (setq pos (overlay-start err))) |
| 868 | (when (> arg 0) | 868 | (when (> arg 0) |
| 869 | (setq pos (max pos (1- rng-validate-up-to-date-end))) | 869 | (setq pos (max pos (1- rng-validate-up-to-date-end))) |
| 870 | (when (< rng-validate-up-to-date-end (point-max)) | 870 | (when (< rng-validate-up-to-date-end (point-max)) |
| 871 | (message "Parsing...") | 871 | (message "Parsing...") |
| 872 | (while (let ((more-to-do (rng-do-some-validation))) | 872 | (while (let ((more-to-do (rng-do-some-validation))) |
| @@ -917,7 +917,7 @@ means goto the first error." | |||
| 917 | (rng-goto-error-overlay last-err) | 917 | (rng-goto-error-overlay last-err) |
| 918 | (message "No previous errors") | 918 | (message "No previous errors") |
| 919 | nil))) | 919 | nil))) |
| 920 | 920 | ||
| 921 | (defun rng-goto-error-overlay (err) | 921 | (defun rng-goto-error-overlay (err) |
| 922 | "Goto the start of error overlay ERR and print its message." | 922 | "Goto the start of error overlay ERR and print its message." |
| 923 | (goto-char (overlay-start err)) | 923 | (goto-char (overlay-start err)) |
| @@ -1051,7 +1051,7 @@ Return nil at end of buffer, t otherwise." | |||
| 1051 | 1051 | ||
| 1052 | (defun rng-process-start-tag (tag-type) | 1052 | (defun rng-process-start-tag (tag-type) |
| 1053 | "TAG-TYPE is `start-tag' for a start-tag, `empty-element' for | 1053 | "TAG-TYPE is `start-tag' for a start-tag, `empty-element' for |
| 1054 | an empty element. partial-empty-element should be passed | 1054 | an empty element. `partial-empty-element' should be passed |
| 1055 | as empty-element." | 1055 | as empty-element." |
| 1056 | (and rng-collecting-text (rng-flush-text)) | 1056 | (and rng-collecting-text (rng-flush-text)) |
| 1057 | (setq rng-collecting-text nil) | 1057 | (setq rng-collecting-text nil) |
| @@ -1255,7 +1255,7 @@ as empty-element." | |||
| 1255 | (rng-name-to-string nm t))) | 1255 | (rng-name-to-string nm t))) |
| 1256 | required-attributes | 1256 | required-attributes |
| 1257 | ", ")))))) | 1257 | ", ")))))) |
| 1258 | 1258 | ||
| 1259 | (defun rng-process-end-tag (&optional partial) | 1259 | (defun rng-process-end-tag (&optional partial) |
| 1260 | (cond ((not rng-open-elements) | 1260 | (cond ((not rng-open-elements) |
| 1261 | (rng-mark-not-well-formed "Extra end-tag" | 1261 | (rng-mark-not-well-formed "Extra end-tag" |
| @@ -1386,9 +1386,9 @@ as empty-element." | |||
| 1386 | 1386 | ||
| 1387 | (defun rng-process-text (start end whitespace &optional value) | 1387 | (defun rng-process-text (start end whitespace &optional value) |
| 1388 | "Process characters between position START and END as text. | 1388 | "Process characters between position START and END as text. |
| 1389 | END nil means point. WHITESPACE t means known to be whitespace, nil | 1389 | END nil means point. WHITESPACE t means known to be whitespace, nil |
| 1390 | means known not to be, anything else means unknown whether whitespace | 1390 | means known not to be, anything else means unknown whether whitespace |
| 1391 | or not. END must not be nil if WHITESPACE is neither t nor nil. | 1391 | or not. END must not be nil if WHITESPACE is neither t nor nil. |
| 1392 | VALUE is a string or nil; nil means the value is equal to the | 1392 | VALUE is a string or nil; nil means the value is equal to the |
| 1393 | string between START and END." | 1393 | string between START and END." |
| 1394 | (cond (rng-collecting-text | 1394 | (cond (rng-collecting-text |
diff --git a/lisp/nxml/rng-xsd.el b/lisp/nxml/rng-xsd.el index 3d8e3a93016..64c6d052f01 100644 --- a/lisp/nxml/rng-xsd.el +++ b/lisp/nxml/rng-xsd.el | |||
| @@ -46,21 +46,22 @@ | |||
| 46 | 46 | ||
| 47 | ;;;###autoload | 47 | ;;;###autoload |
| 48 | (defun rng-xsd-compile (name params) | 48 | (defun rng-xsd-compile (name params) |
| 49 | "Provides W3C XML Schema as a RELAX NG datatypes library. NAME is a | 49 | "Provides W3C XML Schema as a RELAX NG datatypes library. |
| 50 | symbol giving the local name of the datatype. PARAMS is a list of | 50 | NAME is a symbol giving the local name of the datatype. PARAMS is a |
| 51 | pairs (PARAM-NAME . PARAM-VALUE) where PARAM-NAME is a symbol giving | 51 | list of pairs (PARAM-NAME . PARAM-VALUE) where PARAM-NAME is a symbol |
| 52 | the name of the parameter and PARAM-VALUE is a string giving its | 52 | giving the name of the parameter and PARAM-VALUE is a string giving |
| 53 | value. If NAME or PARAMS are invalid, it calls rng-dt-error passing | 53 | its value. If NAME or PARAMS are invalid, it calls rng-dt-error |
| 54 | it arguments in the same style as format; the value from rng-dt-error | 54 | passing it arguments in the same style as format; the value from |
| 55 | will be returned. Otherwise, it returns a list. The first member of | 55 | rng-dt-error will be returned. Otherwise, it returns a list. The |
| 56 | the list is t if any string is a legal value for the datatype and nil | 56 | first member of the list is t if any string is a legal value for the |
| 57 | otherwise. The second argument is a symbol; this symbol will be | 57 | datatype and nil otherwise. The second argument is a symbol; this |
| 58 | called as a function passing it a string followed by the remaining | 58 | symbol will be called as a function passing it a string followed by |
| 59 | members of the list. The function must return an object representing | 59 | the remaining members of the list. The function must return an object |
| 60 | the value of the datatype that was represented by the string, or nil | 60 | representing the value of the datatype that was represented by the |
| 61 | if the string is not a representation of any value. The object | 61 | string, or nil if the string is not a representation of any value. |
| 62 | returned can be any convenient non-nil value, provided that, if two | 62 | The object returned can be any convenient non-nil value, provided |
| 63 | strings represent the same value, the returned objects must be equal." | 63 | that, if two strings represent the same value, the returned objects |
| 64 | must be equal." | ||
| 64 | (let ((convert (get name 'rng-xsd-convert))) | 65 | (let ((convert (get name 'rng-xsd-convert))) |
| 65 | (if (not convert) | 66 | (if (not convert) |
| 66 | (rng-dt-error "There is no XSD datatype named %s" name) | 67 | (rng-dt-error "There is no XSD datatype named %s" name) |
| @@ -144,7 +145,7 @@ strings represent the same value, the returned objects must be equal." | |||
| 144 | ((memq param-name '(enumeration whiteSpace)) | 145 | ((memq param-name '(enumeration whiteSpace)) |
| 145 | (rng-dt-error "Facet %s cannot be used in RELAX NG" param-name)) | 146 | (rng-dt-error "Facet %s cannot be used in RELAX NG" param-name)) |
| 146 | (t (rng-dt-error "Unknown facet %s" param-name)))))) | 147 | (t (rng-dt-error "Unknown facet %s" param-name)))))) |
| 147 | 148 | ||
| 148 | (defun rng-xsd-string-to-non-negative-integer (str) | 149 | (defun rng-xsd-string-to-non-negative-integer (str) |
| 149 | (and (rng-xsd-convert-integer str) | 150 | (and (rng-xsd-convert-integer str) |
| 150 | (let ((n (string-to-number str))) | 151 | (let ((n (string-to-number str))) |
| @@ -240,16 +241,16 @@ strings represent the same value, the returned objects must be equal." | |||
| 240 | (and (string-match regexp str) | 241 | (and (string-match regexp str) |
| 241 | (apply convert (cons str args)))) | 242 | (apply convert (cons str args)))) |
| 242 | 243 | ||
| 243 | 244 | ||
| 244 | (defun rng-xsd-convert-boolean (string) | 245 | (defun rng-xsd-convert-boolean (string) |
| 245 | (and (string-match "\\`[ \t\n\r]*\\(?:\\(true\\|1\\)\\|false\\|0\\)[ \t\n\r]*\\'" string) | 246 | (and (string-match "\\`[ \t\n\r]*\\(?:\\(true\\|1\\)\\|false\\|0\\)[ \t\n\r]*\\'" string) |
| 246 | (if (match-beginning 1) 'true 'false))) | 247 | (if (match-beginning 1) 'true 'false))) |
| 247 | 248 | ||
| 248 | (defun rng-xsd-convert-decimal (string) | 249 | (defun rng-xsd-convert-decimal (string) |
| 249 | "Convert a string representing a decimal to an object representing | 250 | "Convert a string representing a decimal to an object representing it values. |
| 250 | its values. A decimal value is represented by a vector [SIGN | 251 | A decimal value is represented by a vector [SIGN INTEGER-DIGITS |
| 251 | INTEGER-DIGITS FRACTION-DIGITS] where SIGN is 1 or -1, INTEGER-DIGITS | 252 | FRACTION-DIGITS] where SIGN is 1 or -1, INTEGER-DIGITS is a string |
| 252 | is a string containing zero or more digits, with no leading zero, and | 253 | containing zero or more digits, with no leading zero, and |
| 253 | FRACTION-DIGITS is a string containing zero or more digits with no | 254 | FRACTION-DIGITS is a string containing zero or more digits with no |
| 254 | trailing digits. For example, -0021.0430 would be represented by [-1 | 255 | trailing digits. For example, -0021.0430 would be represented by [-1 |
| 255 | \"21\" \"043\"]." | 256 | \"21\" \"043\"]." |
| @@ -318,12 +319,12 @@ trailing digits. For example, -0021.0430 would be represented by [-1 | |||
| 318 | ((match-beginning 3) -1.0e+INF) | 319 | ((match-beginning 3) -1.0e+INF) |
| 319 | ;; Don't use a NaN float because we want NaN to be equal to NaN | 320 | ;; Don't use a NaN float because we want NaN to be equal to NaN |
| 320 | ((match-beginning 4) 'NaN))) | 321 | ((match-beginning 4) 'NaN))) |
| 321 | 322 | ||
| 322 | (defun rng-xsd-float< (f1 f2) | 323 | (defun rng-xsd-float< (f1 f2) |
| 323 | (and (not (eq f1 'NaN)) | 324 | (and (not (eq f1 'NaN)) |
| 324 | (not (eq f2 'NaN)) | 325 | (not (eq f2 'NaN)) |
| 325 | (< f1 f2))) | 326 | (< f1 f2))) |
| 326 | 327 | ||
| 327 | (defun rng-xsd-convert-token (string regexp) | 328 | (defun rng-xsd-convert-token (string regexp) |
| 328 | (and (string-match regexp string) | 329 | (and (string-match regexp string) |
| 329 | (match-string 1 string))) | 330 | (match-string 1 string))) |
| @@ -342,7 +343,7 @@ trailing digits. For example, -0021.0430 would be represented by [-1 | |||
| 342 | (B16 "[AEIMQUYcgkosw048]") | 343 | (B16 "[AEIMQUYcgkosw048]") |
| 343 | (B64 "[A-Za-z0-9+/]")) | 344 | (B64 "[A-Za-z0-9+/]")) |
| 344 | (concat "\\`" S "\\(?:\\(?:" B64 S "\\)\\{4\\}\\)*" | 345 | (concat "\\`" S "\\(?:\\(?:" B64 S "\\)\\{4\\}\\)*" |
| 345 | "\\(?:" B64 S B64 S B16 S "=" S | 346 | "\\(?:" B64 S B64 S B16 S "=" S |
| 346 | "\\|" B64 S B04 S "=" S "=" S "\\)?\\'"))) | 347 | "\\|" B64 S B04 S "=" S "=" S "\\)?\\'"))) |
| 347 | 348 | ||
| 348 | (defun rng-xsd-convert-base64-binary (string) | 349 | (defun rng-xsd-convert-base64-binary (string) |
| @@ -365,11 +366,11 @@ trailing digits. For example, -0021.0430 would be represented by [-1 | |||
| 365 | string)) | 366 | string)) |
| 366 | 367 | ||
| 367 | (defun rng-xsd-make-date-time-regexp (template) | 368 | (defun rng-xsd-make-date-time-regexp (template) |
| 368 | "Returns a regular expression matching a ISO 8601 date/time. The | 369 | "Returns a regular expression matching a ISO 8601 date/time. |
| 369 | template is a string with Y standing for years field, M standing for | 370 | The template is a string with Y standing for years field, M standing |
| 370 | months, D standing for day of month, T standing for a literal T, t | 371 | for months, D standing for day of month, T standing for a literal T, t |
| 371 | standing for time and - standing for a literal hyphen. A time zone is | 372 | standing for time and - standing for a literal hyphen. A time zone is |
| 372 | always allowed at the end. Regardless of the fields appearing in the | 373 | always allowed at the end. Regardless of the fields appearing in the |
| 373 | template, the regular expression will have twelve groups matching the | 374 | template, the regular expression will have twelve groups matching the |
| 374 | year sign, year, month, day of month, hours, minutes, integer seconds, | 375 | year sign, year, month, day of month, hours, minutes, integer seconds, |
| 375 | fractional seconds (including leading period), time zone, time zone | 376 | fractional seconds (including leading period), time zone, time zone |
| @@ -433,16 +434,16 @@ sign, time zone hours, time zone minutes." | |||
| 433 | (aset v i total) | 434 | (aset v i total) |
| 434 | (setq i (1+ i))) | 435 | (setq i (1+ i))) |
| 435 | v)) | 436 | v)) |
| 436 | 437 | ||
| 437 | (defun rng-xsd-convert-date-time (string regexp) | 438 | (defun rng-xsd-convert-date-time (string regexp) |
| 438 | "Converts an XML Schema date/time to a list. Returns nil if | 439 | "Converts an XML Schema date/time to a list. |
| 439 | invalid. REGEXP is a regexp for parsing the date time as returned by | 440 | Returns nil if invalid. REGEXP is a regexp for parsing the date time |
| 440 | `rng-xsd-make-date-time-regexp'. The list has 4 members (HAS-TIME-ZONE | 441 | as returned by `rng-xsd-make-date-time-regexp'. The list has 4 members |
| 441 | DAY SECOND SECOND-FRACTION), where HAS-TIME-ZONE is t or nil depending | 442 | \(HAS-TIME-ZONE DAY SECOND SECOND-FRACTION), where HAS-TIME-ZONE is t |
| 442 | on whether a time zone was specified, DAY is an integer giving a day | 443 | or nil depending on whether a time zone was specified, DAY is an |
| 443 | number (with Jan 1 1AD being day 1), SECOND is the second within that | 444 | integer giving a day number (with Jan 1 1AD being day 1), SECOND is the |
| 444 | day, and SECOND-FRACTION is a float giving the fractional part of the | 445 | second within that day, and SECOND-FRACTION is a float giving the |
| 445 | second." | 446 | fractional part of the second." |
| 446 | (and (string-match regexp string) | 447 | (and (string-match regexp string) |
| 447 | (let ((year-sign (match-string 1 string)) | 448 | (let ((year-sign (match-string 1 string)) |
| 448 | (year (match-string 2 string)) | 449 | (year (match-string 2 string)) |
| @@ -547,7 +548,7 @@ second." | |||
| 547 | (setq numbers2 (cdr numbers2))) | 548 | (setq numbers2 (cdr numbers2))) |
| 548 | (and numbers1 | 549 | (and numbers1 |
| 549 | (< (car numbers1) (car numbers2)))) | 550 | (< (car numbers1) (car numbers2)))) |
| 550 | 551 | ||
| 551 | (defun rng-xsd-date-to-days (year month day) | 552 | (defun rng-xsd-date-to-days (year month day) |
| 552 | "Return a unique day number where Jan 1 1 AD is day 1" | 553 | "Return a unique day number where Jan 1 1 AD is day 1" |
| 553 | (if (> year 0) ; AD | 554 | (if (> year 0) ; AD |
| @@ -596,7 +597,7 @@ second." | |||
| 596 | (let ((start (match-beginning (+ i 2)))) | 597 | (let ((start (match-beginning (+ i 2)))) |
| 597 | (when start | 598 | (when start |
| 598 | (aset v i (* sign | 599 | (aset v i (* sign |
| 599 | (string-to-number | 600 | (string-to-number |
| 600 | (substring string | 601 | (substring string |
| 601 | start | 602 | start |
| 602 | (1- (match-end (+ i 2))))))))) | 603 | (1- (match-end (+ i 2))))))))) |
| @@ -604,7 +605,7 @@ second." | |||
| 604 | ;; Force seconds to be float so that equal works properly. | 605 | ;; Force seconds to be float so that equal works properly. |
| 605 | (aset v 5 (float (aref v 5))) | 606 | (aset v 5 (float (aref v 5))) |
| 606 | v))) | 607 | v))) |
| 607 | 608 | ||
| 608 | (defconst rng-xsd-min-seconds-per-month (* 28 rng-xsd-seconds-per-day)) | 609 | (defconst rng-xsd-min-seconds-per-month (* 28 rng-xsd-seconds-per-day)) |
| 609 | 610 | ||
| 610 | (defun rng-xsd-duration< (d1 d2) | 611 | (defun rng-xsd-duration< (d1 d2) |
| @@ -681,7 +682,7 @@ MONTHS must be an integer >= 0." | |||
| 681 | (+ (* (/ months rng-xsd-months-per-gregorian-cycle) | 682 | (+ (* (/ months rng-xsd-months-per-gregorian-cycle) |
| 682 | rng-xsd-days-per-gregorian-cycle) | 683 | rng-xsd-days-per-gregorian-cycle) |
| 683 | days))) | 684 | days))) |
| 684 | 685 | ||
| 685 | (defun rng-xsd-duration-months (d) | 686 | (defun rng-xsd-duration-months (d) |
| 686 | (+ (* (aref d 0) 12) | 687 | (+ (* (aref d 0) 12) |
| 687 | (aref d 1))) | 688 | (aref d 1))) |
| @@ -694,7 +695,7 @@ MONTHS must be an integer >= 0." | |||
| 694 | (aref d 4)) | 695 | (aref d 4)) |
| 695 | 60.0) | 696 | 60.0) |
| 696 | (aref d 5))) | 697 | (aref d 5))) |
| 697 | 698 | ||
| 698 | (defun rng-xsd-convert-qname (string) | 699 | (defun rng-xsd-convert-qname (string) |
| 699 | (and (string-match "\\`[ \r\n\t]*\\([_[:alpha:]][-._[:alnum:]]*\\(:[_[:alpha:]][-._[:alnum:]]*\\)?\\)[ \r\n\t]*\\'" string) | 700 | (and (string-match "\\`[ \r\n\t]*\\([_[:alpha:]][-._[:alnum:]]*\\(:[_[:alpha:]][-._[:alnum:]]*\\)?\\)[ \r\n\t]*\\'" string) |
| 700 | (let ((colon (match-beginning 2)) | 701 | (let ((colon (match-beginning 2)) |
| @@ -712,7 +713,7 @@ MONTHS must be an integer >= 0." | |||
| 712 | (match-end 1))))) | 713 | (match-end 1))))) |
| 713 | (cons (car context) | 714 | (cons (car context) |
| 714 | (match-string 1 string)))))) | 715 | (match-string 1 string)))))) |
| 715 | 716 | ||
| 716 | (defun rng-xsd-convert-list (string convert &rest args) | 717 | (defun rng-xsd-convert-list (string convert &rest args) |
| 717 | (let* ((tokens (split-string string "[ \t\n\r]+")) | 718 | (let* ((tokens (split-string string "[ \t\n\r]+")) |
| 718 | (tem tokens)) | 719 | (tem tokens)) |
| @@ -770,7 +771,7 @@ MONTHS must be an integer >= 0." | |||
| 770 | (defun rng-xsd-def-integer-type (name min max) | 771 | (defun rng-xsd-def-integer-type (name min max) |
| 771 | (put name 'rng-xsd-less-than 'rng-xsd-decimal<) | 772 | (put name 'rng-xsd-less-than 'rng-xsd-decimal<) |
| 772 | (put name | 773 | (put name |
| 773 | 'rng-xsd-convert | 774 | 'rng-xsd-convert |
| 774 | (cdr (rng-xsd-compile 'integer | 775 | (cdr (rng-xsd-compile 'integer |
| 775 | (append (and min `((minInclusive . ,min))) | 776 | (append (and min `((minInclusive . ,min))) |
| 776 | (and max `((maxInclusive . ,max)))))))) | 777 | (and max `((maxInclusive . ,max)))))))) |
diff --git a/lisp/nxml/xmltok.el b/lisp/nxml/xmltok.el index 1c20d63d9fc..138d8e74a6b 100644 --- a/lisp/nxml/xmltok.el +++ b/lisp/nxml/xmltok.el | |||
| @@ -117,8 +117,8 @@ first member of the alist is t if references to entities not in the | |||
| 117 | alist are well-formed \(e.g. because there's an external subset that | 117 | alist are well-formed \(e.g. because there's an external subset that |
| 118 | wasn't parsed). | 118 | wasn't parsed). |
| 119 | 119 | ||
| 120 | Each general entity name is a string. The definition is either nil, a | 120 | Each general entity name is a string. The definition is either nil, |
| 121 | symbol, a string, a cons cell. If the definition is nil, then it | 121 | a symbol, a string, a cons cell. If the definition is nil, then it |
| 122 | means that it's an internal entity but the result of parsing it is | 122 | means that it's an internal entity but the result of parsing it is |
| 123 | unknown. If it is a symbol, then the symbol is either `unparsed', | 123 | unknown. If it is a symbol, then the symbol is either `unparsed', |
| 124 | meaning the entity is an unparsed entity, `external', meaning the | 124 | meaning the entity is an unparsed entity, `external', meaning the |
| @@ -126,9 +126,9 @@ entity is or references an external entity, `element', meaning the | |||
| 126 | entity includes one or more elements, or `not-well-formed', meaning | 126 | entity includes one or more elements, or `not-well-formed', meaning |
| 127 | the replacement text is not well-formed. If the definition is a | 127 | the replacement text is not well-formed. If the definition is a |
| 128 | string, then the replacement text of the entity is that string; this | 128 | string, then the replacement text of the entity is that string; this |
| 129 | happens only during the parsing of the prolog. If the definition is a | 129 | happens only during the parsing of the prolog. If the definition is |
| 130 | cons cell \(ER . AR), then ER specifies the string that results from | 130 | a cons cell \(ER . AR), then ER specifies the string that results |
| 131 | referencing the entity in element content and AR is either nil, | 131 | from referencing the entity in element content and AR is either nil, |
| 132 | meaning the replacement text included a <, or a string which is the | 132 | meaning the replacement text included a <, or a string which is the |
| 133 | normalized attribute value.") | 133 | normalized attribute value.") |
| 134 | 134 | ||
| @@ -151,9 +151,9 @@ arguments followed by the additional arguments if any: the position of | |||
| 151 | the start of the changed area in the region, the position of the end | 151 | the start of the changed area in the region, the position of the end |
| 152 | of the changed area in the region, the length of the changed area | 152 | of the changed area in the region, the length of the changed area |
| 153 | before the change, the position of the start of the region, the | 153 | before the change, the position of the start of the region, the |
| 154 | position of the end of the region. FUN must return non-nil if the | 154 | position of the end of the region. FUN must return non-nil if the |
| 155 | region needs reparsing. FUN will be called in a save-excursion with | 155 | region needs reparsing. FUN will be called in a `save-excursion' |
| 156 | match-data saved. | 156 | with match-data saved. |
| 157 | 157 | ||
| 158 | `xmltok-forward', `xmltok-forward-special' and `xmltok-forward-prolog' | 158 | `xmltok-forward', `xmltok-forward-special' and `xmltok-forward-prolog' |
| 159 | may add entries to the beginning of this list, but will not clear it. | 159 | may add entries to the beginning of this list, but will not clear it. |
| @@ -200,16 +200,16 @@ indicating the position of the error.") | |||
| 200 | 200 | ||
| 201 | (defsubst xmltok-attribute-raw-normalized-value (att) | 201 | (defsubst xmltok-attribute-raw-normalized-value (att) |
| 202 | "Return an object representing the normalized value of ATT. | 202 | "Return an object representing the normalized value of ATT. |
| 203 | This can t indicating that the normalized value is the same as the | 203 | This can be t indicating that the normalized value is the same as |
| 204 | buffer substring from the start to the end of the value or nil | 204 | the buffer substring from the start to the end of the value, or nil |
| 205 | indicating that the value is not well-formed or a string." | 205 | indicating that the value is not well-formed or a string." |
| 206 | (aref att 5)) | 206 | (aref att 5)) |
| 207 | 207 | ||
| 208 | (defsubst xmltok-attribute-refs (att) | 208 | (defsubst xmltok-attribute-refs (att) |
| 209 | "Return a list of the entity and character references in ATT. | 209 | "Return a list of the entity and character references in ATT. |
| 210 | Each member is a vector [TYPE START END] where TYPE is either char-ref | 210 | Each member is a vector [TYPE START END] where TYPE is either char-ref |
| 211 | or entity-ref and START and END are integers giving the start and end | 211 | or entity-ref and START and END are integers giving the start and end of |
| 212 | of the reference. Nested entity references are not included in the list." | 212 | the reference. Nested entity references are not included in the list." |
| 213 | (aref att 6)) | 213 | (aref att 6)) |
| 214 | 214 | ||
| 215 | (defun xmltok-attribute-prefix (att) | 215 | (defun xmltok-attribute-prefix (att) |
| @@ -267,9 +267,10 @@ of the reference. Nested entity references are not included in the list." | |||
| 267 | value-begin | 267 | value-begin |
| 268 | value-end | 268 | value-end |
| 269 | raw-normalized-value) | 269 | raw-normalized-value) |
| 270 | "Make an attribute. RAW-NORMALIZED-VALUE is nil if the value is | 270 | "Make an attribute. |
| 271 | not well-formed, t if the normalized value is the string between | 271 | RAW-NORMALIZED-VALUE is nil if the value is not well-formed, |
| 272 | VALUE-BEGIN and VALUE-END, otherwise a STRING giving the value." | 272 | t if the normalized value is the string between VALUE-BEGIN |
| 273 | and VALUE-END, otherwise a STRING giving the value." | ||
| 273 | (vector name-begin | 274 | (vector name-begin |
| 274 | name-colon | 275 | name-colon |
| 275 | name-end | 276 | name-end |
| @@ -351,8 +352,8 @@ VALUE-BEGIN and VALUE-END, otherwise a STRING giving the value." | |||
| 351 | "Scan forward past the first special token starting at or after point. | 352 | "Scan forward past the first special token starting at or after point. |
| 352 | Return nil if there is no special token that starts before BOUND. | 353 | Return nil if there is no special token that starts before BOUND. |
| 353 | CDATA sections, processing instructions and comments (and indeed | 354 | CDATA sections, processing instructions and comments (and indeed |
| 354 | anything starting with < following by ? or !) count | 355 | anything starting with < following by ? or !) count as special. |
| 355 | as special. Return the type of the token." | 356 | Return the type of the token." |
| 356 | (when (re-search-forward "<[?!]" (1+ bound) t) | 357 | (when (re-search-forward "<[?!]" (1+ bound) t) |
| 357 | (setq xmltok-start (match-beginning 0)) | 358 | (setq xmltok-start (match-beginning 0)) |
| 358 | (goto-char (1+ xmltok-start)) | 359 | (goto-char (1+ xmltok-start)) |
| @@ -392,7 +393,7 @@ as special. Return the type of the token." | |||
| 392 | (cons (concat "\\(" ,sym "\\)") (cons ',name nil)) | 393 | (cons (concat "\\(" ,sym "\\)") (cons ',name nil)) |
| 393 | (cons (concat "\\(" (car ,sym) "\\)") (cons ',name (cdr ,sym))))))) | 394 | (cons (concat "\\(" (car ,sym) "\\)") (cons ',name (cdr ,sym))))))) |
| 394 | 395 | ||
| 395 | (defun xmltok-p (&rest r) (xmltok+ "\\(?:" | 396 | (defun xmltok-p (&rest r) (xmltok+ "\\(?:" |
| 396 | (apply 'xmltok+ r) | 397 | (apply 'xmltok+ r) |
| 397 | "\\)")) | 398 | "\\)")) |
| 398 | 399 | ||
| @@ -443,7 +444,7 @@ as special. Return the type of the token." | |||
| 443 | (list 'match-string-no-properties | 444 | (list 'match-string-no-properties |
| 444 | (xmltok-get-index group-name ',(cdr r)))) | 445 | (xmltok-get-index group-name ',(cdr r)))) |
| 445 | (t (error "Invalid action: %s" action)))))))) | 446 | (t (error "Invalid action: %s" action)))))))) |
| 446 | 447 | ||
| 447 | 448 | ||
| 448 | (eval-when-compile | 449 | (eval-when-compile |
| 449 | (let* ((or "\\|") | 450 | (let* ((or "\\|") |
| @@ -792,7 +793,7 @@ as special. Return the type of the token." | |||
| 792 | (+ xmltok-start 2) | 793 | (+ xmltok-start 2) |
| 793 | (+ xmltok-start 5)))) | 794 | (+ xmltok-start 5)))) |
| 794 | (setq xmltok-type 'processing-instruction)))) | 795 | (setq xmltok-type 'processing-instruction)))) |
| 795 | 796 | ||
| 796 | (defun xmltok-scan-after-comment-open () | 797 | (defun xmltok-scan-after-comment-open () |
| 797 | (setq xmltok-type | 798 | (setq xmltok-type |
| 798 | (cond ((not (search-forward "--" nil t)) | 799 | (cond ((not (search-forward "--" nil t)) |
| @@ -932,7 +933,7 @@ as special. Return the type of the token." | |||
| 932 | (cons att xmltok-attributes))) | 933 | (cons att xmltok-attributes))) |
| 933 | (and needs-normalizing | 934 | (and needs-normalizing |
| 934 | att))) | 935 | att))) |
| 935 | 936 | ||
| 936 | (defun xmltok-normalize-attribute (att) | 937 | (defun xmltok-normalize-attribute (att) |
| 937 | (let ((end (xmltok-attribute-value-end att)) | 938 | (let ((end (xmltok-attribute-value-end att)) |
| 938 | (well-formed t) | 939 | (well-formed t) |
| @@ -1083,7 +1084,7 @@ as special. Return the type of the token." | |||
| 1083 | delimiter))) | 1084 | delimiter))) |
| 1084 | 1085 | ||
| 1085 | (defun xmltok-valid-char-p (n) | 1086 | (defun xmltok-valid-char-p (n) |
| 1086 | "Return non-nil if n is the Unicode code of a valid XML character." | 1087 | "Return non-nil if N is the Unicode code of a valid XML character." |
| 1087 | (cond ((< n #x20) (memq n '(#xA #xD #x9))) | 1088 | (cond ((< n #x20) (memq n '(#xA #xD #x9))) |
| 1088 | ((< n #xD800) t) | 1089 | ((< n #xD800) t) |
| 1089 | ((< n #xE000) nil) | 1090 | ((< n #xE000) nil) |
| @@ -1104,7 +1105,7 @@ Return nil if unsupported in Emacs." | |||
| 1104 | (defvar xmltok-had-param-entity-ref nil) | 1105 | (defvar xmltok-had-param-entity-ref nil) |
| 1105 | (defvar xmltok-prolog-regions nil) | 1106 | (defvar xmltok-prolog-regions nil) |
| 1106 | (defvar xmltok-standalone nil | 1107 | (defvar xmltok-standalone nil |
| 1107 | "Non-nil if there was an XML declaration specifying standalone=\"yes\",") | 1108 | "Non-nil if there was an XML declaration specifying standalone=\"yes\".") |
| 1108 | (defvar xmltok-markup-declaration-doctype-flag nil) | 1109 | (defvar xmltok-markup-declaration-doctype-flag nil) |
| 1109 | 1110 | ||
| 1110 | (defconst xmltok-predefined-entity-alist | 1111 | (defconst xmltok-predefined-entity-alist |
| @@ -1122,7 +1123,7 @@ START and END are integers giving the start and end of the region of | |||
| 1122 | that type. TYPE can be one of xml-declaration, | 1123 | that type. TYPE can be one of xml-declaration, |
| 1123 | xml-declaration-attribute-name, xml-declaration-attribute-value, | 1124 | xml-declaration-attribute-name, xml-declaration-attribute-value, |
| 1124 | comment, processing-instruction-left, processing-instruction-right, | 1125 | comment, processing-instruction-left, processing-instruction-right, |
| 1125 | markup-declaration-open. markup-declaration-close, | 1126 | markup-declaration-open, markup-declaration-close, |
| 1126 | internal-subset-open, internal-subset-close, hash-name, keyword, | 1127 | internal-subset-open, internal-subset-close, hash-name, keyword, |
| 1127 | literal, encoding-name. | 1128 | literal, encoding-name. |
| 1128 | Adds to `xmltok-errors' and `xmltok-dependent-regions' as appropriate." | 1129 | Adds to `xmltok-errors' and `xmltok-dependent-regions' as appropriate." |
| @@ -1163,8 +1164,8 @@ contains an encoding declaration, then return (START . END) | |||
| 1163 | where START and END are the positions of the start and the end | 1164 | where START and END are the positions of the start and the end |
| 1164 | of the encoding name; if there is no encoding declaration return | 1165 | of the encoding name; if there is no encoding declaration return |
| 1165 | the position where and encoding declaration could be inserted. | 1166 | the position where and encoding declaration could be inserted. |
| 1166 | If there is XML that is not well-formed that looks like an XML declaration, | 1167 | If there is XML that is not well-formed that looks like an XML |
| 1167 | return nil. Otherwise, return t. | 1168 | declaration, return nil. Otherwise, return t. |
| 1168 | If LIMIT is non-nil, then do not consider characters beyond LIMIT." | 1169 | If LIMIT is non-nil, then do not consider characters beyond LIMIT." |
| 1169 | (cond ((let ((case-fold-search nil)) | 1170 | (cond ((let ((case-fold-search nil)) |
| 1170 | (and (looking-at (xmltok-xml-declaration regexp)) | 1171 | (and (looking-at (xmltok-xml-declaration regexp)) |
| @@ -1177,7 +1178,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT." | |||
| 1177 | (+ (point) 5))))) | 1178 | (+ (point) 5))))) |
| 1178 | ((not (let ((case-fold-search t)) | 1179 | ((not (let ((case-fold-search t)) |
| 1179 | (looking-at xmltok-bad-xml-decl-regexp)))))) | 1180 | (looking-at xmltok-bad-xml-decl-regexp)))))) |
| 1180 | 1181 | ||
| 1181 | (defun xmltok-scan-xml-declaration () | 1182 | (defun xmltok-scan-xml-declaration () |
| 1182 | (when (looking-at (xmltok-xml-declaration regexp)) | 1183 | (when (looking-at (xmltok-xml-declaration regexp)) |
| 1183 | (xmltok-add-prolog-region 'xml-declaration (point) (match-end 0)) | 1184 | (xmltok-add-prolog-region 'xml-declaration (point) (match-end 0)) |
| @@ -1337,7 +1338,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT." | |||
| 1337 | (when (string= (xmltok-current-token-string) "#FIXED") | 1338 | (when (string= (xmltok-current-token-string) "#FIXED") |
| 1338 | (xmltok-require-next-token 'literal)) | 1339 | (xmltok-require-next-token 'literal)) |
| 1339 | t)))) | 1340 | t)))) |
| 1340 | 1341 | ||
| 1341 | (defun xmltok-parse-nmtoken-group () | 1342 | (defun xmltok-parse-nmtoken-group () |
| 1342 | (while (progn | 1343 | (while (progn |
| 1343 | (xmltok-require-next-token 'nmtoken 'prefixed-name 'name) | 1344 | (xmltok-require-next-token 'nmtoken 'prefixed-name 'name) |
| @@ -1378,7 +1379,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT." | |||
| 1378 | 'close-paren-star | 1379 | 'close-paren-star |
| 1379 | 'close-paren-occur) | 1380 | 'close-paren-occur) |
| 1380 | (eq xmltok-type connector)))))) | 1381 | (eq xmltok-type connector)))))) |
| 1381 | 1382 | ||
| 1382 | (defun xmltok-parse-model-group-member () | 1383 | (defun xmltok-parse-model-group-member () |
| 1383 | (xmltok-require-token 'name | 1384 | (xmltok-require-token 'name |
| 1384 | 'prefixed-name | 1385 | 'prefixed-name |
| @@ -1387,7 +1388,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT." | |||
| 1387 | (when (eq xmltok-type ?\() | 1388 | (when (eq xmltok-type ?\() |
| 1388 | (xmltok-next-prolog-token) | 1389 | (xmltok-next-prolog-token) |
| 1389 | (xmltok-parse-model-group))) | 1390 | (xmltok-parse-model-group))) |
| 1390 | 1391 | ||
| 1391 | (defun xmltok-parse-entity-declaration () | 1392 | (defun xmltok-parse-entity-declaration () |
| 1392 | (let (paramp name) | 1393 | (let (paramp name) |
| 1393 | (xmltok-require-next-token 'name ?%) | 1394 | (xmltok-require-next-token 'name ?%) |
| @@ -1418,7 +1419,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT." | |||
| 1418 | (not (assoc name xmltok-dtd))) | 1419 | (not (assoc name xmltok-dtd))) |
| 1419 | (setq xmltok-dtd | 1420 | (setq xmltok-dtd |
| 1420 | (cons (cons name value) xmltok-dtd)))) | 1421 | (cons (cons name value) xmltok-dtd)))) |
| 1421 | 1422 | ||
| 1422 | (defun xmltok-parse-entity-value () | 1423 | (defun xmltok-parse-entity-value () |
| 1423 | (let ((lim (1- (point))) | 1424 | (let ((lim (1- (point))) |
| 1424 | (well-formed t) | 1425 | (well-formed t) |
| @@ -1458,7 +1459,7 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT." | |||
| 1458 | (apply 'concat | 1459 | (apply 'concat |
| 1459 | (nreverse (cons (buffer-substring-no-properties start lim) | 1460 | (nreverse (cons (buffer-substring-no-properties start lim) |
| 1460 | value-parts)))))) | 1461 | value-parts)))))) |
| 1461 | 1462 | ||
| 1462 | (defun xmltok-parse-notation-declaration () | 1463 | (defun xmltok-parse-notation-declaration () |
| 1463 | (xmltok-require-next-token 'name) | 1464 | (xmltok-require-next-token 'name) |
| 1464 | (xmltok-require-next-token "SYSTEM" "PUBLIC") | 1465 | (xmltok-require-next-token "SYSTEM" "PUBLIC") |
| @@ -1543,9 +1544,9 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT." | |||
| 1543 | (hash-name . hash-name))))) | 1544 | (hash-name . hash-name))))) |
| 1544 | ((and (stringp required) (eq xmltok-type 'name)) | 1545 | ((and (stringp required) (eq xmltok-type 'name)) |
| 1545 | 'keyword))) | 1546 | 'keyword))) |
| 1546 | 1547 | ||
| 1547 | ;; Return new token type. | 1548 | ;; Return new token type. |
| 1548 | 1549 | ||
| 1549 | (defun xmltok-next-prolog-token () | 1550 | (defun xmltok-next-prolog-token () |
| 1550 | (skip-chars-forward " \t\r\n") | 1551 | (skip-chars-forward " \t\r\n") |
| 1551 | (setq xmltok-start (point)) | 1552 | (setq xmltok-start (point)) |
| @@ -1573,13 +1574,13 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT." | |||
| 1573 | (unless (looking-at "[ \t\r\n>),|[%]") | 1574 | (unless (looking-at "[ \t\r\n>),|[%]") |
| 1574 | (xmltok-add-error "Missing space after name token")) | 1575 | (xmltok-add-error "Missing space after name token")) |
| 1575 | (setq xmltok-type 'nmtoken)) | 1576 | (setq xmltok-type 'nmtoken)) |
| 1576 | ((xmltok-prolog start name) | 1577 | ((xmltok-prolog start name) |
| 1577 | (setq xmltok-name-end (point)) | 1578 | (setq xmltok-name-end (point)) |
| 1578 | (setq xmltok-name-colon nil) | 1579 | (setq xmltok-name-colon nil) |
| 1579 | (unless (looking-at "[ \t\r\n>),|[%]") | 1580 | (unless (looking-at "[ \t\r\n>),|[%]") |
| 1580 | (xmltok-add-error "Missing space after name")) | 1581 | (xmltok-add-error "Missing space after name")) |
| 1581 | (setq xmltok-type 'name)) | 1582 | (setq xmltok-type 'name)) |
| 1582 | ((xmltok-prolog start hash-name) | 1583 | ((xmltok-prolog start hash-name) |
| 1583 | (setq xmltok-name-end (point)) | 1584 | (setq xmltok-name-end (point)) |
| 1584 | (unless (looking-at "[ \t\r\n>)|%]") | 1585 | (unless (looking-at "[ \t\r\n>)|%]") |
| 1585 | (xmltok-add-error "Missing space after name")) | 1586 | (xmltok-add-error "Missing space after name")) |
| @@ -1748,10 +1749,10 @@ Processing instruction does not start with a name" | |||
| 1748 | (while todo | 1749 | (while todo |
| 1749 | (xmltok-parse-entity (car todo)) | 1750 | (xmltok-parse-entity (car todo)) |
| 1750 | (setq todo (cdr todo))))) | 1751 | (setq todo (cdr todo))))) |
| 1751 | 1752 | ||
| 1752 | (defun xmltok-parse-entity (name-def) | 1753 | (defun xmltok-parse-entity (name-def) |
| 1753 | (let ((def (cdr name-def)) | 1754 | (let ((def (cdr name-def)) |
| 1754 | ;; in case its value is buffer local | 1755 | ;; in case its value is buffer local |
| 1755 | (xmltok-dtd xmltok-dtd) | 1756 | (xmltok-dtd xmltok-dtd) |
| 1756 | buf) | 1757 | buf) |
| 1757 | (when (stringp def) | 1758 | (when (stringp def) |
| @@ -1855,7 +1856,7 @@ Processing instruction does not start with a name" | |||
| 1855 | 'not-well-formed)) | 1856 | 'not-well-formed)) |
| 1856 | ((eq def 'unparsed) 'not-well-formed) | 1857 | ((eq def 'unparsed) 'not-well-formed) |
| 1857 | (t def))))) | 1858 | (t def))))) |
| 1858 | 1859 | ||
| 1859 | (defun xmltok-append-entity-def (d1 d2) | 1860 | (defun xmltok-append-entity-def (d1 d2) |
| 1860 | (cond ((consp d1) | 1861 | (cond ((consp d1) |
| 1861 | (if (consp d2) | 1862 | (if (consp d2) |
| @@ -1878,7 +1879,7 @@ Processing instruction does not start with a name" | |||
| 1878 | xmltok-prolog-regions))) | 1879 | xmltok-prolog-regions))) |
| 1879 | 1880 | ||
| 1880 | (defun xmltok-merge-attributes () | 1881 | (defun xmltok-merge-attributes () |
| 1881 | "Return a list merging `xmltok-attributes' and 'xmltok-namespace-attributes'. | 1882 | "Return a list merging `xmltok-attributes' and `xmltok-namespace-attributes'. |
| 1882 | The members of the merged list are in order of occurrence in the | 1883 | The members of the merged list are in order of occurrence in the |
| 1883 | document. The list may share list structure with `xmltok-attributes' | 1884 | document. The list may share list structure with `xmltok-attributes' |
| 1884 | and `xmltok-namespace-attributes'." | 1885 | and `xmltok-namespace-attributes'." |
diff --git a/lisp/nxml/xsd-regexp.el b/lisp/nxml/xsd-regexp.el index 57499c2085b..bfdd3bba28c 100644 --- a/lisp/nxml/xsd-regexp.el +++ b/lisp/nxml/xsd-regexp.el | |||
| @@ -64,7 +64,7 @@ | |||
| 64 | 64 | ||
| 65 | (defun xsdre-translate (regexp) | 65 | (defun xsdre-translate (regexp) |
| 66 | "Translate a W3C XML Schema Datatypes regexp to an Emacs regexp. | 66 | "Translate a W3C XML Schema Datatypes regexp to an Emacs regexp. |
| 67 | Returns a string. REGEXP is a string. If REGEXP is not a valid XSD | 67 | Returns a string. REGEXP is a string. If REGEXP is not a valid XSD |
| 68 | regexp, signal an `xsdre-invalid-regexp' condition." | 68 | regexp, signal an `xsdre-invalid-regexp' condition." |
| 69 | (xsdre-from-symbolic | 69 | (xsdre-from-symbolic |
| 70 | (xsdre-to-symbolic regexp))) | 70 | (xsdre-to-symbolic regexp))) |
| @@ -117,7 +117,7 @@ A range-list represents a set of integers by a list of ranges in a | |||
| 117 | canonical form, in which ranges are in increasing order, and adjacent | 117 | canonical form, in which ranges are in increasing order, and adjacent |
| 118 | ranges are merged wherever possible." | 118 | ranges are merged wherever possible." |
| 119 | (when list | 119 | (when list |
| 120 | (setq list | 120 | (setq list |
| 121 | (sort list 'xsdre-range-less-than)) | 121 | (sort list 'xsdre-range-less-than)) |
| 122 | (let* ((next (cdr list)) | 122 | (let* ((next (cdr list)) |
| 123 | (tail list) | 123 | (tail list) |
| @@ -138,10 +138,10 @@ ranges are merged wherever possible." | |||
| 138 | (setcar tail (xsdre-make-range first last)) | 138 | (setcar tail (xsdre-make-range first last)) |
| 139 | (setcdr tail nil) | 139 | (setcdr tail nil) |
| 140 | list))) | 140 | list))) |
| 141 | 141 | ||
| 142 | 142 | ||
| 143 | (defun xsdre-range-list-union (range-lists) | 143 | (defun xsdre-range-list-union (range-lists) |
| 144 | "Return a range-list the union of a list of range-lists." | 144 | "Return a range-list, the union of a list of range-lists." |
| 145 | (xsdre-make-range-list (apply 'append range-lists))) | 145 | (xsdre-make-range-list (apply 'append range-lists))) |
| 146 | 146 | ||
| 147 | (defun xsdre-range-list-difference (orig subtract) | 147 | (defun xsdre-range-list-difference (orig subtract) |
| @@ -160,7 +160,7 @@ ranges are merged wherever possible." | |||
| 160 | (<= (xsdre-range-first (car subtract)) last)) | 160 | (<= (xsdre-range-first (car subtract)) last)) |
| 161 | (when (< first (xsdre-range-first (car subtract))) | 161 | (when (< first (xsdre-range-first (car subtract))) |
| 162 | (setq new | 162 | (setq new |
| 163 | (cons (xsdre-make-range | 163 | (cons (xsdre-make-range |
| 164 | first | 164 | first |
| 165 | (1- (xsdre-range-first (car subtract)))) | 165 | (1- (xsdre-range-first (car subtract)))) |
| 166 | new))) | 166 | new))) |
| @@ -181,7 +181,7 @@ ranges are merged wherever possible." | |||
| 181 | (< (xsdre-range-last r1) (xsdre-range-last r2))))) | 181 | (< (xsdre-range-last r1) (xsdre-range-last r2))))) |
| 182 | 182 | ||
| 183 | (defun xsdre-check-range-list (range-list) | 183 | (defun xsdre-check-range-list (range-list) |
| 184 | "Check that range-list is a range-list. | 184 | "Check that RANGE-LIST is a range-list. |
| 185 | Signal an error if it is not." | 185 | Signal an error if it is not." |
| 186 | (let ((last nil)) | 186 | (let ((last nil)) |
| 187 | (while range-list | 187 | (while range-list |
| @@ -199,7 +199,7 @@ Signal an error if it is not." | |||
| 199 | (setq last (xsdre-range-last head))) | 199 | (setq last (xsdre-range-last head))) |
| 200 | (setq range-list (cdr range-list)))) | 200 | (setq range-list (cdr range-list)))) |
| 201 | t) | 201 | t) |
| 202 | 202 | ||
| 203 | ;;; Compiling symbolic regexps to Emacs regexps | 203 | ;;; Compiling symbolic regexps to Emacs regexps |
| 204 | 204 | ||
| 205 | (defun xsdre-from-symbolic (re) | 205 | (defun xsdre-from-symbolic (re) |
| @@ -286,14 +286,14 @@ and whose tail is ACCUM." | |||
| 286 | (xsdre-range-first (car ranges)))) | 286 | (xsdre-range-first (car ranges)))) |
| 287 | (t (xsdre-range-list-to-char-alternative ranges))))) | 287 | (t (xsdre-range-list-to-char-alternative ranges))))) |
| 288 | accum)) | 288 | accum)) |
| 289 | 289 | ||
| 290 | (defun xsdre-compile-single-char (ch) | 290 | (defun xsdre-compile-single-char (ch) |
| 291 | (if (memq ch '(?. ?* ?+ ?? ?\[ ?\] ?^ ?$ ?\\)) | 291 | (if (memq ch '(?. ?* ?+ ?? ?\[ ?\] ?^ ?$ ?\\)) |
| 292 | (string ?\\ ch) | 292 | (string ?\\ ch) |
| 293 | (string (decode-char 'ucs ch)))) | 293 | (string (decode-char 'ucs ch)))) |
| 294 | 294 | ||
| 295 | (defun xsdre-char-class-to-range-list (cc) | 295 | (defun xsdre-char-class-to-range-list (cc) |
| 296 | "Return a range-list for a symbolic char-class." | 296 | "Return a range-list for a symbolic char-class CC." |
| 297 | (cond ((integerp cc) (list cc)) | 297 | (cond ((integerp cc) (list cc)) |
| 298 | ((symbolp cc) | 298 | ((symbolp cc) |
| 299 | (or (get cc 'xsdre-ranges) | 299 | (or (get cc 'xsdre-ranges) |
| @@ -417,11 +417,11 @@ consisting of a single char alternative delimited with []." | |||
| 417 | (setq chars '(?- ?^ ?\]))) | 417 | (setq chars '(?- ?^ ?\]))) |
| 418 | (setq chars (cons ?\[ chars)) | 418 | (setq chars (cons ?\[ chars)) |
| 419 | (apply 'string chars))) | 419 | (apply 'string chars))) |
| 420 | 420 | ||
| 421 | ;;; Parsing | 421 | ;;; Parsing |
| 422 | 422 | ||
| 423 | (defvar xsdre-current-regexp nil | 423 | (defvar xsdre-current-regexp nil |
| 424 | "List of characters remaining to be parsed. Dynamically bound.") | 424 | "List of characters remaining to be parsed. Dynamically bound.") |
| 425 | 425 | ||
| 426 | (defun xsdre-to-symbolic (str) | 426 | (defun xsdre-to-symbolic (str) |
| 427 | "Convert a W3C XML Schema datatypes regexp to a symbolic form. | 427 | "Convert a W3C XML Schema datatypes regexp to a symbolic form. |
| @@ -524,7 +524,7 @@ whose value is a range-list." | |||
| 524 | (cons lower upper))))) | 524 | (cons lower upper))))) |
| 525 | (t (xsdre-parse-error "Expected , or }"))))) | 525 | (t (xsdre-parse-error "Expected , or }"))))) |
| 526 | (t nil)))) | 526 | (t nil)))) |
| 527 | 527 | ||
| 528 | (defun xsdre-parse-bound () | 528 | (defun xsdre-parse-bound () |
| 529 | (let ((n 0)) | 529 | (let ((n 0)) |
| 530 | (while (progn | 530 | (while (progn |
| @@ -537,7 +537,7 @@ whose value is a range-list." | |||
| 537 | (xsdre-advance) | 537 | (xsdre-advance) |
| 538 | (not (memq (car xsdre-current-regexp) '(?} ?,))))) | 538 | (not (memq (car xsdre-current-regexp) '(?} ?,))))) |
| 539 | n)) | 539 | n)) |
| 540 | 540 | ||
| 541 | 541 | ||
| 542 | (defun xsdre-try-parse-atom () | 542 | (defun xsdre-try-parse-atom () |
| 543 | (let ((ch (car xsdre-current-regexp))) | 543 | (let ((ch (car xsdre-current-regexp))) |
| @@ -640,7 +640,7 @@ whose value is a range-list." | |||
| 640 | (t (if ch | 640 | (t (if ch |
| 641 | (xsdre-parse-error "Missing char after \\") | 641 | (xsdre-parse-error "Missing char after \\") |
| 642 | (xsdre-parse-error "Bad escape %c" ch)))))) | 642 | (xsdre-parse-error "Bad escape %c" ch)))))) |
| 643 | 643 | ||
| 644 | (defun xsdre-parse-prop () | 644 | (defun xsdre-parse-prop () |
| 645 | (xsdre-expect ?{) | 645 | (xsdre-expect ?{) |
| 646 | (let ((name nil)) | 646 | (let ((name nil)) |
| @@ -676,7 +676,7 @@ whose value is a range-list." | |||
| 676 | (if (eq (car xsdre-current-regexp) ch) | 676 | (if (eq (car xsdre-current-regexp) ch) |
| 677 | (xsdre-advance) | 677 | (xsdre-advance) |
| 678 | (xsdre-parse-error "Expected %c" ch))) | 678 | (xsdre-parse-error "Expected %c" ch))) |
| 679 | 679 | ||
| 680 | (defun xsdre-advance () | 680 | (defun xsdre-advance () |
| 681 | (setq xsdre-current-regexp | 681 | (setq xsdre-current-regexp |
| 682 | (cdr xsdre-current-regexp))) | 682 | (cdr xsdre-current-regexp))) |
| @@ -693,7 +693,7 @@ whose value is a range-list." | |||
| 693 | (put 'xsdre-parse-error | 693 | (put 'xsdre-parse-error |
| 694 | 'error-message | 694 | 'error-message |
| 695 | "Internal error in parsing XSD regexp") | 695 | "Internal error in parsing XSD regexp") |
| 696 | 696 | ||
| 697 | ;;; Character class data | 697 | ;;; Character class data |
| 698 | 698 | ||
| 699 | (put 'dot 'xsdre-char-class '(difference any (union #xA #xD))) | 699 | (put 'dot 'xsdre-char-class '(difference any (union #xA #xD))) |
| @@ -758,7 +758,7 @@ Code is inserted into the current buffer." | |||
| 758 | (goto-char start) | 758 | (goto-char start) |
| 759 | (down-list 2) | 759 | (down-list 2) |
| 760 | (while (condition-case err | 760 | (while (condition-case err |
| 761 | (progn | 761 | (progn |
| 762 | (forward-sexp) | 762 | (forward-sexp) |
| 763 | t) | 763 | t) |
| 764 | (error nil)) | 764 | (error nil)) |
| @@ -1107,8 +1107,8 @@ Code is inserted into the current buffer." | |||
| 1107 | 1107 | ||
| 1108 | (xsdre-def-derived-category 'name-continue '(union name-initial | 1108 | (xsdre-def-derived-category 'name-continue '(union name-initial |
| 1109 | name-continue-not-initial)) | 1109 | name-continue-not-initial)) |
| 1110 | 1110 | ||
| 1111 | (xsdre-def-primitive-category | 1111 | (xsdre-def-primitive-category |
| 1112 | 'name-continue-not-initial | 1112 | 'name-continue-not-initial |
| 1113 | '((#x002d . #x002e) | 1113 | '((#x002d . #x002e) |
| 1114 | (#x0030 . #x0039) | 1114 | (#x0030 . #x0039) |
| @@ -1392,7 +1392,7 @@ Code is inserted into the current buffer." | |||
| 1392 | (976 . 977) | 1392 | (976 . 977) |
| 1393 | (981 . 983) | 1393 | (981 . 983) |
| 1394 | 987 989 991 993 995 997 999 1001 1003 1005 | 1394 | 987 989 991 993 995 997 999 1001 1003 1005 |
| 1395 | 1395 | ||
| 1396 | (1007 . 1011) | 1396 | (1007 . 1011) |
| 1397 | 1013 | 1397 | 1013 |
| 1398 | (1072 . 1119) | 1398 | (1072 . 1119) |
| @@ -1420,7 +1420,7 @@ Code is inserted into the current buffer." | |||
| 1420 | 7877 7879 7881 7883 7885 7887 7889 7891 7893 | 1420 | 7877 7879 7881 7883 7885 7887 7889 7891 7893 |
| 1421 | 7895 7897 7899 7901 7903 7905 7907 7909 7911 | 1421 | 7895 7897 7899 7901 7903 7905 7907 7909 7911 |
| 1422 | 7913 7915 7917 7919 7921 7923 7925 7927 7929 | 1422 | 7913 7915 7917 7919 7921 7923 7925 7927 7929 |
| 1423 | 1423 | ||
| 1424 | (7936 . 7943) | 1424 | (7936 . 7943) |
| 1425 | (7952 . 7957) | 1425 | (7952 . 7957) |
| 1426 | (7968 . 7975) | 1426 | (7968 . 7975) |