Created
February 17, 2012 08:33
-
-
Save bamanzi/1851835 to your computer and use it in GitHub Desktop.
[emacs] auto-complete + ispell
This file contains 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 ac-ispell-get-word () | |
(format "\\(%s\\)" (car (ispell-get-word nil "\\*")))) | |
(defun ac-ispell-get-candidates (prefix) | |
(let ((word prefix) | |
(interior-frag nil)) | |
(lookup-words (concat (and interior-frag "*") word | |
(if (or interior-frag (null ispell-look-p)) | |
"*")) | |
ispell-complete-word-dict))) | |
(ac-define-source ispell | |
'((prefix . ac-prefix) | |
(candidates . ac-ispell-get-candidates))) | |
;; it's not a good idea to add `ac-source-ispell' to `ac-sources', | |
;; I'll recommend manual invoking. | |
;; newer version of `ac-define-source' would provide us an `ac-complete-ispell-word'. | |
;; in case it didn't: | |
(defun ac-expand-ispell-word () | |
(interactive) | |
(let ((ac-sources '(ac-source-ispell))) | |
(call-interactively 'ac-start))) | |
(define-key global-map (kbd "C-/ s") 'ac-expand-ispell-word) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment