blob: 797b0d09cd8b5146b2508001d0e085fe79968362 (
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
;; Time-stamp: <2023-01-13 12h54 CET (anker)>
;; -----------------------------------------------------------------------------
;; 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)))
;; (defun flyspell-correct-selectrum (candidates word)
;; (let* ((save "[SAVE]")
;; (accept-session "[ACCEPT (session)]")
;; (accept-buffer "[ACCEPT (buffer)]")
;; (skip "[SKIP]")
;; (selectrucm-should-sort nil)
;; (result (selectrum-completing-read
;; (format "Correcting '%s': " word)
;; (append candidates
;; (list save accept-session accept-buffer skip)))))
;; (cond
;; ((string= result save)
;; (cons 'save word))
;; ((string= result accept-session)
;; (cons 'session word))
;; ((string= result accept-buffer)
;; (cons 'buffer word))
;; ((string= result skip)
;; (cons 'skip word))
;; (t
;; result))))
;; (use-package flyspell-correct
;; :ensure t
;; :defer t
;; :config
;; (setq flyspell-correct-interface #'flyspell-correct-selectrum))
;; (use-package flyspell
;; :ensure t
;; :bind (:map flyspell-mode-map
;; ("M-$" . flyspell-correct-wrapper)
;; ("C-," . nil)
;; ("C-." . nil)
;; ("C-\"" . nil))
;; :init
;; (setq ispell-dictionary "british"
;; flyspell-default-dictionary "british"))
(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)
;; (flyspell-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)
;; (flyspell-mode 1)
))
(use-package dictionary :ensure t :defer t)
;; -----------------------------------------------------------------------------
;; Markdown
(use-package markdown-mode
:ensure t
:defer t
: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 "org"
deft-directory "~/store/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)
;; (defvar deft-take-note-pre-grab
;; '((region-thing . (let ((r (if (region-active-p)
;; (buffer-substring (region-beginning) (region-end))
;; (thing-at-point 'line))))
;; (if r (concat r "\n") "")))
;; (bfn . (let ((f (buffer-file-name))
;; (b (buffer-name))) (if f f (concat b " (no file associated)")))))
;; "List of pairs of symbol names and (functions evaluating to)
;; strings evaluated before the buffer is created, and made
;; available for deft-take-note-default-contents.")
;; (defvar deft-take-note-post-grab '()
;; "List of pairs of symbol names and (functions evaluating to)
;; strings evaluated after the buffer is created, and made
;; available for deft-take-note-default-contents.")
;; (defvar deft-take-note-default-contents '(region-thing bfn "\n")
;; "List with string literals and symbols defined in the pre and
;; post grab lists to be inserted into the buffer.")
;; (defun deft-take-note ()
;; (interactive)
;; (let ((pre-alist (mapcar #'(lambda (elt) `(,(car elt) . ,(eval (cdr elt))))
;; deft-take-note-pre-grab)))
;; (let ((bn (concat (format-time-string "%Y%m%d-%H:%M:%S.%N-%Z") "."
;; deft-default-extension)))
;; (switch-to-buffer bn)
;; (set-visited-file-name (expand-file-name
;; (concat deft-directory "/" bn)))
;; (let ((complete-alist
;; (append pre-alist
;; (mapcar #'(lambda (elt) `(,(car elt) . ,(eval (cdr elt))))
;; deft-take-note-post-grab))))
;; (mapc #'(lambda (elt) (if (eq (type-of elt) 'string)
;; (insert elt)
;; (insert (cdr (assoc elt complete-alist)))))
;; deft-take-note-default-contents)))))
)
;; -----------------------------------------------------------------------------
;; 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)
|