summaryrefslogtreecommitdiff
path: root/emacs/inits/23-text-related.el
diff options
context:
space:
mode:
authortslil clingman <>2020-04-23 22:37:31 -0700
committertslil clingman <>2020-04-23 22:37:31 -0700
commit6ba333c21a29be757a5f7735ae8bcde153346e60 (patch)
tree4eb49e015decc4e9cd13f507465c2d6891280f6e /emacs/inits/23-text-related.el
parent24648353e3e2e63e4683aa7021deb87539d6d047 (diff)
cdm-mode tweaks, latex and spelling fixes, selectrum work-arounds
Diffstat (limited to 'emacs/inits/23-text-related.el')
-rw-r--r--emacs/inits/23-text-related.el130
1 files changed, 88 insertions, 42 deletions
diff --git a/emacs/inits/23-text-related.el b/emacs/inits/23-text-related.el
index 75eb869..7cfb4df 100644
--- a/emacs/inits/23-text-related.el
+++ b/emacs/inits/23-text-related.el
@@ -1,4 +1,4 @@
-;; Time-stamp: <2020-04-13 14:36:53 (tslil@bison)>
+;; Time-stamp: <2020-04-23 13:54:24 (tslil@bison)>
;; -----------------------------------------------------------------------------
;; Spelling
@@ -6,12 +6,56 @@
(use-package spell-fu
:ensure t
:config
- (setq ispell-dictionary "british"
+ (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:]]\\)*\\)"))
+ (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)
@@ -19,6 +63,7 @@
(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 ()
@@ -28,6 +73,7 @@
(turn-on-auto-fill)
(siege-mode 1)
(spell-fu-mode 1)
+ ;; (flyspell-mode 1)
))
(use-package dictionary :ensure t :defer t)
@@ -53,8 +99,7 @@
:ensure t
:defer t
:commands (deft)
- :bind (("C-z" . deft-take-note)
- ("C-c C-z" . deft))
+ :bind (("C-c C-z" . deft))
:config
(setq deft-default-extension "org"
deft-directory "~/store/notes"
@@ -65,43 +110,44 @@
(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))))))
+ ;; (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