From 67f060d6f99989ff5402b5bfb03cdae0e9c57426 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 23 Dec 2019 10:38:27 +0000 Subject: Temporarily disable flycheck TL;DR: Problem: I ran into a bug where my computer wallpaper was changing every five seconds whenever my init.el file was open and I was typing in it. Short-term solution: Disable flycheck. Long-term solution: Disable flycheck just for Elisp or just for init.el in Elisp. Post Mortem: Warning: If you have flycheck-emacs-lisp-initialize-packages set to auto or really anything other than nil, than the emacs-lisp flycheck-checker will spin up a new Emacs instance, and evaluate all of the Elisp in init.el. Why does this matter? Well, if like me, you have code anywhere in your init.el (and any files downstream from init.el), that code will get evaluated not just twice. But countless times... tens, hundreds, w/e. So... while you might think you have code that is just running at startup this code will be called incessantly. As a dramatic, contrived example, if you had something like... ```elisp (bank/send :amount 100 :to "wpcarro@gmail.com") ``` ...anywhere in that your init.el would evaluate, you may end up sending wpcarro@gmail.com millions of dollars. To make debugging this problem a bit more complicated is that because this runs in a separate Emacs instance, you can't do something like... ```elisp (defvar already-evaluated? nil) (unless already-evaluated? (bank/send :amount 100 :to "wpcarro@gmail.com")) (setq already-evaluated? t) ``` ...since the `already-evaluated?` variable will be local to the Emacs instance. So if you needed a mechanism to ensure code like this runs only once, you would need a way to share this semaphore across Emacs instances -- e.g. writing to and reading from disk. --- configs/shared/.emacs.d/init.el | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'configs/shared/.emacs.d') diff --git a/configs/shared/.emacs.d/init.el b/configs/shared/.emacs.d/init.el index b0e7548d82ed..9c307fcc221f 100644 --- a/configs/shared/.emacs.d/init.el +++ b/configs/shared/.emacs.d/init.el @@ -11,8 +11,6 @@ (require 'kaomoji) ;; Google -;; TODO: Debug why wallpaper is changing randomly. It seems to happen every 5 -;; seconds when init.el is open... (require 'google-stuff) ;; Laptop XF-functionality @@ -33,7 +31,9 @@ (require 'wpc-terminal) (require 'wpc-org) (require 'wpc-company) -(require 'wpc-flycheck) +;; TODO: Re-enable flycheck for all languages besides Elisp once I learn more +;; about the issue with the `emacs-lisp' `flycheck-checker'. +;; (require 'wpc-flycheck) (require 'wpc-shell) (require 'wpc-docker) (require 'wpc-lisp) @@ -48,7 +48,3 @@ (require 'wpc-javascript) (require 'wpc-java) (require 'wpc-prolog) - - -(provide 'init) -;;; init.el ends here -- cgit 1.4.1