lang/emacs-lisp: restore flycheck in elisp buffers
However, with `emacs-lisp-checkdoc` disabled and `emacs-lisp` significantly gimped. byte-compile-warnings may need to be adjusted to allow for *some* warnings. Also, reformat emacs-lisp-mode hooks
This commit is contained in:
parent
ee7ff68ae4
commit
25beb4bcfd
2 changed files with 24 additions and 7 deletions
|
@ -122,12 +122,27 @@ if it's callable, `apropos' otherwise."
|
|||
("Types" "^\\s-*(\\(cl-def\\(?:struct\\|type\\)\\|def\\(?:class\\|face\\|group\\|ine-\\(?:condition\\|error\\|widget\\)\\|package\\|struct\\|t\\(?:\\(?:hem\\|yp\\)e\\)\\)\\)\\s-+'?\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +emacs-lisp|disable-flycheck-maybe ()
|
||||
"Disable flycheck-mode if in emacs.d."
|
||||
(defun +emacs-lisp|reduce-flycheck-errors-in-emacs-config ()
|
||||
"Remove `emacs-lisp-checkdoc' checker and reduce `emacs-lisp' checker
|
||||
verbosity when editing a file in `doom-private-dir' or `doom-emacs-dir'."
|
||||
(when (and (bound-and-true-p flycheck-mode)
|
||||
(eq major-mode 'emacs-lisp-mode)
|
||||
(or (not buffer-file-name)
|
||||
(cl-loop for dir in (list doom-emacs-dir doom-private-dir)
|
||||
if (file-in-directory-p buffer-file-name dir)
|
||||
return t)))
|
||||
(flycheck-mode -1)))
|
||||
(add-to-list (make-local-variable 'flycheck-disabled-checkers)
|
||||
'emacs-lisp-checkdoc)
|
||||
(set (make-local-variable 'flycheck-emacs-lisp-check-form)
|
||||
(concat "(progn "
|
||||
(prin1-to-string
|
||||
`(progn
|
||||
(load ,user-init-file t t)
|
||||
(defmacro map! (&rest _))
|
||||
(setq byte-compile-warnings
|
||||
'(obsolete cl-functions
|
||||
interactive-only make-local mapcar
|
||||
suspicious constants))))
|
||||
" "
|
||||
(default-value 'flycheck-emacs-lisp-check-form)
|
||||
")"))))
|
||||
|
|
|
@ -48,12 +48,16 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
#'(;; 3rd-party functionality
|
||||
auto-compile-on-save-mode
|
||||
outline-minor-mode
|
||||
;; fontificiation
|
||||
rainbow-delimiters-mode
|
||||
highlight-quoted-mode
|
||||
;; initialization
|
||||
+emacs-lisp|extend-imenu))
|
||||
|
||||
;; Flycheck's two emacs-lisp checkers produce a *lot* of false positives in
|
||||
;; emacs configs, so disable it when you're editing them
|
||||
(add-hook 'flycheck-mode-hook #'+emacs-lisp|disable-flycheck-maybe)
|
||||
;; emacs configs, so we disable `emacs-lisp-checkdoc' and reduce the
|
||||
;; `emacs-lisp' checker's verbosity.
|
||||
(add-hook 'flycheck-mode-hook #'+emacs-lisp|reduce-flycheck-errors-in-emacs-config)
|
||||
|
||||
;; Special fontification for elisp
|
||||
(font-lock-add-keywords
|
||||
|
@ -64,8 +68,6 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
(when +emacs-lisp-enable-extra-fontification
|
||||
`((+emacs-lisp-highlight-vars-and-faces . +emacs-lisp--face)))))
|
||||
|
||||
(add-hook! 'emacs-lisp-mode-hook #'(rainbow-delimiters-mode highlight-quoted-mode))
|
||||
|
||||
;; Recenter window after following definition
|
||||
(advice-add #'elisp-def :after #'doom*recenter)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue