reddit / emacs

Disabling Lsp-mode & flycheck globally unless toggled on?

realfuckingdd · 2022-01-25 02:05
When I'm in for example c-mode, lsp-mode and fly-check are automatically started, and it's necessary to turn them off with lsp-disconnect & toggling (global-flycheck-mode). What I've tried so far: 1. c-mode-hook with lsp-disconnect, lsp-ui, global-flycheck-mode toggle 2. with-eval-after-load 'c-mode. The same as above Neither work. lsp-disconnect is not available when I call it in my .emacs config for hooking c-mode (but it is for with-eval-after-load, although that still doesn't work). Global-flycheck-mode is apparently toggled on even if i turn it off by something. I thought, Maybe Lsp is toggling it on? I tried (setq lsp-diagnostics-provider :none) which doesn't seem to make a difference for flychek. Even when I disable lsp manually by lsp-disconnect for that buffer, it seems to always come back somehow and re-enable itself even while i just stay editing that single buffer. Anyone know how I can have these two disabled at startup but toggleable when needed?
Gangsir · 2022-01-25 12:51
Try some variation of (remove-hook 'c-mode 'lsp) In your init. I don't personally see the reason to do this, so I've never tried to stop lsp from initializing.
vifon · 2022-01-25 13:51
Are you on some fancy Emacs distribution like Doom Emacs? A vanilla Emacs shouldn't add any LSP hooks unless you add them yourself.
[deleted] · 2022-01-25 22:52
[deleted]
realfuckingdd · 2022-01-25 22:54
I'm using doom. I'll try to remove the hook and see if that works, but i'm still curious why toggling off with eval-after-load wouldn't work even if it is hooked.
vifon · 2022-01-25 23:07
Probably because the load itself is triggered by the hook, so the hook is already in action. Check the value of the hook and remove accordingly, yeah.