Suggests corrections to your misspelled functions. Can be quickloaded from Ultralisp as "autocorrect". fuzzy-match
is a dependency.
Call the following function in your ~/.swank.lisp
(for SLIME) or ~/.slynk.lisp
(for Sly) file. (You should also load this system beforehand: e.g. (ql:quickload "autocorrect")
)
SLIME:
(autocorrect:slime-install-autocorrect)
Sly:
(autocorrect:sly-install-autocorrect)
You will see a "Autocorrect hook installed!" among the other startup output in your inferior-lisp buffer.
It's not possible (to my knowledge) to install/remove this hook without restarting SLIME/Sly.
It's enough to set the *debugger-hook*
for the autocorrect to take effect. You can also add this to your .sbclrc
(or equivalent) file to have it load on startup.
(setf *debugger-hook* #'autocorrect:autocorrecting-debugger)
Once the hook is in place, when you type in a misspelled function call you should see an autocorrect suggestion like this:
(FIST '(1 2))
=>
The function COMMON-LISP-USER::FIST is undefined.
[Condition of type UNDEFINED-FUNCTION]
Restarts:
0: [AUTOCORRECT] Replace the function with FIRST.
1: [CONTINUE] Retry calling FIST.
2: [USE-VALUE] Call specified function.
3: [RETURN-VALUE] Return specified values.
4: [RETURN-NOTHING] Return zero values.
...
Pressing 0 here will replace fist
with first
, returning 1 as the result.
See the *correction-mode*
variable.
- Maybe provide multiple autocorrect suggestions?