Enable flyspell-c++-clang-tidy only for saved files.

This commit is contained in:
tastytea 2019-09-25 02:24:49 +02:00
parent 1d254e7908
commit 0f19b47daf
2 changed files with 19 additions and 5 deletions

22
init.el
View File

@ -1,5 +1,5 @@
;;; init.el --- tastytea's Emacs init file. ;;; init.el --- tastytea's Emacs init file.
;; Time-stamp: <2019-09-24T23:38:28+00:00> ;; Time-stamp: <2019-09-25T00:18:15+00:00>
;;; Commentary: ;;; Commentary:
;; I am using this file with Emacs 26, but most of it will probably work with ;; I am using this file with Emacs 26, but most of it will probably work with
@ -216,20 +216,34 @@ With argument, do this that many times."
;; Syntax checking with many plugins. ;; Syntax checking with many plugins.
(unless slow-computer (unless slow-computer
(use-package flycheck (use-package flycheck
:defer nil
:config :config
(global-flycheck-mode) (global-flycheck-mode)
(setq flycheck-check-syntax-automatically '(save new-line mode-change)) ;; (setq flycheck-check-syntax-automatically '(save new-line mode-change))
(flycheck-add-mode 'html-tidy 'web-mode) (flycheck-add-mode 'html-tidy 'web-mode)
(flycheck-add-mode 'css-csslint 'web-mode) (flycheck-add-mode 'css-csslint 'web-mode)
:bind :bind
("<f5>" . flycheck-previous-error) ("<f5>" . flycheck-previous-error)
("<f6>" . flycheck-next-error)) ("<f6>" . flycheck-next-error)
)
(use-package flycheck-clang-tidy (use-package flycheck-clang-tidy
:after (flycheck projectile) :after (flycheck projectile)
:if (executable-find "clang-tidy") :if (executable-find "clang-tidy")
:config
(defun my/clang-tidy-off ()
"Disable c++-clang-tidy."
(add-to-list 'flycheck-disabled-checkers 'c/c++-clang-tidy))
(defun my/clang-tidy-on ()
"Enable c++-clang-tidy on."
(setq-local flycheck-disabled-checkers
(remove 'c/c++-clang-tidy flycheck-disabled-checkers))
)
:hook :hook
(flycheck-mode . flycheck-clang-tidy-setup)) (flycheck-mode . flycheck-clang-tidy-setup)
(first-change . my/clang-tidy-off) ; Disable when file is modified.
(before-save . my/clang-tidy-on) ; Enable if file is saved.
)
) )
;; Autocompletion mode with many plugins. ;; Autocompletion mode with many plugins.

View File

@ -1,2 +1,2 @@
127.0.0.1:51313 25947 127.0.0.1:51313 12357
phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh