[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Auto Spell Mode
David,
Your auto-spell mode works fine, but I had to put it on *command-Hook*
instead of *post-command-hook* first. Also, I modified it to *not* check
the spelling when in the minibuffer (when typing extended commands).
In order to make auto-spell mode work for lisp comments only in lisp
buffers, I've extended it as follows:
1;;;-----------------
;;; start of patches
0(defminor 2com-auto-spell-mode0 auto-spell-mode 1"Spell"0 3
1"Minor mode in which insertion spells text.
In lisp major mode, it will activate only inside comments.
A positive argument turns the mode on, zero turns it off;
no argument toggles."0 ()
(progn 1; this lacks an UNDO!
0 (prepare-for-spell-command))
1;; By analogy with wordab:
0 (set-comtab *standard-control-x-comtab* '(#\control-+ com-add-spelling))
(command-hook (selectq (send *major-mode* :major-mode-keyword)
(:lisp 'auto-spell-lisp-comments-hook)
(t 'auto-spell-hook))
*command-hook*))
1;;; Make sure those get run AFTER the abbreviation hook, if any:
0(eval-when (load eval)
(let ((hook-priority (1+ (cl:get 'expand-abbrev-hook 'command-hook-priority))))
(setf (cl:get 'auto-spell-hook 'command-hook-priority) hook-priority)
(setf (cl:get 'auto-spell-lisp-comments-hook 'command-hook-priority) hook-priority)))
(defun 2auto-spell-lisp-comments-hook0 (char)
(when (and (multiple-value-bind (ignore ignore comment)
(shift-lock-hook-cached-syntactic-context)
comment)
(neq *last-command-type* 'yank)) 1;that's for Kanef
0 (auto-spell-hook char)))
1;;; end of patches
;;;-----------------
0And here's another goodie:
1;;; this version of AUTO-SPELL-HOOK makes it easy to create a file full
;;; of words which are 0*1not0*1 in any (loaded) dictionary
0(defun 2auto-spell-hook0 (ignore)
(when (and (neq *interval* (window-interval *mini-buffer-window*)) 1;--jc
0 (expand-p *last-command-char*)
(not *numeric-arg-p*)
(= (word-syntax (bp-char-before (point))) word-alphabetic))
1;; IWBNI symbolics abstracted M-$ so we could use or alter its word-finder!
0 (let ((word (bound-word (point))))
(when (and word
(word-in-dictionaries-p word))
(kill-command-internal #'forward-word -1)
(must-redisplay *window* dis-line (bp-line (point)) 0)))))
Someone might find it useful to create their own dictionaries; it allows
to create a file of words which are *not* in any of the loaded
dictionaries. I used this to collect SYS:SPELL;HACKERS.DICT (just for
fun). These words aren't in either BASIC.DICT nor in BSD42.DICT (which
I created from /usr/dict/words on our VAX):
AUTOBOGOTIPHOBIA AUTOMAGICALLY BAGBITER BAGBITING BANG BAR BARF
BARFUCIOUS BARFULOUS BAZ BIGNUM BITBLT BLETCH BLETCHEROUS BOGOMETER
BOGON BOGOSITY BOGOTIFY BROKET BUCKY BUCKY COKEBOTTLE COMPUTRON COMTAB
CONS CRLF CRUFT CRUFTY CTY CUSPY DBP DDT DWIM EXCH EXCL FEATURISM FEEP
FIXNUM FLAKEY FLAMAGE FLONUM FOO FOOBAR FROB FROBNICATE FROBNITZ
FROBNITZEM FROGGY FROTZ FTP GARPLY GC GEDANKEN GLORK GLORK GORP
GOSPERISM GRITCH GROK GRONK GRONKED GRUNGY GUBBISH GWEEP GWEEPS
HACKISHNESS HACKITUDE HAKMEM HANDWAVE HARDWARILY HIRSUTE INTERCAL IRP
JEDGAR JFCL JRST KLUDGE KLUDGEY KLUGE LISPM LOSSAGE LPT LUSER MACROTAPE
MEM REF MICROTAPE MISFEATURE MOBY MUMBLAGE NXM PDL PESSIMIZE PESSIMIZING
PHROG PPN PSEUDOPRIME QUES QUUX QUUXY RAV RPG SEXPR SMOP SNARF
SOFTWARILY SOS SPAZZ SQIGGLE SQUIGGLE SUPERPROGRAMMER SYMBOLICS TECO
TENURED TERPRI TWENEX VAXEN XOR XYZZY YOYO YU SHIANG ZMACS ZORCH ZWEI
EINE