View file File name : rng-valid.elc Content :;ELC ;;; Compiled ;;; in Emacs version 26.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\310\311\312\313\314\315\314\316\314\317& \210\320\321\322\323\314\311%\210\324\325\326\327\330DD\331\332\333\314\311&\210\324\334\326\327\335DD\336\332\333\314\311&\210\324\337\326\327\340DD\341\332\342\314\311&\210\324\343\326\327\344DD\345\332\342\314\311&\207" [require xmltok nxml-enc nxml-util nxml-ns rng-match rng-util rng-loc custom-declare-group relax-ng nil "Validation of XML using RELAX NG." :group text nxml languages custom-declare-face rng-error ((t (:inherit font-lock-warning-face))) "Face for highlighting XML errors." custom-declare-variable rng-state-cache-distance funcall function #[0 "\300\207" [2000] 1] "Distance in characters between each parsing and validation state cache." :type integer rng-validate-chunk-size #[0 "\300\207" [8000] 1] "Number of characters in a RELAX NG validation chunk.\nA validation chunk will be the smallest chunk that is at least this\nsize and ends with a tag. After validating a chunk, validation will\ncontinue only if Emacs is still idle." rng-validate-delay #[0 "\300\207" [1.5] 1] "Time in seconds that Emacs must be idle before starting a full validation.\nA full validation continues until either validation is up to date\nor Emacs is no longer idle." number rng-validate-quick-delay #[0 "\300\207" [0.3] 1] "Time in seconds that Emacs must be idle before starting a quick validation.\nA quick validation validates at most one chunk."] 10) (defvar rng-validate-timer nil) (byte-code "\300\301!\210\302\301\303\304#\207" [make-variable-buffer-local rng-validate-timer put permanent-local t] 4) (defvar rng-validate-quick-timer nil) (byte-code "\300\301!\210\302\301\303\304#\207" [make-variable-buffer-local rng-validate-quick-timer put permanent-local t] 4) #@103 Number of errors in the current buffer. Always equal to number of overlays with category `rng-error'. (defvar rng-error-count nil (#$ . 2237)) (make-variable-buffer-local 'rng-error-count) #@88 Overlay in this buffer whose `help-echo' property was last printed. It is nil if none. (defvar rng-message-overlay nil (#$ . 2432)) (make-variable-buffer-local 'rng-message-overlay) #@237 Position at which message from overlay should be inhibited. If point is equal to this and the error overlay around point is `rng-message-overlay', then the `help-echo' property of the error overlay should not be printed with `message'. (defvar rng-message-overlay-inhibit-point nil (#$ . 2621)) (make-variable-buffer-local 'rng-message-overlay-inhibit-point) #@64 Non-nil if `rng-message-overlay' is still the current message. (defvar rng-message-overlay-current nil (#$ . 2986)) (make-variable-buffer-local 'rng-message-overlay-current) #@212 Stack of names of open elements represented as a list. Each member of the list is either t or a (PREFIX . LOCAL-NAME) pair. (PREFIX . LOCAL-NAME) is pushed for a start-tag; t is pushed for a mismatched end-tag. (defvar rng-open-elements nil (#$ . 3167)) #@319 Text content of current element that has yet to be processed. Value is a list of segments (VALUE START END) positions in reverse order. VALUE is a string or nil. If VALUE is nil, then the value is the string between START and END. A segment can also be nil indicating an unresolvable entity or character reference. (defvar rng-pending-contents nil (#$ . 3428)) (defvar rng-collecting-text nil) #@59 Last position where validation is known to be up to date. (defvar rng-validate-up-to-date-end nil (#$ . 3831)) (make-variable-buffer-local 'rng-validate-up-to-date-end) #@500 Marker for the start of the conditionally up-to-date region. It is nil if there is no conditionally up-to-date region. The conditionally up-to-date region must be such that for any cached state S with position P in the conditionally up-to-date region, if at some point it is determined that S becomes correct for P, then all states with position >= P in the conditionally up to date region must also then be correct and all errors between P and the end of the region must then be correctly marked. (defvar rng-conditional-up-to-date-start nil (#$ . 4007)) (make-variable-buffer-local 'rng-conditional-up-to-date-start) #@171 Marker for the end of the conditionally up-to-date region. It is nil if there is no conditionally up-to-date region. See the variable `rng-conditional-up-to-date-start'. (defvar rng-conditional-up-to-date-end nil (#$ . 4634)) (make-variable-buffer-local 'rng-conditional-up-to-date-end) #@96 Non-nil means we are currently parsing just to compute the state. Should be dynamically bound. (defvar rng-parsing-for-state nil (#$ . 4927)) (defvar rng-validate-mode nil) (make-variable-buffer-local 'rng-validate-mode) (defvar rng-dtd nil) (make-variable-buffer-local 'rng-dtd) #@1245 Minor mode performing continual validation against a RELAX NG schema. Checks whether the buffer is a well-formed XML 1.0 document, conforming to the XML Namespaces Recommendation and valid against a RELAX NG schema. The mode-line indicates whether it is or not. Any parts of the buffer that cause it not to be are considered errors and are highlighted with face `rng-error'. A description of each error is available as a tooltip. \[rng-next-error] goes to the next error after point. Clicking mouse-1 on the word `Invalid' in the mode-line goes to the first error in the buffer. If the buffer changes, then it will be automatically rechecked when Emacs becomes idle; the rechecking will be paused whenever there is input pending. By default, uses a vacuous schema that allows any well-formed XML document. A schema can be specified explicitly using \[rng-set-schema-file-and-validate], or implicitly based on the buffer's file name or on the root element name. In each case the schema must be a RELAX NG schema using the compact schema (such schemas conventionally have a suffix of `.rnc'). The variable `rng-schema-locating-files' specifies files containing rules to use for finding the schema. (fn &optional ARG NO-CHANGE-SCHEMA) (defalias 'rng-validate-mode #[512 "\204 ?\202 \306!\307V\214~\210\310 \311\211\311\312\307\313\314\315!\316\"\317$\216\320ed\"\210,\210\321edT\"\210e)\322 \210\307\323\324\325\311#\210\203_ \326\216\212!\203Z !\"=\205] \211?\205] \327\311!*\207\330 \210\331 \210\323\332\330\311#\210\323\333\334\311#\210\323\335\336\311#\210\323\337\340\311#\207" [rng-validate-mode buffer-undo-list inhibit-read-only inhibit-modification-hooks rng-validate-up-to-date-end rng-error-count prefix-numeric-value 0 buffer-modified-p t make-byte-code "\300?\205 \301\302!\207" vconcat vector [restore-buffer-modified-p nil] 2 rng-clear-cached-state rng-clear-overlays rng-clear-conditional-region remove-hook rng-schema-change-hook rng-validate-clear #[0 "\204 \301\302!\210\303\304\305\302\306$\210\303\307\310\302\306$\210\303\311\312\302\306$\210\303\313\314\302\306$\210\303\315\316\302\306$\210\317 \210\320 \210\321p\322\"\205; \323p!\207" [rng-current-schema rng-set-schema-file-1 nil add-hook rng-schema-change-hook rng-validate-clear t after-change-functions rng-after-change-function kill-buffer-hook rng-kill-timers echo-area-clear-hook rng-echo-area-clear-function post-command-hook rng-maybe-echo-error-at-point rng-match-init-buffer rng-activate-timers get-buffer-window visible rng-validate-while-idle] 5] rng-auto-set-schema rng-cancel-timers force-mode-line-update kill-buffer-hook post-command-hook rng-maybe-echo-error-at-point echo-area-clear-hook rng-echo-area-clear-function after-change-functions rng-after-change-function rng-current-schema rng-any-element] 10 (#$ . 5215) "P"]) #@125 Sets the schema and turns on `rng-validate-mode' if not already on. The schema is set like `rng-set-schema'. (fn FILENAME) (defalias 'rng-set-schema-file-and-validate #[257 "\301!\210\206\n \300 \207" [rng-validate-mode rng-set-schema-file] 3 (#$ . 8069) "fSchema file: "]) #@16 (fn TYPE-ID) (defalias 'rng-set-document-type-and-validate #[257 "\301!\205\f \206\f \300 \207" [rng-validate-mode rng-set-document-type] 3 (#$ . 8352) (byte-code "\300 C\207" [rng-read-type-id] 1)]) #@125 Set the schema for this buffer automatically and turn on `rng-validate-mode'. The schema is set like `rng-auto-set-schema'. (defalias 'rng-auto-set-schema-and-validate #[0 "\301 \210\206 \300 \207" [rng-validate-mode rng-auto-set-schema] 1 (#$ . 8563) nil]) #@33 (fn START END PRE-CHANGE-LEN) (defalias 'rng-after-change-function #[771 "\306\307 \310\211\310\311\312\313\314\315!\316\"\317$\216\320\"\210,\210\fW\2037 \\\fX\2035 \f\321#\\\2026 \203V W\203g W\203P \306\223\210\202g \322 \210\202g \fW\203g \323\f\306\"\323\310\"\fW\203o \fdY\203\211 edW\203\200 dS\202\210 \214~\210edS])\324 \210\325 \207" [rng-message-overlay-inhibit-point buffer-undo-list inhibit-read-only inhibit-modification-hooks rng-validate-up-to-date-end rng-conditional-up-to-date-start nil buffer-modified-p t make-byte-code 0 "\300?\205 \301\302!\207" vconcat vector [restore-buffer-modified-p nil] 2 rng-clear-cached-state - rng-clear-conditional-region copy-marker rng-activate-timers force-mode-line-update rng-conditional-up-to-date-end] 11 (#$ . 8829)]) (defalias 'rng-compute-mode-line-string #[0 "\203 \303\304\305 \306U\203 \306\202 \307 eZdeZ\"\"\207\n\306V\203. \310\311\312\313\314\315\316\317\320\"%P\207\321\207" [rng-validate-timer rng-validate-up-to-date-end rng-error-count format " Validated:%d%%" buffer-size 0 floor " " propertize "Invalid" help-echo "mouse-1: go to first error" local-map make-mode-line-mouse-map mouse-1 rng-mouse-first-error " Valid"] 9]) (defalias 'rng-cancel-timers #[0 "\303 \203\f \304 !\210\305\n\205 \304\n!\210\305\211)\207" [inhibit-quit rng-validate-timer rng-validate-quick-timer t cancel-timer nil] 2]) (defalias 'rng-kill-timers #[0 "\302\300!\203 \203 \303!\210\304\300!\210\302\301!\205# \203 \303 !\210\304\301!\207" [rng-validate-timer rng-validate-quick-timer local-variable-p cancel-timer kill-local-variable] 2]) (defalias 'rng-activate-timers #[0 "?\205 \305\306\n\305\307p$\306\305\310p$\211)\207" [rng-validate-timer inhibit-quit rng-validate-delay rng-validate-quick-delay rng-validate-quick-timer t run-with-idle-timer rng-validate-while-idle rng-validate-quick-while-idle] 5]) (defalias 'rng-validate-clear #[0 "\300\301\302\"\207" [rng-validate-mode 1 t] 3]) (defvar rng-validate-display-point nil) (defvar rng-validate-display-modified-p nil) (defalias 'rng-validate-while-idle-continue-p #[0 "\303 ?\205 ` b\210\n\204 \304\305!\210\306 \210\307\310!b\210\211\262)\207" [rng-validate-up-to-date-end rng-validate-display-point rng-validate-display-modified-p input-pending-p restore-buffer-modified-p nil force-mode-line-update sit-for 0] 2]) #@15 (fn BUFFER) (defalias 'rng-validate-while-idle #[257 "\303!\205' r\211q\210\203$ `\304 \305\306!*\203 \307 \202&