(defconst ispell:highlight-p t "\ *When not nil, spelling errors will be highlighted.") (defvar ispell:check-comments nil "\ *When true, the spelling of comments in region is checked.") (defvar ispell:check-tib nil "\ *If non-nil, the spelling of references for the tib(1) bibliography program is checked. Else any text between strings matching the regexps ispell:tib-ref-beginning and ispell:tib-ref-end is ignored, usually what you want.") (defvar ispell:tib-ref-beginning "\\(\\[\\.\\)\\|\\(<\\.\\)" "\ Regexp matching the beginning of a Tib reference.") (defvar ispell:tib-ref-end "\\(\\.\\]\\)\\|\\(\\.>\\)" "\ Regexp matching the end of a Tib reference.") (defvar ispell:keep-choices-win t "\ *When true, the *Choices* window remains for spelling session.") (defvar ispell:program-name "ispell" "\ Program invoked by ispell-word and ispell-region commands.") (defvar ispell:alternate-dictionary "/usr/dict/web2" "\ Alternate dictionary for spelling help.") (defvar ispell:grep-command "/usr/bin/egrep" "\ Name of the grep command for search processes.") (defvar ispell:look-command "/usr/bin/look" "\ Name of the look command for search processes.") (defvar ispell:dictionary nil "\ If non-nil, a dictionary to use instead of the default one. This is passed to the ispell process using the \"-d\" switch and is used as key in ispell:dictionary-alist (which see). You should set this variable before your first call to ispell (e.g. in your .emacs), or use the \\[ispell-change-dictionary] command to change it, as changing this variable only takes effect in a newly started ispell process.") (defvar ispell:dictionary-alist (quote ((nil "[A-Za-z]" "[^A-Za-z]" "[---']" nil nil) ("german" "[A-Za-z]" "[^A-Za-z]" "[---'\"]" t ("-C")))) "\ An alist of dictionaries and their associated parameters. Each element of this list is also a list: (DICTIONARY-NAME CASECHARS NOT-CASECHARS OTHERCHARS MANY-OTHERCHARS-P ISPELL-ARGS) DICTIONARY-NAME is a possible value of variable ispell:dictionary, nil means the default dictionary. CASECHARS is a regular expression of valid characters that comprise a word. NOT-CASECHARS is the opposite regexp of CASECHARS. OTHERCHARS is a regular expression of other characters that are valid in word constructs. Otherchars cannot be adjacent to each other in a word, nor can they begin or end a word. This implies we can't check \"Stevens'\" as a correct possessive and other correct formations. Hint: regexp syntax requires the hyphen to be declared first here. MANY-OTHERCHARS-P is non-nil if many otherchars are to be allowed in a word instead of only one. ISPELL-ARGS is a list of additional arguments passed to the ispell subprocess. Note that the CASECHARS and OTHERCHARS slots of the alist should contain the same character set as casechars and otherchars in the language.aff file (e.g., english.aff).") (defun ispell:get-casechars nil (byte-code " \"8" [ispell:dictionary ispell:dictionary-alist 1 assoc] 4)) (defun ispell:get-not-casechars nil (byte-code " \"8" [ispell:dictionary ispell:dictionary-alist 2 assoc] 4)) (defun ispell:get-otherchars nil (byte-code " \"8" [ispell:dictionary ispell:dictionary-alist 3 assoc] 4)) (defun ispell:get-many-otherchars-p nil (byte-code " \"8" [ispell:dictionary ispell:dictionary-alist 4 assoc] 4)) (defun ispell:get-ispell-args nil (byte-code " \"8" [ispell:dictionary ispell:dictionary-alist 5 assoc] 4)) (defvar ispell-process nil "\ Holds the process object for 'ispell'") (defvar ispell:pdict-modified-p nil "\ T when the personal dictionary has modifications that need to be written.") (defvar ispell:quit nil "\ Set to t when user want to abort ispell session.") (defvar ispell:look-p t "\ Use look. Automatically reset if look not available") (defvar ispell:filter nil "\ Output filter from piped calls to ispell.") (defvar ispell:filter-continue nil "\ Control variable for ispell filter function.") (defun ispell-word (&optional preceding quietly) "\ Check spelling of word under or following the cursor. If word not found in dictionary, display possible corrections in a window and let user select. Optional argument PRECEDING set for checking preceding word when not over a word, and QUIETLY suppresses messages when word is correct. Word syntax described by ispell:dictionary-alist (which see)." (interactive) (byte-code "Ԉ     ݂&   !?O Je#Od# e# !go?g ?g ͉!! e#!V d#!!!\" )b !\" \" Q\"!@\"?Ԉ\"A<@!  = !\" ;-* ! !# ?9!G# AA@ AAA@ @# U\\\\Tw) V! !` Z!` X `\")) ! Z!eb !! !!r ZWW5ZWFZWWZWhZ@W}AZZ BU͂H CUDEQ\"F͂H GUDHQ\"C͂H IUJK\"BH LU U MU N ̂H OU ̉͂H PU?QR!<̉S!͉H TUJU\"Չ!q ۉ V!  i @G# VcT\\ @% AW>U\\\\Ty) !X \" V Z!Y Z! !*̂HYW  8H ZU[ ̂H \\U1] )̂H ^UB_ ̂H` ̉=T͈ ." [count line choices miss window-min-height char num result ispell:keep-choices-win mode-line-format guess cur-point t nil ispell-process word ispell:pdict-modified-p help-char ispell:quit new-word new-line 0 2 select-window previous-window get-buffer-create "*Choices*" "-- %b --" equal get-buffer erase-buffer error "Bogus, dude! I should be in the *Choices* buffer, but I'm not!" " Affix rules generate and capitalize this word as shown below: " + 4 window-width " " insert " " " Use option \"i\" if this is a correct composition from the derivative root. " 7 "(" 48 ") " " " (14 48 56 59 64 71) 64 3 switch-to-buffer next-window move-to-window-line set-window-start selected-window enlarge-window overlay-window message "^h or ? for more options; Space to leave unchanged, Character to replace word" 15 49 1 57 60 65 72 6 32 105 process-send-string "*" (t) 97 "@" 114 read-string "Replacement: " 63 8 ispell-choose-help 120 113 y-or-n-p "Really quit ignoring changes? " process-send-eof 108 "Lookup string ('*' is wildcard): " lookup-words (14 48 56 59 64 71) /= shrink-window 12 redraw-display 18 recursive-edit 26 suspend-emacs ding] 54))] 1)) (defun ispell-choose-help nil (byte-code "! \"\"Ȑ!! !$ˋ*" [help-1 help-2 epoch::version "[r]eplace word; [a]ccept for this session; [i]nsert into private dictionary;" "[l]ook a word up in alternate dictionary; e[x]it; [q]uit session." boundp equal "Epoch 3.1" "*Ispell Help*" princ " " ((byte-code " !!! !! )" [help-2 help-1 select-window minibuffer-window message enlarge-window 1 sit-for 5 erase-buffer] 8))] 7)) (defun lookup-words (word) "\ Look up word in dictionary contained in the ispell:alternate-dictionary variable. A '*' is used for wild cards. If no wild cards, LOOK is used if it exists. Otherwise the variable ispell:grep-command contains the command used to search for the words (usually egrep)." (byte-code " É  \"?!! &\"!!=GÈ4 G!!! @\"?gÉ!!É  Q&\"!!=È)!!!    #    OQ  T   OP ÅÈ Q+ &\"!!= È )  !*" [save-ispell-filter ispell:filter results nil ispell:look-p word temp-ispell-process ispell:look-command ispell:alternate-dictionary ispell:filter-continue ispell:grep-command start new-word end string-match "\\*" message "Starting \"look\" process..." sit-for 0 start-process "look" "-df" set-process-filter ispell-filter accept-process-output process-status run zerop 1 "Couldn't exec the program " "Look failed, starting \"egrep\" process..." "egrep" "-i" "^" "$" "Starting \"egrep\" process..." ".*" nreverse] 27)) (defun ispell-filter (process output) "\ Output filter function for ispell, grep, and look." (byte-code " c # <0@  OP\":  OB ?Hlj_ T GU\\lj_ +" [start continue t end output ispell:filter-continue ispell:filter nil 0 string-match " " setcar] 8)) (defun highlight-spelling-error (start end &optional highlight) "\ Highlight a word by toggling inverse-video. highlights word from START to END. When the optional third arg HIGHLIGHT is set, the word is drawn in inverse video, otherwise the word is drawn in normal video mode." (byte-code "\" #S \" \" Z\"! 7 ? \" c! N ? !," [emacs-version start end highlight modified text inhibit-quit t buffer-undo-list nil inverse-video string-match "^19\\." highlight-spelling-error-v19 buffer-modified-p buffer-substring delete-region insert-char 32 sit-for 0 set-buffer-modified-p] 11)) (defun highlight-spelling-error-v19 (start end &optional highlight) (byte-code " B \" \"! @ AƉ!" [highlight ispell-saved-selection selection-begin selection-end start end nil set-marker make-marker sit-for 0] 6)) (defun overlay-window (height) "\ Create a (usually small) window with HEIGHT lines and avoid recentering." (byte-code " `) !`) W ! \"+)" [oldot top height newin beginning-of-line move-to-window-line nil split-window-vertically set-window-start] 6)) (defun ispell-parse-output (output) "\ Parse the OUTPUT string of 'ispell' and return: 1) T for an exact match. 2) A string containing the root word for a match via suffix removal. 3) A list of possible correct spellings of the format: '(\"original-word\" offset miss-list guess-list) original-word is a string of the possibly misspelled word. offset is an integer of the line offset of the word. miss-list and guess-list are possibly null list of guesses and misses." (byte-code "\" \"O\"'OO#O !O \"UΉf!#TO! \"{ɉ#TO\" T V OB OB!ɉ \\O) F." [output t type original-word cur-count count miss-list guess-list offset nil end string= "" "*" 0 1 "+" 2 string-match " " match-end "#" string-to-int ",\\|\\($\\)"] 17)) (defun ispell-init-process nil "\ Check status of 'ispell' process and start if necessary." (byte-code " !=‰U!! 4D \" )&‰\"!‰\"!" [ispell-process ispell:filter nil ispell:filter-continue ispell:program-name args ispell:dictionary process-status run message "Starting new ispell process..." sit-for 0 apply start-process "ispell" "-a" "-m" ispell:get-ispell-args append "-d" set-process-filter ispell-filter accept-process-output process-send-string "! " process-kill-without-query] 14)) (defun ispell-kill-ispell (&optional no-error) "\ Kill current ispell process (so that you may start a fresh one)." (interactive) (byte-code "ˆ !=? !\"!!‡" [ispell-process no-error nil process-status run error "There is no ispell process running!" kill-process message "Killed ispell process."] 5)) (defun ispell-change-dictionary (dict) "\ Change ispell:dictionary (q.v.) and kill old ispell process. A new one will be started as soon as necessary. By just answering RET you can find out what the current dictionary is." (interactive (byte-code "$C" [ispell:dictionary-alist nil t completing-read "Use new ispell dictionary (type SPC to complete): "] 5)) (byte-code " \"  \"#  \"7 ! 5 6\"" [ispell:dictionary-alist nil t dict ispell:dictionary equal "" message "(No change, using %s dictionary)" "default" ispell-kill-ispell "(Next ispell command will use %s dictionary)"] 7)) (defun ispell-region (reg-start reg-end) "\ Interactively check a region for spelling errors." (interactive "*r") (byte-code "ۈ > \" \"㎊ eU% dU- .\"!))" [major-mode ispell-process reg-start reg-end ispell:keep-choices-win window-min-height mode-line-format ispell:quit start offset-change end ispell-casechars string ispell:check-comments comment-start t comment-end limit ispell:check-tib ispell:tib-ref-beginning ispell:tib-ref-end poss ispell:filter word-start word-end replace ispell:highlight-p nil change ispell:pdict-modified-p ispell-init-process (plain-TeX-mode plain-tex-mode TeX-mode tex-mode LaTeX-mode latex-mode) process-send-string "+ " "- " ((byte-code "! ! !" [ispell:quit nil get-buffer "*Choices*" kill-buffer ispell-pdict-save message "Spell done."] 5)) message "Spelling %s..." buffer-name "region" sit-for 0 ((byte-code " ݉!!! !) b ?,` W` ` ^)   lP!P ?b b #`Z GU\"~! #` GZb #\"Q b)P?#$ #`\"\"!b \"` ` ^)#!b # \"Q b)P!0!P #M\"Q bP!`  \"!@\"?yڈeA! ?@!<@A@#@G\\A!bB@#`\"C@#DE#A!FAA@AAA@@#)b