Enable flycheck mode in Emacs Lisp only when buffer has a file
Flycheck used to be activated unconditionally, resulting in annoying warnings when evaluating Lisp expressions in the minibuffer with `pp-eval-expression`, and in the scratch buffer.
This commit is contained in:
parent
9e84ba5251
commit
6742695f53
3
init.el
3
init.el
|
@ -593,6 +593,7 @@
|
|||
db/text-to-hex
|
||||
conditionally-enable-lispy
|
||||
turn-on-lispy-when-available
|
||||
turn-on-flycheck-when-file
|
||||
db/sort-nsm-permanent-settings
|
||||
endless/colorize-compilation
|
||||
db/turn-off-local-electric-pair-mode
|
||||
|
@ -2587,7 +2588,7 @@ With given ARG, display files in `db/important-document-path’."
|
|||
(use-package elisp-mode
|
||||
:config (progn
|
||||
(add-hook 'emacs-lisp-mode-hook 'turn-on-lispy-when-available)
|
||||
(add-hook 'emacs-lisp-mode-hook 'flycheck-mode)))
|
||||
(add-hook 'emacs-lisp-mode-hook 'turn-on-flycheck-when-file)))
|
||||
|
||||
(use-package geiser
|
||||
:commands (geiser-mode))
|
||||
|
|
|
@ -257,6 +257,11 @@ Will print a warning in case of failure."
|
|||
(require 'lispy)
|
||||
(lispy-mode)))
|
||||
|
||||
(defun turn-on-flycheck-when-file ()
|
||||
"Turn on `flycheck-mode' when buffer is associated with a file."
|
||||
(when buffer-file-name
|
||||
(flycheck-mode +1)))
|
||||
|
||||
(defun db/sort-nsm-permanent-settings ()
|
||||
"Sort values in `nsm-permanent-host-settings’."
|
||||
(setq nsm-permanent-host-settings
|
||||
|
|
Loading…
Reference in New Issue