summary refs log tree commit diff
path: root/emacs/custom/my-text.el
blob: f6d984fdc48d3cdd6c85117b1ff9c4011807359b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
;;; my-text.el --- configures modes related to text -*- lexical-binding: t -*-

;;; Commentary:

;;; Code:

(require 'markdown-mode)
(require 'ispell)
(require 'abbrev)

;;; settings
(setq ispell-program-name (executable-find "aspell"))
(setq ispell-dictionary "en_US")
(setq ispell-extra-args '("--camel-case"))

(add-to-list 'auto-mode-alist
             '("\\.\\(md\\|markdown\\)$" . markdown-mode) auto-mode-alist)

;; use GitHub's markdown flavor for README files
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))

(when (executable-find "pandoc")
  (setq markdown-command "pandoc -f markdown -t html"))

(setq only-global-abbrevs nil)
(let ((table text-mode-abbrev-table))
  (define-abbrev table "github" "GitHub")
  (define-abbrev table "emacs" "Emacs"))

;;; bindings

;;; hooks
(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'text-mode-hook 'goto-address-mode)

(dolist (hook '(prog-mode-hook conf-mode-hook))
  (add-hook hook 'flyspell-prog-mode))

(dolist (hook '(text-mode-hook git-commit-mode-hook))
  (add-hook hook 'abbrev-mode))

(provide 'my-text)

;;; my-text.el ends here