;;; x-symbol-sgml.el --- token language "SGML entity" for package x-symbol ;; Copyright (C) 1996-1999, 2002, 2003 Free Software Foundation, Inc. ;; ;; Author: Christoph Wedler ;; Maintainer: (Please use `M-x x-symbol-package-bug' to contact the maintainer) ;; Version: 4.5 ;; Keywords: WYSIWYG, HTML, wp, math, internationalization ;; X-URL: http://x-symbol.sourceforge.net/ ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;;; Commentary: ;; If you want to use package x-symbol, please visit the URL (use ;; \\[x-symbol-package-web]) and read the info (use \\[x-symbol-package-info]). ;; Token language sgml is registered in x-symbol-hooks. ;;; Code: (provide 'x-symbol-sgml) ;;;=========================================================================== ;;; Auto-style ;;;=========================================================================== (defcustom x-symbol-sgml-auto-style '((not (memq major-mode '(sgml-mode xml-mode))) (x-symbol-auto-coding-alist x-symbol-sgml-auto-coding-alist) x-symbol-coding (not x-symbol-mode) x-symbol-mode x-symbol-mode) "Values for X-Symbol's buffer-local variables with language `sgml'. See language access `x-symbol-LANG-auto-style'." :group 'x-symbol-sgml :group 'x-symbol-mode :type 'x-symbol-auto-style) (defcustom x-symbol-sgml-auto-coding-alist '(("" 1 ("iso-8859-1" . iso-8859-1) ("iso-8859-2" . iso-8859-2) ("iso-8859-3" . iso-8859-3) ("iso-8859-9" . iso-8859-9) ("iso-8859-15" . iso-8859-15))) "*Alist used to determine the file coding with language `sgml'. Used in the default value of `x-symbol-sgml-auto-style'. See variable `x-symbol-auto-coding-alist' for details." :group 'x-symbol-sgml :group 'x-symbol-mode :type 'x-symbol-auto-coding) ;;;=========================================================================== ;;; Miscellaneous variables ;;;=========================================================================== (defface x-symbol-sgml-symbol-face '((((class color) (background light)) (:foreground "orange4"))) "*Face used for entities with name representing non-Latin-1 characters. Used in `x-symbol-sgml-class-face-alist'." :group 'x-symbol-sgml :group 'x-symbol-info-general) (defface x-symbol-sgml-noname-face '((((class color) (background light)) (:foreground "red4"))) "*Face used for Latin-N character entities without name. Used in `x-symbol-sgml-class-face-alist'." :group 'x-symbol-sgml :group 'x-symbol-info-general) (defcustom x-symbol-sgml-modeline-name "sgml" "Modeline name of token language `sgml'. See language access `x-symbol-LANG-modeline-name'." :group 'x-symbol-sgml :type 'string) (defcustom x-symbol-sgml-header-groups-alist '(("Operator" bigop operator) ("Relation" relation) ("Arrow, Punctuation" arrow triangle shape white line dots punctuation quote parenthesis) ("Symbol" symbol currency mathletter setsymbol) ("Greek Letter" greek greek1) ("Misc. Letter" letter slash) ("Cedilla, Ogonek" cedilla ogonek) ("Dotaccent, Ring" dotaccent ring) ("Tilde, Breve" tilde breve) ("Circumflex, Caron" circumflex caron) ("Diaeresis, Umlaut" diaeresis hungarumlaut) ("Acute, Grave" acute grave)) "Header/submenu specification of the specific menu for language `sgml'. See language access `x-symbol-LANG-header-groups-alist'." :group 'x-symbol-sgml :group 'x-symbol-input-init :type 'x-symbol-headers) (defcustom x-symbol-sgml-class-alist '((symbol) (noname "SGML char-ref" (x-symbol-emph-info-face)) (VALID "SGML entity" (x-symbol-info-face)) (INVALID "no SGML entity" (x-symbol-emph-info-face))) "Token classes displayed by info in echo area, for language `sgml'. See language access `x-symbol-LANG-class-alist'." :group 'x-symbol-sgml :group 'x-symbol-info-strings :type 'x-symbol-class-info) (defcustom x-symbol-sgml-class-face-alist '((symbol x-symbol-sgml-symbol-face (x-symbol-sgml-symbol-face)) (noname x-symbol-sgml-noname-face (x-symbol-sgml-noname-face))) "Color scheme in language specific grid and info, for language `sgml'. See language access `x-symbol-LANG-class-face-alist'." :group 'x-symbol-sgml :group 'x-symbol-input-init :group 'x-symbol-info-general :type 'x-symbol-class-faces) (defcustom x-symbol-sgml-electric-ignore nil "Specification restricting input method ELECTRIC with language `sgml'. See language access `x-symbol-LANG-electric-ignore'." :group 'x-symbol-sgml :group 'x-symbol-input-control :type 'x-symbol-function-or-regexp) (defvar x-symbol-sgml-token-list 'x-symbol-sgml-token-list-name "Symbol specifying the token definition for language `sgml'. Allowed values are - `x-symbol-sgml-token-list-name': the canonical token for a character is a entity references, - `x-symbol-sgml-token-list-code': the canonical token for a character is a character references, - `x-symbol-sgml-token-list-netscape': the canonical token for a Latin-1 character is a entity references, for others, it is a character references. Bug workaround for Netscape, v4.6 or lower. The value is used by function `x-symbol-sgml-default-token-list' which is used for the definition of the conversion tables. See `x-symbol-sgml-token-grammar'.") (defvar x-symbol-sgml-token-grammar '(x-symbol-make-grammar :decode-regexp "&[#0-9A-Za-z]+;" :token-list x-symbol-sgml-default-token-list) "Grammar of token language `sgml'. See language access `x-symbol-LANG-token-grammar'.") (defvar x-symbol-sgml-user-table nil "User table defining SGML entities, used in `x-symbol-sgml-table'.") (defvar x-symbol-sgml-generated-data nil "Generated data for token language `sgml'. See language access `x-symbol-LANG-generated-data'.") ;;;=========================================================================== ;;; Image support ;;;=========================================================================== (defcustom x-symbol-sgml-master-directory 'ignore "Function returning the directory of the master file or nil. See `x-symbol-image-parse-buffer'." :group 'x-symbol-sgml :group 'x-symbol-image-language :type 'function) (defcustom x-symbol-sgml-image-searchpath '("./") "Search path for implicitly relative image file names. See language access `x-symbol-LANG-image-searchpath'." :group 'x-symbol-sgml :group 'x-symbol-image-language :type '(repeat directory)) (defcustom x-symbol-sgml-image-cached-dirs '("images/" "pictures/") "Directory parts of images stored in the memory cache. See language access `x-symbol-LANG-image-cached-dirs'." :group 'x-symbol-sgml :group 'x-symbol-image-language :type '(repeat string)) (defcustom x-symbol-sgml-image-file-truename-alist '(("\\`file:" . "") ("\\`[A-Za-z]+:")) "Alist used to determine the file name of an image URL. Each element looks like (REGEXP) or (REGEXP . NEWTEXT) or (REGEXP FUNCTION ARG...) If the the image file name is matched by REGEXP, the corresponding element is processed, if no REGEXP matches, the image file name is used as it is. With the first form, the image command will not be highlighted. With the second form, replace text matched by REGEXP with NEWTEXT, see `replace-match' for details. With the third form, FUNCTION, call FUNCTION with the image file name and the remaining arguments ARGs to get the true file name. E.g., I add the following element to this variable: (\"\\\\`http://www\\\\.fmi\\\\.uni-passau\\\\.de/~wedler/\" \. \"~/public_html/\")" :group 'x-symbol-sgml :group 'x-symbol-image-language :type '(repeat (cons :format "%v" :value ("" . "") ; doesn't work (custom bug?) regexp (choice ;;:value "" (const :tag "Not highlighted" nil) (string :tag "Replace match with") (cons :tag "Call" function (repeat :tag "With arguments" sexp)))))) (defcustom x-symbol-sgml-image-keywords '("\\.\\(gif\\|png\\|jpe?g\\)\\'" ("]*src=\"\\([^\n\"]+\\)\"[^\n>]*>" x-symbol-sgml-image-file-truename 1)) "Keywords for image insertion commands of language `sgml'. See language access `x-symbol-LANG-image-keywords'." :group 'x-symbol-sgml :group 'x-symbol-image-language :type 'x-symbol-image-keywords) (defun x-symbol-sgml-image-file-truename (num) "Return true image file name for last match. Return text matched by the NUMth regexp group of the corresponding keyword regexp, after being processed according to `x-symbol-sgml-image-file-truename-alist'." (x-symbol-match-in-alist (setq num (match-string num)) x-symbol-sgml-image-file-truename-alist num t)) ;;;=========================================================================== ;;; Super- and Subscripts ;;;=========================================================================== (defcustom x-symbol-sgml-subscript-matcher 'x-symbol-sgml-subscript-matcher "Function matching super-/subscripts for language `sgml'. See language access `x-symbol-LANG-subscript-matcher'." :group 'x-symbol-sgml :type 'function) (defcustom x-symbol-sgml-font-lock-regexp "" "Regexp matching the start tag of SGML's super- and subscripts. See also `x-symbol-sgml-font-lock-alist'." :group 'x-symbol-sgml :type 'regexp) (defcustom x-symbol-sgml-font-lock-limit-regexp "\n\\|" "Regexp matching the end tag of SGML's super- and subscripts. This regexp should match the end of line and the closing tags in `x-symbol-sgml-font-lock-alist'." :group 'x-symbol-sgml :type 'regexp) (defcustom x-symbol-sgml-font-lock-contents-regexp "[^ \t\n\240]" "*Regexp matching the super- and subscript contents. This regexp should match the text between the opening and closing super- or subscript tag." :group 'x-symbol-sgml :type 'regexp) (defcustom x-symbol-sgml-font-lock-alist '(("" . "") ("" . "")) "Alist for correct tag pairs for HTML's super- and subscripts. Each element looks like (OPEN . CLOSE). All keys OPEN in this alist should be matched by `x-symbol-sgml-font-lock-regexp', all CLOSEs should be matched by `x-symbol-sgml-font-lock-limit-regexp'." :group 'x-symbol-sgml :type '(repeat (cons :format "%v" (string :tag "Open tag") (string :tag "Close tag")))) ;;;=========================================================================== ;;; The tables ;;;=========================================================================== (defun x-symbol-sgml-default-token-list (tokens) (mapcar #'list (and (car tokens) (memq x-symbol-sgml-token-list '(x-symbol-sgml-token-list-name x-symbol-sgml-token-list-code x-symbol-sgml-token-list-netscape)) (if (or (eq x-symbol-sgml-token-list 'x-symbol-sgml-token-list-name) (and (eq x-symbol-sgml-token-list 'x-symbol-sgml-token-list-netscape) (< (car tokens) 256))) (append (cdr tokens) (list (format "&#%d;" (car tokens)))) (cons (format "&#%d;" (car tokens)) (cdr tokens)))))) ;; http://www.w3.org/TR/REC-html40/sgml/entities.html ;; (query-replace-regexp "[ \t]*.*$" " (\\1 () \\2 \"&\\1;\") ; \\3") (defvar x-symbol-sgml-latin1-table '((nobreakspace () 160 " ") (exclamdown () 161 "¡") (cent () 162 "¢") (sterling () 163 "£") (currency () 164 "¤") (yen () 165 "¥") (brokenbar () 166 "¦" "&brkbar;") (section () 167 "§") (diaeresis () 168 "¨" "¨") (copyright () 169 "©") (ordfeminine () 170 "ª") (guillemotleft () 171 "«") (notsign () 172 "¬") (hyphen () 173 "­") (registered () 174 "®") (macron () 175 "¯" "&hibar;") (degree () 176 "°") (plusminus () 177 "±") (twosuperior () 178 "²") (threesuperior () 179 "³") (acute () 180 "´") (mu1 () 181 "µ") (paragraph () 182 "¶") (periodcentered () 183 "·") (cedilla () 184 "¸") (onesuperior () 185 "¹") (masculine () 186 "º") (guillemotright () 187 "»") (onequarter () 188 "¼") (onehalf () 189 "½") (threequarters () 190 "¾") (questiondown () 191 "¿") (Agrave () 192 "À") (Aacute () 193 "Á") (Acircumflex () 194 "Â") (Atilde () 195 "Ã") (Adiaeresis () 196 "Ä") (Aring () 197 "Å") (AE () 198 "Æ") (Ccedilla () 199 "Ç") (Egrave () 200 "È") (Eacute () 201 "É") (Ecircumflex () 202 "Ê") (Ediaeresis () 203 "Ë") (Igrave () 204 "Ì") (Iacute () 205 "Í") (Icircumflex () 206 "Î") (Idiaeresis () 207 "Ï") (ETH () 208 "Ð") ; "Đ" for Dbar (U0110) = latin2#208? (Ntilde () 209 "Ñ") (Ograve () 210 "Ò") (Oacute () 211 "Ó") (Ocircumflex () 212 "Ô") (Otilde () 213 "Õ") (Odiaeresis () 214 "Ö") (multiply () 215 "×") (Ooblique () 216 "Ø") (Ugrave () 217 "Ù") (Uacute () 218 "Ú") (Ucircumflex () 219 "Û") (Udiaeresis () 220 "Ü") (Yacute () 221 "Ý") (THORN () 222 "Þ") (ssharp () 223 "ß") (agrave () 224 "à") (aacute () 225 "á") (acircumflex () 226 "â") (atilde () 227 "ã") (adiaeresis () 228 "ä") (aring () 229 "å") (ae () 230 "æ") (ccedilla () 231 "ç") (egrave () 232 "è") (eacute () 233 "é") (ecircumflex () 234 "ê") (ediaeresis () 235 "ë") (igrave () 236 "ì") (iacute () 237 "í") (icircumflex () 238 "î") (idiaeresis () 239 "ï") (eth () 240 "ð") (ntilde () 241 "ñ") (ograve () 242 "ò") (oacute () 243 "ó") (ocircumflex () 244 "ô") (otilde () 245 "õ") (odiaeresis () 246 "ö") (division () 247 "÷") (oslash () 248 "ø") (ugrave () 249 "ù") (uacute () 250 "ú") (ucircumflex () 251 "û") (udiaeresis () 252 "ü") (yacute () 253 "ý") (thorn () 254 "þ") (ydiaeresis () 255 "ÿ")) "Table defining SGML entities, see `x-symbol-sgml-table'.") (defvar x-symbol-sgml-latinN-table '((Aogonek (noname) 260) (breve (noname) 728) (Lslash (noname) 321) (Lcaron (noname) 317) (Sacute (noname) 346) (Scaron (symbol) 352 "Š") (Scedilla (noname) 350) (Tcaron (noname) 356) (Zacute (noname) 377) (Zcaron (noname) 381) (Zdotaccent (noname) 379) (aogonek (noname) 261) (ogonek (noname) 731) (lslash (noname) 322) (lcaron (noname) 318) (sacute (noname) 347) (caron (noname) 711) (scaron (symbol) 353 "š") (scedilla (noname) 351) (tcaron (noname) 357) (zacute (noname) 378) (hungarumlaut (noname) 733) (zcaron (noname) 382) (zdotaccent (noname) 380) (Racute (noname) 340) (Abreve (noname) 258) (Lacute (noname) 313) (Cacute (noname) 262) (Ccaron (noname) 268) (Eogonek (noname) 280) (Ecaron (noname) 282) (Dcaron (noname) 270) (Dbar (noname) 272) (Nacute (noname) 323) (Ncaron (noname) 327) (Ohungarumlaut (noname) 336) (Rcaron (noname) 344) (Uring (noname) 366) (Uhungarumlaut (noname) 368) (Tcedilla (noname) 354) (racute (noname) 341) (abreve (noname) 259) (lacute (noname) 314) (cacute (noname) 263) (ccaron (noname) 269) (eogonek (noname) 281) (ecaron (noname) 283) (dcaron (noname) 271) (dbar (noname) 273) (nacute (noname) 324) (ncaron (noname) 328) (ohungarumlaut (noname) 337) (rcaron (noname) 345) (uring (noname) 367) (uhungarumlaut (noname) 369) (tcedilla (noname) 355) (dotaccent (noname) 729) (Hbar (noname) 294) (Hcircumflex (noname) 292) (Idotaccent (noname) 304) (Gbreve (noname) 286) (Jcircumflex (noname) 308) (hbar (noname) 295) (hcircumflex (noname) 293) (dotlessi (noname) 305) (gbreve (noname) 287) (jcircumflex (noname) 309) (Cdotaccent (noname) 266) (Ccircumflex (noname) 264) (Gdotaccent (noname) 288) (Gcircumflex (noname) 284) (Ubreve (noname) 364) (Scircumflex (noname) 348) (cdotaccent (noname) 267) (ccircumflex (noname) 265) (gdotaccent (noname) 289) (gcircumflex (noname) 285) (ubreve (noname) 365) (scircumflex (noname) 349) (euro (symbol) 8364 "€") (OE (symbol) 338 "Œ") (oe (symbol) 339 "œ") (Ydiaeresis (symbol) 376 "Ÿ")) "Table defining SGML entities, see `x-symbol-sgml-table'.") (defvar x-symbol-sgml-xsymb0-table '((Delta (symbol) 916 "Δ") (Phi (symbol) 934 "Φ") (Gamma (symbol) 915 "Γ") (theta1 (symbol) 977 "ϑ") (Lambda (symbol) 923 "Λ") (Pi (symbol) 928 "Π") (Theta (symbol) 920 "Θ") (Sigma (symbol) 931 "Σ") (sigma1 (symbol) 962 "ς") (Omega (symbol) 937 "Ω") (Xi (symbol) 926 "Ξ") (Psi (symbol) 936 "Ψ") (alpha (symbol) 945 "α") (beta (symbol) 946 "β") (chi (symbol) 967 "χ") (delta (symbol) 948 "δ") (epsilon (symbol) 949 "ε") (phi (symbol) 966 "φ") (gamma (symbol) 947 "γ") (eta (symbol) 951 "η") (iota (symbol) 953 "ι") (kappa (symbol) 954 "κ") (lambda (symbol) 955 "λ") (mu (symbol) 956 "μ") (nu (symbol) 957 "ν") (pi (symbol) 960 "π") (theta (symbol) 952 "θ") (rho (symbol) 961 "ρ") (sigma (symbol) 963 "σ") (tau (symbol) 964 "τ") (upsilon (symbol) 965 "υ") (omega1 (symbol) 982 "ϖ") (omega (symbol) 969 "ω") (xi (symbol) 958 "ξ") (psi (symbol) 968 "ψ") (zeta (symbol) 950 "ζ") (Upsilon1 (symbol) 978 "ϒ") (florin (symbol) 402 "ƒ") (bullet (symbol) 8226 "•") (ellipsis (symbol) 8230 "…") (minute (symbol) 8242 "′") (second (symbol) 8243 "″") (radicalex (symbol) 8254 "‾") (fraction (symbol) 8260 "⁄") (weierstrass (symbol) 8472 "℘") (Ifraktur (symbol) 8465 "ℑ") (Rfraktur (symbol) 8476 "ℜ") (trademark (symbol) 8482 "™") (aleph (symbol) 8501 "ℵ") (arrowleft (symbol) 8592 "←") (arrowup (symbol) 8593 "↑") (arrowright (symbol) 8594 "→") (arrowdown (symbol) 8595 "↓") (arrowboth (symbol) 8596 "↔") (carriagereturn (symbol) 8629 "↵") (arrowdblleft (symbol) 8656 "⇐") (arrowdblup (symbol) 8657 "⇑") (arrowdblright (symbol) 8658 "⇒") (arrowdbldown (symbol) 8659 "⇓") (arrowdblboth (symbol) 8660 "⇔") (partialdiff (symbol) 8706 "∂") (emptyset (symbol) 8709 "∅") (gradient (symbol) 8711 "∇") (element (symbol) 8712 "∈") (notelement (symbol) 8713 "∉") (suchthat (symbol) 8715 "∋") (product (symbol) 8719 "∏") (summation (symbol) 8721 "∑") (minus1 (symbol) 8722 "−") (asterisk1 (symbol) 8727 "∗") (radical (symbol) 8730 "√") (proportional (symbol) 8733 "∝") (infinity (symbol) 8734 "∞") (angle (symbol) 8736 "∠") (logicaland (symbol) 8743 "∧") (logicalor (symbol) 8744 "∨") (intersection (symbol) 8745 "∩") (union (symbol) 8746 "∪") (integral (symbol) 8747 "∫") (similar (symbol) 8764 "∼") (congruent (symbol) 8773 "≅") (notequal (symbol) 8800 "≠") (equivalence (symbol) 8801 "≡") (lessequal (symbol) 8804 "≤") (greaterequal (symbol) 8805 "≥") (propersubset (symbol) 8834 "⊂") (propersuperset (symbol) 8835 "⊃") (notsubset (symbol) 8836 "⊄") (reflexsubset (symbol) 8838 "⊆") (reflexsuperset (symbol) 8839 "⊇") (circleplus (symbol) 8853 "⊕") (circlemultiply (symbol) 8855 "⊗") (perpendicular (symbol) 8869 "⊥") (periodcentered1 (symbol) 8901 "⋅") (angleleft (symbol) 9001 "⟨") (angleright (symbol) 9002 "⟩") (lozenge (symbol) 9674 "◊") (spade (symbol) 9824 "♠") (club (symbol) 9827 "♣") (heart (symbol) 9829 "♥") (diamond (symbol) 9830 "♦")) "Table defining SGML entities, see `x-symbol-sgml-table'.") (defvar x-symbol-sgml-xsymb1-table '((ampersand2 () 38 "&") (quotedbl1 () 34 """) (less2 () 60 "<") (greater2 () 62 ">") (universal1 (symbol) 8704 "∀") (existential1 (symbol) 8707 "∃") (circumflex (symbol) 710 "ˆ") (tilde (symbol) 732 "˜") ;;(ensp (symbol) 8194 " ") ; en space, U+2002 ISOpub ;;(emsp (symbol) 8195 " ") ; em space, U+2003 ISOpub ;;(thinsp (symbol) 8201 " ") ; thin space, U+2009 ISOpub ;;(zwnj (symbol) 8204 "‌") ; zero width non-joiner, U+200C NEW RFC 2070 ;;(zwj (symbol) 8205 "‍") ; zero width joiner, U+200D NEW RFC 2070 ;;(lrm (symbol) 8206 "‎") ; left-to-right mark, U+200E NEW RFC 2070 ;;(rlm (symbol) 8207 "‏") ; right-to-left mark, U+200F NEW RFC 2070 (endash (symbol) 8211 "–") (emdash (symbol) 8212 "—") ;;(lsquo (symbol) 8216 "‘") ; left single quotation mark, U+2018 ISOnum ;;(rsquo (symbol) 8217 "’") ; right single quotation mark, U+2019 ISOnum ;;(sbquo (symbol) 8218 "‚") ; single low-9 quotation mark, U+201A NEW ;;(ldquo (symbol) 8220 "“") ; left double quotation mark, U+201C ISOnum ;;(rdquo (symbol) 8221 "”") ; right double quotation mark, U+201D ISOnum ;;(bdquo (symbol) 8222 "„") ; double low-9 quotation mark, U+201E NEW (dagger (symbol) 8224 "†") (daggerdbl (symbol) 8225 "‡") (perthousand (symbol) 8240 "‰") (guilsinglleft (symbol) 8249 "‹") (guilsinglright (symbol) 8250 "›") (therefore1 (symbol) 8756 "∴") (ceilingleft (symbol) 8968 "⌈") (ceilingright (symbol) 8969 "⌉") (floorleft (symbol) 8970 "⌊") (floorright (symbol) 8971 "⌋") (asym (symbol) 8776 "≈") ) "Table defining SGML entities, see `x-symbol-sgml-table'.") ;; Should I add symbols from http://www.bbsinc.com/iso8859.html ? (defvar x-symbol-sgml-table (append x-symbol-sgml-user-table '(nil) x-symbol-sgml-latin1-table x-symbol-sgml-latinN-table x-symbol-sgml-xsymb0-table x-symbol-sgml-xsymb1-table) "Table defining `sgml' tokens for the characters. See language access `x-symbol-LANG-table' and variable `x-symbol-sgml-token-list'. Use `x-symbol-sgml-user-table' to define private SGML entities or shadow existing ones.") ;;;=========================================================================== ;;; Subscript functions ;;;=========================================================================== (defun x-symbol-sgml-subscript-matcher (limit) ;; checkdoc-params: (limit) "Match and skip over super- and subscripts. Return nil if `x-symbol-mode' or `x-symbol-subscripts' is nil. Uses `x-symbol-sgml-font-lock-regexp'." (block nil (let (open-beg open-end close-end close-beg) (while (re-search-forward x-symbol-sgml-font-lock-regexp limit t) (setq open-beg (match-beginning 0) open-end (match-end 0)) (when (re-search-forward x-symbol-sgml-font-lock-limit-regexp limit 'limit) (setq close-beg (match-beginning 0) close-end (match-end 0)) (if (equal (cdr (assoc (downcase (buffer-substring open-beg open-end)) x-symbol-sgml-font-lock-alist)) (downcase (buffer-substring close-beg close-end))) (when (save-excursion (goto-char open-end) (re-search-forward x-symbol-sgml-font-lock-contents-regexp close-beg t)) (store-match-data (list open-beg close-end open-beg open-end open-end close-beg close-beg close-end)) (return (if (eq (char-after (+ 3 open-beg)) ?b) 'x-symbol-sub-face 'x-symbol-sup-face))) (goto-char close-beg))))))) ;;; Local IspellPersDict: .ispell_xsymb ;;; x-symbol-sgml.el ends here