;ELC ;;; Compiled by cyd@localhost on Mon Apr 23 22:25:26 2007 ;;; from file /home/cyd/emacs/lisp/textmodes/tildify.el ;;; in Emacs version 22.0.99 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`tildify.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (custom-declare-group 'tildify nil "Adding missing hard spaces or other text fragments into texts." :version "21.1" :group 'wp) #@802 Alist specifying where to insert hard spaces. Each alist item is of the form (MAJOR-MODE REGEXP NUMBER) or (MAJOR-MODE . SYMBOL). MAJOR-MODE defines major mode, for which the item applies. It can be either: - a symbol equal to the major mode of the buffer to be fixed - t for default item, this applies to all major modes not defined in another alist item REGEXP is a regular expression matching the part of a text, where a hard space is missing. The regexp is always case sensitive, regardless of the current `case-fold-search' setting. NUMBER defines the number of the REGEXP subexpression which should be replaced by the hard space character. The form (MAJOR-MODE . SYMBOL) defines alias item for MAJOR-MODE. For this mode, the item for the mode SYMBOL is looked up in the alist instead. (custom-declare-variable 'tildify-pattern-alist ''((t "\\([,:;(][ ]*[a]\\|\\<[AIKOSUVZikosuvz]\\)\\([ ]+\\|[ ]*\n[ ]*\\)\\(\\w\\|[([{\\]\\|<[a-zA-Z]\\)" 2)) '(#$ . 700) :group 'tildify :type '(repeat (choice (list symbol regexp integer) (cons symbol symbol)))) #@676 Alist specifying what is a hard space in the current major mode. Each alist item is of the form (MAJOR-MODE . STRING) or (MAJOR-MODE . SYMBOL). MAJOR-MODE defines major mode, for which the item applies. It can be either: - a symbol equal to the major mode of the buffer to be fixed - t for default item, this applies to all major modes not defined in another alist item STRING defines the hard space, which is inserted at places defined by `tildify-pattern-alist'. For example it can be "~" for TeX or " " for SGML. The form (MAJOR-MODE . SYMBOL) defines alias item for MAJOR-MODE. For this mode, the item for the mode SYMBOL is looked up in the alist instead. (custom-declare-variable 'tildify-string-alist ''((latex-mode . "~") (tex-mode . latex-mode) (plain-tex-mode . latex-mode) (sgml-mode . " ") (xml-mode . sgml-mode) (html-mode . sgml-mode) (t . " ")) '(#$ . 1773) :group 'tildify :type '(repeat (cons symbol (choice string symbol)))) #@1036 Alist specifying ignored structured text environments. Parts of text defined in this alist are skipped without performing hard space insertion on them. These setting allow skipping text parts like verbatim or math environments in TeX or preformatted text in SGML. Each list element is of the form (MAJOR-MODE (BEG-REGEX . END-REGEX) (BEG-REGEX . END-REGEX) ... ) MAJOR-MODE defines major mode, for which the item applies. It can be either: - a symbol equal to the major mode of the buffer to be fixed - t for default item, this applies to all major modes not defined in another alist item BEG-REGEX is a regexp matching beginning of a text part to be skipped. END-REGEX defines end of the corresponding text part and can be either: - a regexp matching the end of the skipped text part - a list of regexps and numbers, which will compose the ending regexp by concatenating themselves, while replacing the numbers with corresponding subexpressions of BEG-REGEX (this is used to solve cases like \\verb in TeX). (custom-declare-variable 'tildify-ignored-environments-alist ''((latex-mode ("\\\\\\\\" . "") ("\\\\begin{verbatim}" . "\\\\end{verbatim}") ("\\\\verb\\*?\\(.\\)" 1) ("\\$\\$" . "\\$\\$") ("\\$" . "\\$") ("\\\\(" . "\\\\)") ("\\\\[[]" . "\\\\[]]") ("\\\\begin{math}" . "\\\\end{math}") ("\\\\begin{displaymath}" . "\\\\end{displaymath}") ("\\\\begin{equation}" . "\\\\end{equation}") ("\\\\begin{eqnarray\\*?}" . "\\\\end{eqnarray\\*?}") ("\\\\[a-zA-Z]+\\( +\\|{}\\)[a-zA-Z]*" . "") ("%" . "$")) (plain-tex-mode . latex-mode) (html-mode ("]*>" . "") ("" . "") ("" . "") ("" . "") ("" . "") ("" . "") ("]*>" . "") ("" . "") ("" . "") ("" . "") ("" . "") ("" . "") ("") ("<" . ">")) (sgml-mode . html-mode) (t nil)) '(#$ . 2743) :group 'tildify :type '(repeat (cons symbol (choice symbol (repeat sexp))))) #@27 Counter for replacements. (defvar tildify-count nil (#$ . 4748)) #@261 Add hard spaces in the region between BEG and END. See variables `tildify-pattern-alist', `tildify-string-alist', and `tildify-ignored-environments-alist' for information about configuration parameters. This function performs no refilling of the changed text. (defalias 'tildify-region #[(beg end) "\306\307\211\310 !\307\211\311\307\312 \307 \203\324\212\214~\210eb\210\204\320`\313 !\310\203?`S\202@d!\314!Y\203\207Y\204Y\314!\314!X\204i\315\314! #\211\316=\203~\307\202\207\n\307=\203\207\311\314!\314!Y\203\226\311`\314!Y\204\245\314!b\210\204'\317\307\311#\203\303`\314!V\203'\311\211\202)\320\321\"\210\311\211\203,*\202\333\315 #\210. \320\322\"\207" [tildify-count end aux regexp case-fold-search ask 0 nil copy-marker t tildify-build-regexp tildify-find-env marker-position tildify-tildify force re-search-forward message "End of environment not found: %s" "%d spaces replaced." finish end-env marker-end z a beg] 10 (#$ . 4820) "*r"]) #@249 Add hard spaces in the current buffer. See variables `tildify-pattern-alist', `tildify-string-alist', and `tildify-ignored-environments-alist' for information about configuration parameters. This function performs no refilling of the changed text. (defalias 'tildify-buffer #[nil "\300ed\"\207" [tildify-region] 3 (#$ . 5869) "*"]) #@36 Build start of environment regexp. (defalias 'tildify-build-regexp #[nil "\304!\305\211\205*\n\211@@)\nA\211\203) \306\n\211@@)Q\nA\211\204 *\207" [tildify-ignored-environments-alist regexp alist x tildify-mode-alist nil "\\|"] 4 (#$ . 6207)]) #@65 Return alist item for the MODE-ALIST in the current major MODE. (defalias 'tildify-mode-alist #[(mode-alist &optional mode) "\204 \304\n\"\206\304\305\n\"A\211\203# 9\203#\306\n \"\202$ )\207" [mode major-mode mode-alist alist assoc t tildify-mode-alist] 4 (#$ . 6470)]) #@113 Find environment using REGEXP. Return regexp for the end of the environment or nil if no environment was found. (defalias 'tildify-find-env #[(regexp) "\306\307\310#\205k\311\312!\313 !\307\314 \315\216\316 \211@@)\f\"\312=\204, A\202* \211@A)\211;\203>\n\202j\317\307\n\203g\n@\211;\203W\n\202]\320\311!!P\nA\211\204H*+\207" [regexp tildify-ignored-environments-alist expression alist match save-match-data-internal re-search-forward nil t match-string 0 tildify-mode-alist match-data ((byte-code "\301\302\"\207" [save-match-data-internal set-match-data evaporate] 3)) string-match "" regexp-quote x aux result] 5 (#$ . 6759)]) #@304 Add tilde characters in the region between BEG and END. This function does not do any further checking except of for comments and macros. If ASK is nil, perform replace without asking user for confirmation. Returns one of symbols: t (all right), nil (quit), force (replace without further questions). (defalias 'tildify-tildify #[(beg end ask) "\212b\210\306 !\211@\n\211A@)\306!\307!\310\211\310\211\310 \204\301\311 \312!\313#\203\301!\203\260 \224b\210\313\203\\\310\314\315!\210\316 \202I\317=\204q\320=\204q\321=\203w\313\202\253\322=\203\204\310\202\253\323=\203\224\313\310!\202\253\324=\203\244\310\313\202\253\314\325!\210\313\203-\326\313\211\310 %\210\"T\"\202-\203\312\310\202\324!\204\323\327\202\324\313. \207" [beg tildify-pattern-alist alist regexp x match-number tildify-mode-alist copy-marker nil re-search-forward marker-position t message "Replace? (yn!q) " read-event 121 32 space 110 33 113 "Press y, n, !, or q." replace-match force tildify-string-alist tilde end end-marker answer bad-answer replace quit message-log-max ask tildify-count] 7 (#$ . 7433)]) (provide 'tildify)