Skip to content

Commit

Permalink
Flyspell auto-complete support.
Browse files Browse the repository at this point in the history
  • Loading branch information
candera committed Dec 16, 2016
1 parent 4a111f3 commit a817dd6
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,6 @@ Accepts WIDTH as a numeric prefix, but defaults to 85."
(global-set-key (quote [C-up]) 'scroll-window-up-one)
(global-set-key (quote [C-down]) 'scroll-window-down-one)
(global-set-key (kbd "C-x C-b") 'ibuffer)
;;(global-set-key (kbd "C-;") 'flyspell-auto-correct-previous-word)

(defun flyspell-popup-correct-previous-word ()
(interactive)
;; This hack brought to you courtesy of
;; http://endlessparentheses.com/understanding-letf-and-how-it-replaces-flet.html
(cl-letf (((symbol-function 'flyspell-auto-correct-word) #'flyspell-popup-correct))
(flyspell-auto-correct-previous-word (point))))

(global-set-key (kbd "C-;") 'flyspell-popup-correct-previous-word)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-popup-correct-previous-word)


(global-set-key (quote [C-tab]) 'other-window)

Expand Down Expand Up @@ -1788,6 +1776,25 @@ remain indented by four spaces after refilling."
(put-clojure-indent (car pair)
(car (last pair))))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; flyspell
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'flyspell)

(defun flyspell-popup-correct-previous-word ()
(interactive)
;; This hack brought to you courtesy of
;; http://endlessparentheses.com/understanding-letf-and-how-it-replaces-flet.html
(cl-letf (((symbol-function 'flyspell-auto-correct-word) #'flyspell-popup-correct))
(flyspell-auto-correct-previous-word (point))))

(global-set-key (kbd "C-;") 'flyspell-popup-correct-previous-word)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-popup-correct-previous-word)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Miscellaneous customizations
Expand Down

0 comments on commit a817dd6

Please sign in to comment.