Created
July 22, 2014 03:02
-
-
Save Johniel/46c4507695be7c6b6a3a to your computer and use it in GitHub Desktop.
タイポしすぎぃ!
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
;; 怒りのタイポ修正 | |
;; http://d.hatena.ne.jp/kitokitoki/20091124/p2 | |
(defun delete-word (arg) | |
"Delete characters forward until encountering the end of a word. | |
With argument ARG, do this that many times." | |
(interactive "p") | |
(delete-region (point) (progn (forward-word arg) (point)))) | |
;; http://d.hatena.ne.jp/kitokitoki/20091124/p2 | |
(defun backward-delete-word (arg) | |
"Delete characters backward until encountering the beginning of a word. | |
With argument ARG, do this that many times." | |
(interactive "p") | |
(delete-word (- arg))) | |
(defvar fix-word-map '(("cotu" . "cout") | |
("ocut" . "cout") | |
("dobule" . "double") | |
("doubel" . "double") | |
("doule" . "double"))) | |
(defun fix-typo () | |
(interactive) | |
(let* ((w (assoc (current-word) fix-word-map))) | |
(if w | |
(progn (call-interactively 'backward-delete-word 1) | |
(insert (cdr w))))) | |
(insert " ")) | |
(global-set-key (kbd "SPC") 'fix-typo) | |
(provide 'typo-fix) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment