Move :tools fly{check,spell} to :checkers {syntax,spell}
These modules were renamed so we can later generalize their implementations, such as adding flymake support to the syntax checker.
This commit is contained in:
parent
a680a4c96d
commit
b89992624b
12 changed files with 83 additions and 72 deletions
|
@ -24,7 +24,9 @@
|
|||
(debugger (:tools debugger)))
|
||||
(:tools (rotate-text (:editor rotate-text))
|
||||
(vterm (:term vterm))
|
||||
(password-store (:tools pass)))
|
||||
(password-store (:tools pass))
|
||||
(flycheck (:checker syntax))
|
||||
(flyspell (:checker spell)))
|
||||
(:emacs (electric-indent (:emacs electric))
|
||||
(hideshow (:editor fold))
|
||||
(eshell (:term eshell))
|
||||
|
|
|
@ -107,8 +107,13 @@ loaded last, before =:config= modules.
|
|||
+ [[file:../modules/app/irc/README.org][irc]] - how neckbeards socialize
|
||||
+ rss =+org= - an RSS client in Emacs
|
||||
+ [[file:../modules/app/twitter/README.org][twitter]] - A twitter client for Emacs
|
||||
+ [[file:../modules/app/write/README.org][write]] =+wordnut +langtool= - Transforms emacs into an IDE for writers, and for
|
||||
writing fiction, notes, papers and so on.
|
||||
|
||||
** :checkers
|
||||
Modules dedicated to linting or checking your code or writing for issues.
|
||||
|
||||
+ syntax =+childframe= - Live error/warning highlights
|
||||
+ spell =+everywhere= - Spell checking
|
||||
+ grammar - TODO
|
||||
|
||||
** :completion
|
||||
Modules that provide new interfaces or frameworks for completion, including code
|
||||
|
@ -234,8 +239,6 @@ Small modules that give Emacs access to external tools & services.
|
|||
+ [[file:../modules/tools/editorconfig/README.org][editorconfig]] - TODO
|
||||
+ [[file:../modules/tools/ein/README.org][ein]] - TODO
|
||||
+ [[file:../modules/tools/eval/README.org][eval]] =+overlay= - REPL & code evaluation support for a variety of languages
|
||||
+ flycheck - Live error/warning highlights
|
||||
+ flyspell =+everywhere= - Spell checking
|
||||
+ gist - TODO
|
||||
+ [[file:../modules/tools/lookup/README.org][lookup]] =+dictionary +docsets= - Universal jump-to & documentation lookup
|
||||
backend
|
||||
|
|
|
@ -77,7 +77,9 @@
|
|||
;;vterm ; another terminals in Emacs
|
||||
|
||||
:checkers
|
||||
;;grammar
|
||||
syntax ; tasing you for every semicolon you forget
|
||||
;;spell ; tasing you for misspelling mispelling
|
||||
;;grammar ; tasing grammar mistake every you make
|
||||
|
||||
:tools
|
||||
;;ansible
|
||||
|
@ -87,8 +89,6 @@
|
|||
;;editorconfig ; let someone else argue about tabs vs spaces
|
||||
;;ein ; tame Jupyter notebooks with emacs
|
||||
(eval +overlay) ; run code, run (also, repls)
|
||||
flycheck ; tasing you for every semicolon you forget
|
||||
;;flyspell ; tasing you for misspelling mispelling
|
||||
;;gist ; interacting with github gists
|
||||
(lookup ; helps you navigate your code and documentation
|
||||
+docsets) ; ...or in Dash docsets locally
|
||||
|
|
27
modules/checkers/spell/autoload.el
Normal file
27
modules/checkers/spell/autoload.el
Normal file
|
@ -0,0 +1,27 @@
|
|||
;;; checkers/spell/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autodef
|
||||
(defalias 'flyspell-mode! #'flyspell-mode)
|
||||
|
||||
(defvar +spell--flyspell-predicate-alist nil
|
||||
"TODO")
|
||||
|
||||
;;;###autodef
|
||||
(defun set-flyspell-predicate! (modes predicate)
|
||||
"TODO"
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes) +spell--flyspell-predicate-alist)
|
||||
(add-to-list '+spell--flyspell-predicate-alist (cons mode predicate))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +spell-init-flyspell-predicate-h ()
|
||||
"TODO"
|
||||
(when-let (pred (assq major-mode +spell--flyspell-predicate-alist))
|
||||
(setq-local flyspell-generic-check-word-predicate (cdr pred))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +spell-correction-at-point-p (&optional point)
|
||||
"TODO"
|
||||
(cl-loop for ov in (overlays-at (or point (point)))
|
||||
if (overlay-get ov 'flyspell-overlay)
|
||||
return t))
|
|
@ -1,7 +1,4 @@
|
|||
;;; tools/flyspell/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
;;; checkers/spell/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar ispell-dictionary "en_US")
|
||||
|
||||
|
@ -28,10 +25,10 @@
|
|||
ispell-extra-args '("--sug-mode=ultra" "--run-together"))
|
||||
|
||||
(add-hook! 'text-mode-hook
|
||||
(defun +flyspell-remove-run-together-switch-for-aspell-h ()
|
||||
(defun +spell-remove-run-together-switch-for-aspell-h ()
|
||||
(setq-local ispell-extra-args (remove "--run-together" ispell-extra-args))))
|
||||
|
||||
(defun +flyspell-setup-ispell-extra-args-a (orig-fun &rest args)
|
||||
(defun +spell-init-ispell-extra-args-a (orig-fun &rest args)
|
||||
:around '(ispell-word flyspell-auto-correct-word)
|
||||
(let ((ispell-extra-args (remove "--run-together" ispell-extra-args)))
|
||||
(ispell-kill-ispell t)
|
||||
|
@ -57,7 +54,7 @@
|
|||
#'flyspell-prog-mode))
|
||||
|
||||
(add-hook! 'flyspell-mode-hook
|
||||
(defun +flyspell-inhibit-duplicate-detection-maybe-h ()
|
||||
(defun +spell-inhibit-duplicate-detection-maybe-h ()
|
||||
"Don't mark duplicates when style/grammar linters are present.
|
||||
e.g. proselint and langtool."
|
||||
(when (or (and (bound-and-true-p flycheck-mode)
|
||||
|
@ -67,7 +64,7 @@ e.g. proselint and langtool."
|
|||
|
||||
;; Ensure mode-local predicates declared with `set-flyspell-predicate!' are
|
||||
;; used in their respective major modes.
|
||||
(add-hook 'flyspell-mode-hook #'+flyspell-init-predicate-h)
|
||||
(add-hook 'flyspell-mode-hook #'+spell-init-flyspell-predicate-h)
|
||||
|
||||
(map! :map flyspell-mouse-map
|
||||
"RET" #'flyspell-correct-at-point
|
|
@ -1,5 +1,5 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/flyspell/packages.el
|
||||
;;; checkers/spell/packages.el
|
||||
|
||||
(package! flyspell-correct)
|
||||
(cond ((featurep! :completion ivy)
|
25
modules/checkers/syntax/autoload.el
Normal file
25
modules/checkers/syntax/autoload.el
Normal file
|
@ -0,0 +1,25 @@
|
|||
;;; checkers/syntax/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autodef
|
||||
(defun set-next-checker! (mode checker next &optional append)
|
||||
"TODO"
|
||||
(let ((fn (intern (format "+syntax--init-checkers-for-%s-h" mode))))
|
||||
(fset fn
|
||||
(lambda ()
|
||||
(if (not (bound-and-true-p flycheck-mode))
|
||||
(add-hook 'flycheck-mode-hook fn 'append 'local)
|
||||
(flycheck-add-next-checker checker next append)
|
||||
(remove-hook 'flycheck-mode-hook fn 'local))))
|
||||
(add-hook (intern (format "%s-hook" mode)) fn)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +syntax-init-popups-h ()
|
||||
"Activate `flycheck-posframe-mode' if available and in GUI Emacs.
|
||||
Activate `flycheck-popup-tip-mode' otherwise.
|
||||
Do nothing if `lsp-ui-mode' is active and `lsp-ui-sideline-enable' is non-nil."
|
||||
(unless (and (bound-and-true-p lsp-ui-mode)
|
||||
lsp-ui-sideline-enable)
|
||||
(if (and (fboundp 'flycheck-posframe-mode)
|
||||
(display-graphic-p))
|
||||
(flycheck-posframe-mode +1)
|
||||
(flycheck-popup-tip-mode +1))))
|
|
@ -1,12 +1,7 @@
|
|||
;;; tools/flycheck/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +flycheck-lazy-idle-delay 3.0
|
||||
"The delay before flycheck checks the buffer, after a check that produces no
|
||||
errors.")
|
||||
|
||||
;;; checkers/syntax/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
;;; Flycheck
|
||||
|
||||
(use-package! flycheck
|
||||
:commands flycheck-list-errors flycheck-buffer
|
||||
|
@ -27,7 +22,7 @@ errors.")
|
|||
(set-popup-rule! "^\\*Flycheck error messages\\*" :select nil)
|
||||
|
||||
(add-hook! 'doom-escape-hook :append
|
||||
(defun +flycheck-buffer-h ()
|
||||
(defun +syntax-check-buffer-h ()
|
||||
"Flycheck buffer on ESC in normal mode."
|
||||
(when flycheck-mode
|
||||
(ignore-errors (flycheck-buffer))
|
||||
|
@ -46,7 +41,7 @@ errors.")
|
|||
|
||||
(use-package! flycheck-popup-tip
|
||||
:commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup
|
||||
:init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
|
||||
:init (add-hook 'flycheck-mode-hook #'+syntax-init-popups-h)
|
||||
:config
|
||||
(setq flycheck-popup-tip-error-prefix "✕ ")
|
||||
(after! evil
|
||||
|
@ -54,7 +49,7 @@ errors.")
|
|||
;; the cursor's position or cause disruptive input delays.
|
||||
(add-hook! '(evil-insert-state-entry-hook evil-replace-state-entry-hook)
|
||||
#'flycheck-popup-tip-delete-popup)
|
||||
(defadvice! +flycheck--disable-popup-tip-maybe-a (&rest _)
|
||||
(defadvice! +syntax--disable-flycheck-popup-tip-maybe-a (&rest _)
|
||||
:before-while #'flycheck-popup-tip-show-popup
|
||||
(if evil-local-mode
|
||||
(eq evil-state 'normal)
|
||||
|
@ -78,3 +73,7 @@ errors.")
|
|||
(add-hook! 'flycheck-posframe-inhibit-functions
|
||||
#'evil-insert-state-p
|
||||
#'evil-replace-state-p)))
|
||||
|
||||
|
||||
;;
|
||||
;;; TODO Flymake
|
|
@ -1,7 +1,9 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; tools/flycheck/packages.el
|
||||
;;; checkers/syntax/packages.el
|
||||
|
||||
(package! flycheck)
|
||||
(package! flycheck-popup-tip)
|
||||
(when (featurep! +childframe)
|
||||
(package! flycheck-posframe))
|
||||
|
||||
;; TODO flymake?
|
|
@ -1,13 +0,0 @@
|
|||
;;; tools/flycheck/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +flycheck-init-popups-h ()
|
||||
"Activate `flycheck-posframe-mode' if available and in GUI Emacs.
|
||||
Activate `flycheck-popup-tip-mode' otherwise.
|
||||
Do nothing if `lsp-ui-mode' is active and `lsp-ui-sideline-enable' is non-nil."
|
||||
(unless (and (bound-and-true-p lsp-ui-mode)
|
||||
lsp-ui-sideline-enable)
|
||||
(if (and (fboundp 'flycheck-posframe-mode)
|
||||
(display-graphic-p))
|
||||
(flycheck-posframe-mode +1)
|
||||
(flycheck-popup-tip-mode +1))))
|
|
@ -1,27 +0,0 @@
|
|||
;;; tools/flyspell/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autodef
|
||||
(defalias 'flyspell-mode! #'flyspell-mode)
|
||||
|
||||
(defvar +flyspell--predicate-alist nil
|
||||
"TODO")
|
||||
|
||||
;;;###autodef
|
||||
(defun set-flyspell-predicate! (modes predicate)
|
||||
"TODO"
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes) +flyspell--predicate-alist)
|
||||
(add-to-list '+flyspell--predicate-alist (cons mode predicate))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +flyspell-init-predicate-h ()
|
||||
"TODO"
|
||||
(when-let (pred (assq major-mode +flyspell--predicate-alist))
|
||||
(setq-local flyspell-generic-check-word-predicate (cdr pred))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +flyspell-correction-at-point-p (&optional point)
|
||||
"TODO"
|
||||
(cl-loop for ov in (overlays-at (or point (point)))
|
||||
if (overlay-get ov 'flyspell-overlay)
|
||||
return t))
|
|
@ -1,4 +0,0 @@
|
|||
|
||||
(unless (or (executable-find "aspell")
|
||||
(executable-find "hunspell"))
|
||||
(warn! "Could not find aspell or hunspell. Flyspell will fall back to ispell, which may not work."))
|
Loading…
Add table
Add a link
Reference in a new issue