summaryrefslogblamecommitdiff
path: root/emacs/custom/my-text.el
blob: 0c99ba6f9eb139ac205abda97d071f16d582617e (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                                                              
               
 
         
 



                                                                        
                                         

                                             

                                               
 

                                                            
                                                                
                                
                                                                          
 


                                                                      

                              



                                           

                                                     
                               
 
                  
 
                        
;;; my-text.el --- configures modes related to text -*- lexical-binding: t -*-

;;; Commentary:

;;; Code:

(customize-set-variable 'ispell-program-name (executable-find "aspell"))
(customize-set-variable 'ispell-dictionary "en_US")
(customize-set-variable 'ispell-extra-args '("--camel-case"))

(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))

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

(customize-set-variable 'markdown-fontify-code-block-natively t)
(when (executable-find "pandoc")
  (customize-set-variable 'markdown-command "pandoc -f markdown -t html"))

;; https://www.masteringemacs.org/article/text-expansion-hippie-expand
;; replace default keybinding for `dabbrev' with `hippie-expand'
(global-set-key (kbd "M-/") 'hippie-expand)

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

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

(provide 'my-text)

;;; my-text.el ends here