feat(emacs-lisp): no doc warnings with flymake
This commit is contained in:
parent
e47accb773
commit
2e67ad18e9
2 changed files with 44 additions and 34 deletions
|
@ -290,39 +290,49 @@ Essentially, this means in any elisp file that either:
|
||||||
This generally applies to your private config (`doom-user-dir') or Doom's source
|
This generally applies to your private config (`doom-user-dir') or Doom's source
|
||||||
\(`doom-emacs-dir')."
|
\(`doom-emacs-dir')."
|
||||||
:since "3.0.0"
|
:since "3.0.0"
|
||||||
(unless (and (bound-and-true-p flycheck-mode)
|
(unless (and (or (bound-and-true-p flycheck-mode)
|
||||||
(not (+emacs-lisp--in-package-buffer-p)))
|
(bound-and-true-p flymake-mode))
|
||||||
|
(not (+emacs-lisp--in-package-buffer-p)))
|
||||||
(setq +emacs-lisp-non-package-mode nil))
|
(setq +emacs-lisp-non-package-mode nil))
|
||||||
(when (derived-mode-p 'emacs-lisp-mode)
|
(when (derived-mode-p 'emacs-lisp-mode)
|
||||||
(add-hook 'after-save-hook #'+emacs-lisp-non-package-mode nil t))
|
(add-hook 'after-save-hook #'+emacs-lisp-non-package-mode nil t))
|
||||||
(if (not +emacs-lisp-non-package-mode)
|
(if (not +emacs-lisp-non-package-mode)
|
||||||
(when (get 'flycheck-disabled-checkers 'initial-value)
|
(if (modulep! :checkers syntax +flymake)
|
||||||
(setq-local flycheck-disabled-checkers (get 'flycheck-disabled-checkers 'initial-value))
|
;; flymake
|
||||||
(kill-local-variable 'flycheck-emacs-lisp-check-form))
|
(progn
|
||||||
(with-memoization (get 'flycheck-disabled-checkers 'initial-value)
|
(add-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc nil t))
|
||||||
flycheck-disabled-checkers)
|
;; flycheck
|
||||||
(setq-local flycheck-emacs-lisp-check-form
|
(when (get 'flycheck-disabled-checkers 'initial-value)
|
||||||
(prin1-to-string
|
(setq-local flycheck-disabled-checkers (get 'flycheck-disabled-checkers 'initial-value))
|
||||||
`(progn
|
(kill-local-variable 'flycheck-emacs-lisp-check-form)))
|
||||||
(setq doom-modules ',doom-modules
|
(if (modulep! :checkers syntax +flymake)
|
||||||
doom-disabled-packages ',doom-disabled-packages
|
;; flymake
|
||||||
byte-compile-warnings ',+emacs-lisp-linter-warnings)
|
(remove-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc t)
|
||||||
(condition-case e
|
;; flycheck
|
||||||
(progn
|
(with-memoization (get 'flycheck-disabled-checkers 'initial-value)
|
||||||
(require 'doom)
|
flycheck-disabled-checkers)
|
||||||
(require 'doom-cli)
|
(setq-local flycheck-emacs-lisp-check-form
|
||||||
(require 'doom-start))
|
(prin1-to-string
|
||||||
(error
|
`(progn
|
||||||
(princ
|
(setq doom-modules ',doom-modules
|
||||||
(format "%s:%d:%d:Error:Failed to load Doom: %s\n"
|
doom-disabled-packages ',doom-disabled-packages
|
||||||
(or ,(ignore-errors
|
byte-compile-warnings ',+emacs-lisp-linter-warnings)
|
||||||
(file-name-nondirectory
|
(condition-case e
|
||||||
(buffer-file-name (buffer-base-buffer))))
|
(progn
|
||||||
(car command-line-args-left))
|
(require 'doom)
|
||||||
0 0 (error-message-string e)))))
|
(require 'doom-cli)
|
||||||
,(read (default-toplevel-value 'flycheck-emacs-lisp-check-form))))
|
(require 'doom-start))
|
||||||
flycheck-disabled-checkers (cons 'emacs-lisp-checkdoc
|
(error
|
||||||
flycheck-disabled-checkers))))
|
(princ
|
||||||
|
(format "%s:%d:%d:Error:Failed to load Doom: %s\n"
|
||||||
|
(or ,(ignore-errors
|
||||||
|
(file-name-nondirectory
|
||||||
|
(buffer-file-name (buffer-base-buffer))))
|
||||||
|
(car command-line-args-left))
|
||||||
|
0 0 (error-message-string e)))))
|
||||||
|
,(read (default-toplevel-value 'flycheck-emacs-lisp-check-form))))
|
||||||
|
flycheck-disabled-checkers (cons 'emacs-lisp-checkdoc
|
||||||
|
flycheck-disabled-checkers)))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -95,11 +95,11 @@ See `+emacs-lisp-non-package-mode' for details.")
|
||||||
;; Ensure straight sees modifications to installed packages
|
;; Ensure straight sees modifications to installed packages
|
||||||
#'+emacs-lisp-init-straight-maybe-h)
|
#'+emacs-lisp-init-straight-maybe-h)
|
||||||
|
|
||||||
;; UX: Flycheck's two emacs-lisp checkers produce a *lot* of false positives
|
;; UX: Both Flycheck's and Flymake's two
|
||||||
;; in non-packages (like Emacs configs or elisp scripts), so I disable
|
;; emacs-lisp checkers produce a *lot* of false positives in non-packages
|
||||||
;; `emacs-lisp-checkdoc' and set `byte-compile-warnings' to a subset of the
|
;; (like Emacs configs or elisp scripts), so I disable `checkdoc' (`emacs-lisp-checkdoc', `elisp-flymake-checkdoc')
|
||||||
;; original in the flycheck instance (see `+emacs-lisp-linter-warnings').
|
;; and set `byte-compile-warnings' to a subset that makes more sense (see `+emacs-lisp-linter-warnings')
|
||||||
(add-hook 'flycheck-mode-hook #'+emacs-lisp-non-package-mode)
|
(add-hook! '(flycheck-mode-hook flymake-mode-hook) #'+emacs-lisp-non-package-mode)
|
||||||
|
|
||||||
;; Enhance elisp syntax highlighting, by highlighting Doom-specific
|
;; Enhance elisp syntax highlighting, by highlighting Doom-specific
|
||||||
;; constructs, defined symbols, and truncating :pin's in `package!' calls.
|
;; constructs, defined symbols, and truncating :pin's in `package!' calls.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue