diff --git a/modules/checkers/spell/autoload/+flyspell.el b/modules/checkers/spell/autoload/+flyspell.el index 74b2dd33d..90df3b9e7 100644 --- a/modules/checkers/spell/autoload/+flyspell.el +++ b/modules/checkers/spell/autoload/+flyspell.el @@ -26,3 +26,57 @@ (cl-loop for ov in (overlays-at (or point (point))) if (overlay-get ov 'flyspell-overlay) return t)) + +;;;###autoload +(defun +spell/add-word (word &optional scope) + "Add WORD to your personal dictionary, within SCOPE. + +SCOPE can be `buffer' or `session' to exclude words only from the current buffer +or session. Otherwise, the addition is permanent." + (interactive + (list (progn (require 'flyspell) + (flyspell-get-word)))) + (require 'flyspell) + (cond + ((null scope) + (ispell-send-string (concat "*" word "\n")) + (ispell-send-string "#\n") + (flyspell-unhighlight-at (point)) + (setq ispell-pdict-modified-p '(t))) + ((memq scope '(buffer session)) + (ispell-send-string (concat "@" word "\n")) + (add-to-list 'ispell-buffer-session-localwords word) + (or ispell-buffer-local-name ; session localwords might conflict + (setq ispell-buffer-local-name (buffer-name))) + (flyspell-unhighlight-at (point)) + (if (null ispell-pdict-modified-p) + (setq ispell-pdict-modified-p + (list ispell-pdict-modified-p))) + (if (eq replace 'buffer) + (ispell-add-per-file-word-list word)))) + (ispell-pdict-save t)) + +;;;###autoload +(defun +spell/remove-word (word &optional _scope) + "Remove WORD from your personal dictionary." + (interactive) + (user-error "Not supported yet with +flyspell")) + +;;;###autoload +(defun +spell/next-error () + "Jump to next flyspell error." + (interactive) + (call-interactively + (if (featurep 'evil) + #'evil-next-flyspell-error + #'flyspell-goto-next-error))) + +;;;###autoload +(defun +spell/previous-error () + "Jump to previous flyspell error." + (interactive) + (call-interactively + (if (featurep 'evil) + #'evil-prev-flyspell-error + ;; TODO Implement this + (user-error "Not supported")))) diff --git a/modules/checkers/spell/autoload/+spell-fu.el b/modules/checkers/spell/autoload/+spell-fu.el index 1049a8a28..f8d26a3e2 100644 --- a/modules/checkers/spell/autoload/+spell-fu.el +++ b/modules/checkers/spell/autoload/+spell-fu.el @@ -105,3 +105,8 @@ (unless (string-equal wrd word) (+spell--correct wrd poss word orig-pt start end)))))) (ispell-pdict-save t))))))) + +;;;###autoload (defalias '+spell/add-word #'spell-fu-word-add) +;;;###autoload (defalias '+spell/remove-word #'spell-fu-word-remove) +;;;###autoload (defalias '+spell/next-error #'spell-fu-goto-next-error) +;;;###autoload (defalias '+spell/previous-error #'spell-fu-goto-previous-error) diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index 2b6cb8b16..41b8af241 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -390,12 +390,11 @@ directives. By default, this only recognizes C directives.") ;; implement dictionary keybinds ;; evil already defines 'z=' to `ispell-word' = correct word at point - (:when (not (featurep! :checkers spell +flyspell)) - :n "zq" #'spell-fu-word-add - :n "zw" #'spell-fu-word-remove - :m "[s" #'spell-fu-goto-previous-error - :m "]s" #'spell-fu-goto-next-error - ) + (:when (featurep! :checkers spell) + :n "zq" #'+spell/add-word + :n "zw" #'+spell/remove-word + :m "[s" #'+spell/previous-error + :m "]s" #'+spell/next-error) ;; ported from vim-unimpaired :n "] SPC" #'+evil/insert-newline-below diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index 419ed86d9..825f04cac 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -247,8 +247,7 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e `((:ccls . ((:clang . ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1" "-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" "-isystem/usr/local/include"] - :resourceDir (string-trim (shell-command-to-string "clang -print-resource-dir")))))))))))) - + :resourceDir (cdr (doom-call-process "clang" "-print-resource-dir")))))))))))) (use-package! ccls @@ -266,4 +265,4 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e `(:clang ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1" "-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" "-isystem/usr/local/include"] - :resourceDir (string-trim (shell-command-to-string "clang -print-resource-dir"))))))) + :resourceDir (cdr (doom-call-process "clang" "-print-resource-dir")))))))