I am trying out flymake instead of flycheck (mostly because flycheck had some problem with eglot and switching to flymake) fixed it.
The two things I am missing are
The modeline indicator but that is a small thing and I think I should be able to recreate it.
Sensible errors in my private doom config. When I enable flycheck errors I get inundated by errors which are relevant in an elisp package but not my private config. Those coming from checkdoc I can disable by removing
flymake-diagnostic-functions but how do I disable those warning about function not known to be defined etc? I try looking at the
flycheck module but there doesn’t seem to be anything there that would take care of this.
To give a partial answer to my own question, I have this in my config now:
(defun my-elisp-flymake-hook ()
(when (doom-real-buffer-p (current-buffer))
(when (seq-find (lambda (dir) (file-in-directory-p (buffer-file-name) dir))
'("~/.config" "~/.doom.d" "~/.emacs.d/lisp" "~/.emacs.d/modules"))
(setq flymake-diagnostic-functions '(my-elisp-config-flymake-byte-compile)))
(cl-callf append elisp-flymake-byte-compile-load-path load-path)
And the function
my-elisp-config-flymake-byte-compile is a modified version of
elisp-flymake-byte-compile which passes some extra args to the emacs process:
(defun my-elisp-config-flymake-byte-compile (report-fn &rest _args)
"A Flymake backend for elisp byte compilation.
Spawn an Emacs process that byte-compiles a file representing the
current buffer state and calls REPORT-FN when done."
(when (process-live-p elisp-flymake--byte-compile-process)
(let ((temp-file (make-temp-file "elisp-flymake-byte-compile"))
(write-region (point-min) (point-max) temp-file nil 'nomessage))
(let* ((output-buffer (generate-new-buffer " *elisp-flymake-byte-compile*")))
:command `(,(expand-file-name invocation-name invocation-directory)
"--eval" "(setq byte-compile-warnings '(not unresolved docstrings))"
;; "--eval" "(setq load-prefer-newer t)" ; for testing
,@(mapcan (lambda (path) (list "-L" path))
(lambda (proc _event)
(unless (process-live-p proc)
((not (and (buffer-live-p source-buffer)
(eq proc (with-current-buffer source-buffer
"byte-compile process %s obsolete" proc))
((zerop (process-exit-status proc))
(format "byte-compile process %s died" proc))))
(ignore-errors (delete-file temp-file))
:stderr " *stderr of elisp-flymake-byte-compile*"
The extra args silence the byte compiler warnings about free variables and functions not known to be defined (since they are mostly false positives for the config) and docstring problems. They are also used to load the
doom.el so that the core doom stuff is defined and byte-compiler can warn about wrong calling conventions etc.
It would be better to be able to load enabled modules as well but I haven’t figured out that part yet.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.