;ELC ;;; compiled by rms@psilocin.gnu.ai.mit.edu on Thu Aug 1 18:17:13 1996 ;;; from file /home/fsf/rms/e19/lisp/sgml-mode.el ;;; emacs version 19.31.97.4. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`sgml-mode.el' was compiled for Emacs 19.29 or later")) #@631 List of characters that have a special meaning for sgml-mode. This list is used when first loading the sgml-mode library. The supported characters and potential disadvantages are: ?\" Makes " in text start a string. ?' Makes ' in text start a string. ?- Makes -- in text start a comment. When only one of ?\" or ?' are included, "'" or '"' as it can be found in DTDs, start a string. To partially avoid this problem this also makes these self insert as named entities depending on `sgml-quick-keys'. must contain an even multiple of two (4, 8, ...) minuses, or Emacs' syntax mechanism won't recognize a comment. (defvar sgml-specials (quote (34 45)) (#$ . 481)) #@124 Use <, >, &, SPC and `sgml-specials' keys ``electrically'' when non-nil. This takes effect when first loading the library. (defvar sgml-quick-keys nil (#$ . 1168)) #@50 Keymap for SGML mode. See also `sgml-specials'. (defvar sgml-mode-map (byte-code "\"D!###############$ ####,> #,> #A@22T2W 2I *B######@ #A B #C D #E F #*" [keymap make-vector 256 nil make-sparse-keymap "SGML" menu-map map define-key " " indent-relative-maybe " " sgml-tags-invisible "/" sgml-slash "" sgml-name-char "" sgml-tag "" sgml-attributes "" sgml-skip-tag-backward [3 left] "" sgml-skip-tag-forward [3 right] "" sgml-delete-tag "" "?" sgml-tag-help "8" sgml-name-8bit-mode "" sgml-validate sgml-quick-keys "&" "<" " " sgml-auto-attributes ">" sgml-maybe-end-tag 34 sgml-specials "\"" sgml-name-self 39 "'" 127 c sgml-maybe-name-self [menu-bar sgml] [sgml-validate] ("Validate" . sgml-validate) [sgml-name-8bit-mode] ("Toggle 8 Bit Insertion" . sgml-name-8bit-mode) [sgml-tags-invisible] ("Toggle Tag Visibility" . sgml-tags-invisible) [sgml-tag-help] ("Describe Tag" . sgml-tag-help) [sgml-delete-tag] ("Delete Tag" . sgml-delete-tag) [sgml-skip-tag-forward] ("Forward Tag" . sgml-skip-tag-forward) [sgml-skip-tag-backward] ("Backward Tag" . sgml-skip-tag-backward) [sgml-attributes] ("Insert Attributes" . sgml-attributes) [sgml-tag] ("Insert Tag" . sgml-tag)] 5) (#$ . 1338)) #@60 Syntax table used in SGML mode. See also `sgml-specials'. (defvar sgml-mode-syntax-table (byte-code " !\n#\n# > \n# >* \n# >7 \n#\n)" [copy-syntax-table text-mode-syntax-table table modify-syntax-entry 60 "(>" 62 ")<" 45 sgml-specials "_ 1234" 34 "\"\"" 39 "\"'"] 4) (#$ . 2781)) #@59 *When non-`nil' insert 8 bit characters with their names. (defvar sgml-name-8bit-mode nil (#$ . -3101)) #@57 Vector of symbolic character names without `&' and `;'. (defvar sgml-char-names [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil "ensp" "excl" "quot" "num" "dollar" "percnt" "amp" "apos" "lpar" "rpar" "ast" "plus" "comma" "hyphen" "period" "sol" nil nil nil nil nil nil nil nil nil nil "colon" "semi" "lt" "eq" "gt" "quest" "commat" nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil "lsqb" nil "rsqb" "uarr" "lowbar" "lsquo" nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil "lcub" "verbar" "rcub" "tilde" nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil "nbsp" "iexcl" "cent" "pound" "curren" "yen" "brvbar" "sect" "uml" "copy" "ordf" "laquo" "not" "shy" "reg" "macr" "ring" "plusmn" "sup2" "sup3" "acute" "micro" "para" "middot" "cedil" "sup1" "ordm" "raquo" "frac14" "half" "frac34" "iquest" "Agrave" "Aacute" "Acirc" "Atilde" "Auml" "Aring" "AElig" "Ccedil" "Egrave" "Eacute" "Ecirc" "Euml" "Igrave" "Iacute" "Icirc" "Iuml" "ETH" "Ntilde" "Ograve" "Oacute" "Ocirc" "Otilde" "Ouml" nil "Oslash" "Ugrave" "Uacute" "Ucirc" "Uuml" "Yacute" "THORN" "szlig" "agrave" "aacute" "acirc" "atilde" "auml" "aring" "aelig" "ccedil" "egrave" "eacute" "ecirc" "euml" "igrave" "iacute" "icirc" "iuml" "eth" "ntilde" "ograve" "oacute" "ocirc" "otilde" "ouml" "divide" "oslash" "ugrave" "uacute" "ucirc" "uuml" "yacute" "thorn" "yuml"] (#$ . 3211)) #@134 *The command to validate an SGML document. The file name of current buffer file name will be appended to this, separated by a space. (defvar sgml-validate-command "sgmls -s" (#$ . -4824)) #@51 The command last used to validate in this buffer. (defvar sgml-saved-validate-command nil (#$ . 5018)) #@64 *If non-nil, is the maximum distance to search for matching /. (defconst sgml-slash-distance 1000 (#$ . -5127)) #@95 Regular expression that matches a non-empty start tag. Any terminating > or / is not matched. (defconst sgml-start-tag-regex "<[A-Za-z]\\([-.A-Za-z0-9= \n ]\\|\"[^\"]*\"\\|'[^']*'\\)*" (#$ . 5245)) #@69 *Rules for highlighting SGML code. See also `sgml-tag-face-alist'. (defvar sgml-font-lock-keywords (quote (("<\\([!?][a-z0-9]+\\)" 1 font-lock-keyword-face) ("<\\(/?[a-z0-9]+\\)" 1 font-lock-function-name-face) ("[&%][-.A-Za-z0-9]+;?" . font-lock-variable-name-face))) (#$ . -5449)) (byte-code "! B" [boundp sgml-font-lock-keywords-1 nil current-load-list] 2) #@42 Alist of face and tag name for facemenu. (defvar sgml-face-tag-alist nil (#$ . 5827)) #@217 Tag names and face or list of faces to fontify with when invisible. When `font-lock-maximum-decoration' is 1 this is always used for fontifying. When more these are fontified together with `sgml-font-lock-keywords'. (defvar sgml-tag-face-alist nil (#$ . 5920)) #@68 Tag names as lowercase symbols, and display string when invisible. (defvar sgml-display-text nil (#$ . 6187)) (byte-code "! B" [boundp sgml-tags-invisible nil current-load-list] 2) #@550 *Alist of tag names for completing read and insertion rules. This alist is made up as (("tag" . TAGRULE) ...) TAGRULE is a list of optionally `t' (no endtag) or `\n' (separate endtag by newlines) or a skeleton with `nil', `t' or `\n' in place of the interactor followed by an ATTRIBUTERULE (for an always present attribute) or an attribute alist. The attribute alist is made up as (("attribute" . ATTRIBUTERULE) ...) ATTRIBUTERULE is a list of optionally `t' (no value when no input) followed by an optional alist of possible values. (defvar sgml-tag-alist (quote (("![" ("ignore" t) ("include" t)) ("!attlist") ("!doctype") ("!element") ("!entity"))) (#$ . -6386)) #@43 *Alist of tag name and short description. (defvar sgml-tag-help (quote (("!" . "Empty declaration for comment") ("![" . "Embed declarations with parser directive") ("!attlist" . "Tag attributes declaration") ("!doctype" . "Document type (DTD) declaration") ("!element" . "Tag declaration") ("!entity" . "Entity (macro) declaration"))) (#$ . -7073)) (byte-code "N !\"\"" [sgml-tag invisible setplist append (invisible t rear-nonsticky t point-entered sgml-point-entered read-only t) symbol-plist] 6) #@230 Common code for setting up `sgml-mode' and derived modes. SGML-TAG-FACE-ALIST is used for calculating `sgml-font-lock-keywords-1'. SGML-DISPLAY-TEXT sets up alternate text for when tags are invisible (see varables of same name). (defalias 'sgml-mode-common #[(sgml-tag-face-alist sgml-display-text) " \f!!!!!!!!!!!!!!!!!!t t #QDEDEDC\n\f A. .@@.@A#.A. \"" [kill-all-local-variables text-mode-abbrev-table local-abbrev-table set-syntax-table sgml-mode-syntax-table make-local-variable indent-line-function paragraph-start paragraph-separate sgml-saved-validate-command comment-start comment-end comment-indent-function comment-start-skip sgml-tags-invisible skeleton-transformation skeleton-further-elements skeleton-end-hook font-lock-defaults sgml-font-lock-keywords-1 facemenu-add-face-function facemenu-end-add-face sgml-tag-face-alist 1 "<\\(" mapconcat car "\\|" "\\)\\([ ].+\\)?>\\(.+\\)\\1>" 3 cdr assoc (match-string 1) quote indent-relative-maybe "^[ \n]\\|\\(?\\([A-Za-z]\\([-.A-Za-z0-9= \n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$\\)" "^[ \n]*$\\|^?\\([A-Za-z]\\([-.A-Za-z0-9= \n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$" "" sgml-comment-indent "--[ ]*" identity ((completion-ignore-case t)) #[nil "l = =? " [v2 n newline-and-indent] 2] ((sgml-font-lock-keywords sgml-font-lock-keywords-1) nil t) #[(face end) " A QQ\"" [face sgml-face-tag-alist "" ">" facemenu-end-add-face "<" error "Face not configured for %s mode." mode-name] 3] sgml-display-text put before-string run-hooks text-mode-hook sgml-mode-hook] 10 (#$ . 7592)]) #@315 Major mode for editing SGML documents. Makes > match <. Makes / blink matching /. Keys <, &, SPC within <>, " and ' can be electric depending on `sgml-quick-keys'. Do \[describe-variable] sgml- SPC to see available variables. Use \[sgml-validate] to validate your document with an SGML parser. \{sgml-mode-map} (defalias 'sgml-mode #[(&optional function) " \n\"\f!lj" [sgml-mode-common sgml-tag-face-alist sgml-display-text use-local-map sgml-mode-map "SGML" mode-name sgml-mode major-mode] 3 (#$ . 9323) nil]) (defalias 'sgml-comment-indent #[nil "! h= `Zf= xiT]ȇ" [looking-at "--" 33 2 60 " " nil comment-column 0] 2]) #@176 Insert / and display any previous matching /. Two /s are treated as matching if the first / ends a net-enabling start tag, and the second / is the corresponding null end tag. (defalias 'sgml-slash #[(arg) "\n\"\nV `$ e`Z]}\ne#6 ÕS=v Sbv e#v \ne#T Õ)`=o =i `r Sr T); ) b ! y`T{\"," [insert-char 47 arg 0 nil level blinkpos oldpos sgml-slash-distance re-search-backward sgml-start-tag-regex t search-backward "/" tagend pos-visible-in-window-p sit-for 1 message "Matches %s"] 5 (#$ . 9983) "p"]) #@170 Insert a symbolic character name according to `sgml-char-names'. 8 bit chars may be inserted with the meta key as in M-SPC for no break space, or M-- for a soft hyphen. (defalias 'sgml-name-char #[(&optional char) "c \n ! c ! H$ \"ɱ" [38 char read-quoted-char delete-backward-char 1 undo-boundary sgml-char-names format "#%d" 59] 4 (#$ . 10569) "*"]) #@66 Insert a symbolic character name according to `sgml-char-names'. (defalias 'sgml-name-self #[nil " !" [sgml-name-char last-command-char] 2 (#$ . 10951) "*"]) #@66 Insert a symbolic character name according to `sgml-char-names'. (defalias 'sgml-maybe-name-self #[nil " \n!!" [sgml-name-8bit-mode sgml-name-char last-command-char self-insert-command 1] 2 (#$ . 11117) "*"]) #@39 Toggle insertion of 8 bit characters. (defalias 'sgml-name-8bit-mode #[nil "?" [sgml-name-8bit-mode] 2 (#$ . 11340) nil]) #@640 Insert a tag you are prompted for, optionally with attributes. Completion and configuration is according to `sgml-tag-alist'. If you like tags and attributes in uppercase set `skeleton-transformation' to `upcase'. This is a skeleton command (see `skeleton-insert'). Normally the skeleton text is inserted at point, with nothing "inside". If there is a highlighted region, the skeleton text is wrapped around the region text. A prefix argument ARG says to wrap the skeleton around the next ARG words. A prefix argument of zero says to wrap around zero words---that is, nothing. This is a way of overiding the use of a highlighted region. (defalias 'sgml-tag #[(&optional str arg) "\n#" [skeleton-proxy-new ((funcall skeleton-transformation (completing-read "Tag: " sgml-tag-alist)) 60 (setq v1 (eval str)) | (("") -1 (quote (undo-boundary)) "<") | (("") (quote (setq v2 (sgml-attributes v1 t))) 62 (if (string= "![" v1) (prog1 (quote (("") " [ " _ " ]]")) (backward-char)) (if (or (eq v2 t) (string-match "^[/!?]" v1)) nil (if (symbolp v2) (quote (("") v2 _ v2 "" v1 62)) (if (eq (car v2) t) (cons (quote ("")) (cdr v2)) (append (quote (("") (car v2))) (cdr v2) (quote (resume: (car v2) _ "" v1 62))))))))) str arg] 4 (#$ . 11473) "*P\nP"]) (autoload (quote skeleton-read) "skeleton") #@61 When at toplevel of a tag, interactively insert attributes. (defalias 'sgml-attributes #[(alist &optional quiet) "; ! ĉ\n\"A@9- @@94 @A= !@;Z h=M ςN @! GV c!!cϘ~ щ^ \"! S^ h= !," [alist error "Wrong context for adding attribute" t nil i attribute car completion-ignore-case assoc sgml-tag-alist quiet message "No attributes configured." 32 "" sgml-value 0 skeleton-transformation skeleton-read (completing-read "[Attribute]: " alist) delete-backward-char 1] 5 (#$ . 12776) (list (save-excursion (sgml-beginning-of-tag t)))]) #@105 Self insert, except, when at top level of tag, prompt for attributes. With prefix ARG only self insert. (defalias 'sgml-auto-attributes #[(arg) "` \f !)9 H=' !!7 ! `\nV7 !*" [nil tag point arg sgml-tag-alist sgml-beginning-of-tag t 0 47 self-insert-command prefix-numeric-value sgml-attributes 32 last-command-char 1] 3 (#$ . 13403) "*P"]) #@54 Display description of optional TAG or tag at point. (defalias 'sgml-tag-help #[(&optional tag) " g= u ); ! \"A> H== O \"A> \"" [tag 60 nil sgml-beginning-of-tag error "No tag selected" message "%s" assoc sgml-tag-help 0 47 1 "No description available"] 6 (#$ . 13781) nil]) #@44 Name self unless in position to end a tag. (defalias 'sgml-maybe-end-tag #[nil " ď" [nil (byte-code "!)" [up-list -1] 2) ((error (sgml-name-self) t)) (byte-code "!) " [up-list 1 sgml-name-self] 2) ((error (self-insert-command 1)))] 3 (#$ . 14100) nil]) #@103 Skip to beginning of tag or matching opening tag if present. With prefix ARG, repeat that many times. (defalias 'sgml-skip-tag-backward #[(arg) "YA #!: !!P\f#9 `Tf=9 u! *S " [arg 1 search-backward "<" nil t looking-at "\\([^ \n >]+\\)" "?" regexp-quote match-string re case-fold-search re-search-backward 47 sgml-skip-tag-backward] 6 (#$ . 14380) "p"]) #@131 Skip to end of tag or matching closing tag if present. With prefix ARG, repeat that many times. Return t iff after a closing tag. (defalias 'sgml-skip-tag-forward #[(arg &optional return) "\nY} wg= !!r !!Pʼn!`#\\ ԔTf=\\ !\\ !\\ 5 h !n b,v !\nS " [t return arg 1 "^<>" nil 62 up-list -1 looking-at "<\\([^/ \n >]+\\)" "?" regexp-quote match-string close point re case-fold-search forward-list re-search-forward 0 47 sgml-skip-tag-forward] 6 (#$ . 14784) "p"]) #@110 Delete tag on or after cursor, and matching closing or opening tag. With prefix ARG, repeat that many times. (defalias 'sgml-delete-tag #[(arg) "Y !\" Ǖf=Y `ǕbY ;4 H=4 `)Y `\n!g=T !`\nX)X !)m !`b! `! u H= !\fb!+S " [arg 1 nil close open looking-at "[ \n]*<" 0 47 sgml-beginning-of-tag point sgml-skip-tag-backward 60 forward-list error "Not on or before tag" kill-sexp sgml-skip-tag-forward backward-list] 3 (#$ . 15330) "p"]) #@37 Toggle visibility of existing tags. (defalias 'sgml-tags-invisible #[(arg) " e\fb !Y \n?\nb #| !!ɔbNN `!N `ϔ\"#` `$\f`$% \f!dWv \f!@!b ed#)!!!," [buffer-modified-p t nil symbol point inhibit-read-only modified arg prefix-numeric-value 0 sgml-tags-invisible re-search-forward "<\\([!/?A-Za-z][-A-Za-z0-9]*\\)" intern-soft match-string 1 before-string overlays-at overlay-put make-overlay category put-text-property forward-list intangible sgml-tag next-overlay-change delete-overlay remove-text-properties (category sgml-tag intangible t) set-buffer-modified-p run-hooks sgml-tags-invisible-hook message ""] 5 (#$ . 15850) "P"]) (defalias 'sgml-point-entered #[(x y) "`\f V g= \f W# h=# % {\"*" [t inhibit-point-motion-hooks message "Invisible tag: %s" x y 60 62 backward-list forward-list] 5]) (autoload (quote compile-internal) "compile") #@275 Validate an SGML document. Runs COMMAND, a shell command, in a separate process asynchronously with output going to the buffer *compilation*. You can then use the command \[next-error] to find the next error message and move to the line in the SGML document that caused it. (defalias 'sgml-validate #[(command) "\"" [command sgml-saved-validate-command compile-internal "No more errors"] 3 (#$ . 16795) (list (read-string "Validate command: " (or sgml-saved-validate-command (concat sgml-validate-command " " (let ((name (buffer-file-name))) (and name (file-name-nondirectory name)))))))]) #@57 Skip to beginning of tag and return its name. Else `t'. (defalias 'sgml-beginning-of-tag #[(&optional top-level) " Ï `# `) Y0 !/ `Tȕ\"Ƈ" [top-level nil (up-list -1) ((error t)) search-backward "<" t forward-list 0 looking-at "<[!?/]?[[A-Za-z][A-Za-z0-9]*" buffer-substring-no-properties] 5 (#$ . 17397)]) (defalias 'sgml-value #[(alist) "A@; @±@=5 AF c!1 !±!cD !!cc" [alist "=\"" 34 t skeleton-read (completing-read "[Value]: " (cdr alist)) "" skeleton-transformation delete-backward-char 2 (completing-read "Value: " alist)] 4]) (provide (quote sgml-mode)) #@161 Use C-c X combinations for quick insertion of frequent tags when non-nil. This defaults to `sgml-quick-keys'. This takes effect when first loading the library. (defvar html-quick-keys sgml-quick-keys (#$ . 18035)) #@43 Keymap for commands for use in HTML mode. (defvar html-mode-map (byte-code " !\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#( \f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\f#\fB#####@ #A B #C D #E F #C G #H I #J K #L M #N O #P Q #R S #T U #V W #\f*" [make-sparse-keymap sgml-mode-map "HTML" menu-map map define-key "6" html-headline-6 "5" html-headline-5 "4" html-headline-4 "3" html-headline-3 "2" html-headline-2 "1" html-headline-1 " " html-paragraph "\n" html-line "-" html-horizontal-rule "o" html-ordered-list "u" html-unordered-list "r" html-radio-buttons "c" html-checkboxes "l" html-list-item "h" html-href-anchor "n" html-name-anchor "i" html-image html-quick-keys "-" "o" "u" "r" "c" "l" "h" "n" "i" "" html-autoview-mode "" browse-url-of-buffer [menu-bar html] [html-autoview-mode] ("Toggle Autoviewing" . html-autoview-mode) [browse-url-of-buffer] ("View Buffer Contents" . browse-url-of-buffer) [nil] ("--") "3" ("Heading 3" . html-headline-3) "2" ("Heading 2" . html-headline-2) "1" ("Heading 1" . html-headline-1) "l" ("Radio Buttons" . html-radio-buttons) "c" ("Checkboxes" . html-checkboxes) ("List Item" . html-list-item) "u" ("Unordered List" . html-unordered-list) "o" ("Ordered List" . html-ordered-list) "-" ("Horizontal Rule" . html-horizontal-rule) "\n" ("Line Break" . html-line) " " ("Paragraph" . html-paragraph) "i" ("Image" . html-image) "h" ("Href Anchor" . html-href-anchor) "n" ("Name Anchor" . html-name-anchor)] 5) (#$ . 18255)) #@47 Value of `sgml-face-tag-alist' for HTML mode. (defvar html-face-tag-alist (quote ((bold . "b") (italic . "i") (underline . "u") (modeline . "rev"))) (#$ . 19967)) #@47 Value of `sgml-tag-face-alist' for HTML mode. (defvar html-tag-face-alist (quote (("b" . bold) ("big" . bold) ("blink" . highlight) ("cite" . italic) ("em" . italic) ("h1" bold underline) ("h2" bold-italic underline) ("h3" italic underline) ("h4" . underline) ("h5" . underline) ("h6" . underline) ("i" . italic) ("rev" . modeline) ("s" . underline) ("small" . default) ("strong" . bold) ("title" bold underline) ("tt" . default) ("u" . underline) ("var" . italic))) (#$ . 20136)) #@45 Value of `sgml-display-text' for HTML mode. (defvar html-display-text (quote ((img . "[/]") (hr . "----------") (li . "o "))) (#$ . 20623)) #@43 *Value of `sgml-tag-alist' for HTML mode. (defvar html-tag-alist (byte-code " BBBBB B B BBBBBBBB BBB AABBBBBB ABBBBBBBBBB BBBBBB \"BBBB B BBBBBBBBBBBBB BBBBB@ BBA BBBB BC D BE BFF BG BHI \". BBBBBBBBBBBBBBBBBBBBBBBB" [(("8") ("9") ("1") ("2") ("3") ("4") ("5") ("6") ("7")) 1-9 (("align" ("left") ("center") ("right"))) align (("top") ("middle") ("bottom") ("baseline")) valign (("next") ("previous") ("parent") ("subdocument") ("made")) rel ("href" ("ftp:") ("file:") ("finger:") ("gopher:") ("http:") ("mailto:") ("news:") ("rlogin:") ("telnet:") ("tn3270:") ("wais:") ("/cgi-bin/")) href ("name") name "rel" "rev" (("title")) link ((nil n ("List item: " "