diff options
author | Amin Bandali <bandali@gnu.org> | 2018-10-29 20:51:49 -0400 |
---|---|---|
committer | Amin Bandali <bandali@gnu.org> | 2018-10-29 20:51:49 -0400 |
commit | 46467dc3be8cb1d218abb936c1eb21ad7313f7f3 (patch) | |
tree | d13443d54a2e58b6b24049fc91acad8cbd0bb386 | |
parent | 9455bb8ff3e6025156275ea64f59d6da4633830b (diff) | |
download | configs-46467dc3be8cb1d218abb936c1eb21ad7313f7f3.tar.gz configs-46467dc3be8cb1d218abb936c1eb21ad7313f7f3.tar.xz configs-46467dc3be8cb1d218abb936c1eb21ad7313f7f3.zip |
[emacs] assimilate and use typo.el, along with ispell workaround
typo.el: a nicer alternative to electric-quote-mode which allows
cycling between the quotes
also add an ispell workaround for correctly checking spelling of words
with ’ apostrophe in them
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | init.org | 35 | ||||
m--------- | lib/typo | 0 |
3 files changed, 38 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index c7b0e27..1a256b3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -240,6 +240,9 @@ [submodule "treepy"] path = lib/treepy url = git@github.com:volrath/treepy.el.git +[submodule "typo"] + path = lib/typo + url = git@github.com:jorgenschaefer/typoel.git [submodule "undo-tree"] path = lib/undo-tree url = git@github.com:emacsorphanage/undo-tree.git @@ -1082,6 +1082,31 @@ TODO: break this giant source block down into individual org sections. ;; Only flycheck when I actually save the buffer (setq flycheck-check-syntax-automatically '(mode-enabled save))) + +;; http://endlessparentheses.com/ispell-and-apostrophes.html +(use-package ispell + :config + ;; ’ can be part of a word + (setq ispell-local-dictionary-alist + `((nil "[[:alpha:]]" "[^[:alpha:]]" + "['\x2019]" nil ("-B") nil utf-8))) + ;; don't send ’ to the subprocess + (defun endless/replace-apostrophe (args) + (cons (replace-regexp-in-string + "’" "'" (car args)) + (cdr args))) + (advice-add #'ispell-send-string :filter-args + #'endless/replace-apostrophe) + + ;; convert ' back to ’ from the subprocess + (defun endless/replace-quote (args) + (if (not (derived-mode-p 'org-mode)) + args + (cons (replace-regexp-in-string + "'" "’" (car args)) + (cdr args)))) + (advice-add #'ispell-parse-output :filter-args + #'endless/replace-quote)) #+end_src * Programming modes @@ -1525,6 +1550,15 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. (use-package anzu) #+end_src +** typo.el + +#+begin_src emacs-lisp +(use-package typo + :config + (typo-global-mode 1) + :hook (text-mode . typo-mode)) +#+end_src + * Email #+begin_src emacs-lisp @@ -1554,6 +1588,7 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. message-sendmail-envelope-from 'header ;; message-directory "drafts" message-user-fqdn "aminb.org") + ;; (add-hook 'message-mode-hook 'electric-quote-local-mode) (add-hook 'message-mode-hook (lambda () (setq fill-column 65 message-fill-column 65))) diff --git a/lib/typo b/lib/typo new file mode 160000 +Subproject 9dad93b6f367f02f52c8d9bf15d446d922cec29 |