Created
August 28, 2014 21:26
-
-
Save slackorama/1d93e8c4d9194979bcd2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun endless/ispell-word-then-abbrev (p) | |
"Call `ispell-word'. Then create an abbrev for the correction made. | |
With prefix P, create local abbrev. Otherwise it will be global." | |
(interactive "P") | |
(let ((bef (downcase (or (car (ispell-get-word nil)) ""))) aft) | |
(call-interactively 'ispell-word) | |
(setq aft (downcase (or (thing-at-point 'word) ""))) | |
(unless (or (string= aft bef) (string= bef "")) | |
(message "\"%s\" now expands to \"%s\" %sally" | |
bef aft (if p "loc" "glob")) | |
(define-abbrev | |
(if p local-abbrev-table global-abbrev-table) | |
bef aft)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment