2020-01-09 18:41:48 -05:00
|
|
|
;;; checkers/syntax/config.el -*- lexical-binding: t; -*-
|
2019-02-22 00:20:29 -05:00
|
|
|
|
|
|
|
;;
|
2020-01-09 18:41:48 -05:00
|
|
|
;;; Flycheck
|
2017-02-13 05:51:36 -05:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! flycheck
|
2022-08-10 23:38:16 +01:00
|
|
|
:unless (modulep! +flymake)
|
2019-07-22 23:31:52 +02:00
|
|
|
:commands flycheck-list-errors flycheck-buffer
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:hook (doom-first-buffer . global-flycheck-mode)
|
2017-02-13 05:51:36 -05:00
|
|
|
:config
|
2019-10-19 17:01:10 -04:00
|
|
|
(setq flycheck-emacs-lisp-load-path 'inherit)
|
|
|
|
|
2020-12-12 15:14:00 -05:00
|
|
|
;; Rerunning checks on every newline is a mote excessive.
|
|
|
|
(delq 'new-line flycheck-check-syntax-automatically)
|
|
|
|
;; And don't recheck on idle as often
|
|
|
|
(setq flycheck-idle-change-delay 1.0)
|
2020-04-17 14:56:02 -04:00
|
|
|
|
|
|
|
;; For the above functionality, check syntax in a buffer that you switched to
|
|
|
|
;; only briefly. This allows "refreshing" the syntax check state for several
|
|
|
|
;; buffers quickly after e.g. changing a config file.
|
|
|
|
(setq flycheck-buffer-switch-check-intermediate-buffers t)
|
2019-07-22 23:31:52 +02:00
|
|
|
|
2019-10-20 19:57:46 -04:00
|
|
|
;; Display errors a little quicker (default is 0.9s)
|
|
|
|
(setq flycheck-display-errors-delay 0.25)
|
|
|
|
|
2019-10-25 01:26:56 -04:00
|
|
|
;; Don't commandeer input focus if the error message pops up (happens when
|
|
|
|
;; tooltips and childframes are disabled).
|
2020-12-12 13:12:34 -05:00
|
|
|
(set-popup-rules!
|
|
|
|
'(("^\\*Flycheck error messages\\*" :select nil)
|
|
|
|
("^\\*Flycheck errors\\*" :size 0.25)))
|
2019-10-25 01:26:56 -04:00
|
|
|
|
2019-08-19 12:29:11 -04:00
|
|
|
(add-hook! 'doom-escape-hook :append
|
2020-01-09 18:41:48 -05:00
|
|
|
(defun +syntax-check-buffer-h ()
|
2019-07-22 23:31:52 +02:00
|
|
|
"Flycheck buffer on ESC in normal mode."
|
|
|
|
(when flycheck-mode
|
|
|
|
(ignore-errors (flycheck-buffer))
|
2019-08-19 12:29:11 -04:00
|
|
|
nil)))
|
2019-07-22 23:31:52 +02:00
|
|
|
|
2019-10-26 21:34:44 -04:00
|
|
|
(map! :map flycheck-error-list-mode-map
|
|
|
|
:n "C-n" #'flycheck-error-list-next-error
|
|
|
|
:n "C-p" #'flycheck-error-list-previous-error
|
|
|
|
:n "j" #'flycheck-error-list-next-error
|
|
|
|
:n "k" #'flycheck-error-list-previous-error
|
|
|
|
:n "RET" #'flycheck-error-list-goto-error
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
:n [return] #'flycheck-error-list-goto-error))
|
2017-02-13 05:51:36 -05:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! flycheck-popup-tip
|
2022-08-10 23:38:16 +01:00
|
|
|
:unless (modulep! +flymake)
|
2019-07-22 23:31:52 +02:00
|
|
|
:commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup
|
2020-03-27 01:25:30 -04:00
|
|
|
:hook (flycheck-mode . +syntax-init-popups-h)
|
2019-04-01 20:30:31 -04:00
|
|
|
:config
|
2020-08-26 21:49:22 +05:30
|
|
|
(setq flycheck-popup-tip-error-prefix "X ")
|
2024-04-07 16:41:37 -04:00
|
|
|
|
|
|
|
;; HACK: Only display the flycheck popup if we're in normal mode (for evil
|
|
|
|
;; users) or if no selection or completion is active. This popup can
|
|
|
|
;; interfere with the active evil mode, clear active regions, and other
|
|
|
|
;; funny business (see #7242).
|
|
|
|
(defadvice! +syntax--disable-flycheck-popup-tip-maybe-a (&rest _)
|
|
|
|
:before-while #'flycheck-popup-tip-show-popup
|
|
|
|
(if (and (bound-and-true-p evil-local-mode)
|
|
|
|
(not (evil-emacs-state-p)))
|
|
|
|
(evil-normal-state-p)
|
|
|
|
(and (not (region-active-p))
|
|
|
|
(not (bound-and-true-p company-backend))
|
|
|
|
(not (ignore-errors (>= corfu--index 0)))))))
|
2018-05-07 18:50:44 +02:00
|
|
|
|
2018-01-05 14:43:44 -05:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! flycheck-posframe
|
2022-08-12 20:29:19 +02:00
|
|
|
:when (modulep! +childframe)
|
2022-08-10 23:38:16 +01:00
|
|
|
:unless (modulep! +flymake)
|
2020-03-27 01:25:30 -04:00
|
|
|
:hook (flycheck-mode . +syntax-init-popups-h)
|
2018-05-09 11:26:06 +02:00
|
|
|
:config
|
2020-08-26 14:08:08 +05:30
|
|
|
(setq flycheck-posframe-warning-prefix "! "
|
2018-05-09 11:26:06 +02:00
|
|
|
flycheck-posframe-info-prefix "··· "
|
2020-08-26 21:49:22 +05:30
|
|
|
flycheck-posframe-error-prefix "X ")
|
2019-10-19 17:01:31 -04:00
|
|
|
(after! company
|
|
|
|
;; Don't display popups if company is open
|
|
|
|
(add-hook 'flycheck-posframe-inhibit-functions #'company--active-p))
|
2019-10-05 12:47:31 -04:00
|
|
|
(after! evil
|
|
|
|
;; Don't display popups while in insert or replace mode, as it can affect
|
|
|
|
;; the cursor's position or cause disruptive input delays.
|
|
|
|
(add-hook! 'flycheck-posframe-inhibit-functions
|
|
|
|
#'evil-insert-state-p
|
|
|
|
#'evil-replace-state-p)))
|
2020-01-09 18:41:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
2022-08-10 23:38:16 +01:00
|
|
|
;;; Flymake
|
2023-07-31 17:36:50 +05:30
|
|
|
(use-package! flymake
|
2022-08-10 23:38:16 +01:00
|
|
|
:when (modulep! +flymake)
|
|
|
|
:defer t
|
|
|
|
:init
|
2022-08-17 01:27:52 +01:00
|
|
|
;; as flymakes fail silently there is no need to activate it on a per major mode basis
|
2022-08-10 23:38:16 +01:00
|
|
|
(add-hook! (prog-mode text-mode) #'flymake-mode)
|
|
|
|
:config
|
|
|
|
(setq flymake-fringe-indicator-position 'right-fringe))
|
|
|
|
|
|
|
|
|
2023-07-31 17:36:50 +05:30
|
|
|
(use-package! flymake-popon
|
2022-08-10 23:38:16 +01:00
|
|
|
:when (modulep! +flymake)
|
|
|
|
:hook (flymake-mode . flymake-popon-mode)
|
|
|
|
:config
|
|
|
|
(setq flymake-popon-method (if (modulep! +childframe)
|
2023-08-01 11:58:46 +05:30
|
|
|
'posframe
|
2022-08-10 23:38:16 +01:00
|
|
|
'popon)))
|