fix(emacs-lisp): non-package-mode: only enable in elisp buffers
This prevents +emacs-lisp-non-package-mode from being activated in non-elisp buffers. Amend: #7341 Close: #7645 Co-authored-by: PatrickNorton <PatrickNorton@users.noreply.github.com>
This commit is contained in:
parent
180ffd3fa8
commit
ffd2654aa3
2 changed files with 17 additions and 11 deletions
|
@ -379,6 +379,7 @@ as `+emacs-lisp-non-package-mode' will enable it and disable the other checkers.
|
|||
,(read (default-toplevel-value 'flycheck-emacs-lisp-check-form))))
|
||||
flycheck-disabled-checkers (cons 'emacs-lisp-checkdoc
|
||||
flycheck-disabled-checkers))))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode +emacs-lisp-non-package-mode
|
||||
"Reduce flycheck/flymake verbosity where it is appropriate.
|
||||
|
@ -394,15 +395,19 @@ This generally applies to your private config (`doom-user-dir') or Doom's source
|
|||
:since "3.0.0"
|
||||
(unless (and (or (bound-and-true-p flycheck-mode)
|
||||
(bound-and-true-p flymake-mode))
|
||||
(derived-mode-p 'emacs-lisp-mode)
|
||||
(not (+emacs-lisp--in-package-buffer-p)))
|
||||
(setq +emacs-lisp-non-package-mode nil))
|
||||
(when (derived-mode-p 'emacs-lisp-mode)
|
||||
(add-hook 'after-save-hook #'+emacs-lisp-non-package-mode nil t))
|
||||
(let ((toggle (if +emacs-lisp-non-package-mode +1 -1)))
|
||||
(cond ((modulep! :checkers syntax +flymake)
|
||||
(+emacs-lisp--flymake-non-package-mode toggle))
|
||||
((modulep! :checkers syntax)
|
||||
(+emacs-lisp--flycheck-non-package-mode toggle)))))
|
||||
(when-let ((modesym (cond ((modulep! :checkers syntax +flymake)
|
||||
#'+emacs-lisp--flymake-non-package-mode)
|
||||
((modulep! :checkers syntax)
|
||||
#'+emacs-lisp--flycheck-non-package-mode))))
|
||||
(if (not +emacs-lisp-non-package-mode)
|
||||
(when (symbol-value modesym)
|
||||
(funcall modesym -1))
|
||||
(when (derived-mode-p 'emacs-lisp-mode)
|
||||
(add-hook 'after-save-hook #'+emacs-lisp-non-package-mode nil t))
|
||||
(funcall modesym +1))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -95,10 +95,11 @@ See `+emacs-lisp-non-package-mode' for details.")
|
|||
;; Ensure straight sees modifications to installed packages
|
||||
#'+emacs-lisp-init-straight-maybe-h)
|
||||
|
||||
;; UX: Both Flycheck's and Flymake's two
|
||||
;; emacs-lisp checkers produce a *lot* of false positives in non-packages
|
||||
;; (like Emacs configs or elisp scripts), so I disable `checkdoc' (`emacs-lisp-checkdoc', `elisp-flymake-checkdoc')
|
||||
;; and set `byte-compile-warnings' to a subset that makes more sense (see `+emacs-lisp-linter-warnings')
|
||||
;; UX: Both Flycheck's and Flymake's two emacs-lisp checkers produce a *lot*
|
||||
;; of false positives in non-packages (like Emacs configs or elisp
|
||||
;; scripts), so I disable `checkdoc' (`emacs-lisp-checkdoc',
|
||||
;; `elisp-flymake-checkdoc') and set `byte-compile-warnings' to a subset
|
||||
;; that makes more sense (see `+emacs-lisp-linter-warnings')
|
||||
(add-hook! '(flycheck-mode-hook flymake-mode-hook) #'+emacs-lisp-non-package-mode)
|
||||
|
||||
(defadvice! +syntax--fix-elisp-flymake-load-path (orig-fn &rest args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue