summaryrefslogtreecommitdiff
path: root/emacs/inits/23-text-related.el
blob: 714298015575f6b899ff077ad5bd8f6ccd3d0df3 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
;; Time-stamp: <2024-05-26 11h27 CEST (00c25734)>

;; -----------------------------------------------------------------------------
;; Spelling

(use-package spell-fu
  :ensure t
  :config
  (setq ispell-dictionary "en_GB-ise-w_accents"
        ispell-personal-dictionary "~/.aspell.en.pws")

  ;; The default was this "\\b\\([[:alpha:]][[:alpha:]']*\\)\\b", but that
  ;; didn't play well with ``LaTeX's quoting system''.
  (setq-default spell-fu-word-regexp "\\([[:alpha:]]+\\('[[:alpha:]]+\\)*\\)"
                spell-fu-faces-exclude '(font-latex-math-face
                                         font-latex-sedate-face
                                         font-lock-keyword-face
                                         font-lock-function-name-face
                                         font-lock-variable-name-face)))
(setq sentence-end-double-space nil)

(add-hook 'mail-mode-hook (lambda ()
                            (electric-pair-local-mode 1)
                            (turn-on-auto-fill)
                            (spell-fu-mode 1)
                            (company-mode 1)))

(add-hook 'text-mode-hook (lambda ()
                            ;; (set-input-method "Adga")
                            (subword-mode 1)
                            (electric-pair-local-mode 1)
                            (turn-on-auto-fill)
                            (siege-mode 1)
                            (spell-fu-mode 1)))

(use-package dictionary :ensure t :defer t)

(use-package ereader :ensure t :defer
  :mode (("\\.epub$" . nov-mode)))

;; -----------------------------------------------------------------------------
;; Markdown

(use-package markdown-mode
  :ensure t
  :defer t
  :mode (("\\.md'" . markdown-mode))
  :hook (markdown-mode . (lambda ()
                           (auto-fill-mode -1)
                           (visual-line-mode))))


;; -----------------------------------------------------------------------------
;; Org

;; (use-package org
;;   :defer t
;;   :bind (:map org-mode-map
;;               ("M-h" . nil))
;;   ;; :hook (org-mode . (lambda ()
;;   ;;                     (activate-input-method default-input-method)))
;;   :config
;;   (setq org-use-sub-superscripts (quote {})
;;         org-modules nil))


;; -----------------------------------------------------------------------------
;; Deft

;; (use-package deft
;;   :ensure t
;;   :defer t
;;   :commands (deft)
;;   :bind (("C-c C-z" . deft))
;;   :config
;;   (setq deft-default-extension "md"
;;         deft-directory "~/notes"
;;         deft-use-filename-as-title nil
;;         deft-use-filter-string-for-filename t
;;         deft-file-naming-rules '((noslash . "_")
;;                                  (nospace . "_")
;;                                  (case-fn . downcase))
;;         deft-org-mode-title-prefix t)
;;   )

;; -----------------------------------------------------------------------------
;; Useful keybinds

(defun vi-open-line-above ()
  "Insert a newline above the current line and put point at beginning."
  (interactive)
  (unless (bolp)
    (beginning-of-line))
  (newline)
  (forward-line -1)
  (indent-according-to-mode))

(defun vi-open-line-below ()
  "Insert a newline below the current line and put point at beginning."
  (interactive)
  (unless (eolp)
    (end-of-line))
  (newline-and-indent))

(global-set-key (kbd "M-o") 'vi-open-line-below)
(global-set-key (kbd "C-o") 'vi-open-line-above)

(global-set-key (kbd "M-C-+") 'text-scale-increase)
(global-set-key (kbd "M-C--") 'text-scale-decrease)