2

I'm using the lsp layer on Spacemacs with javascript-backend 'lsp and it activates two modes I don't like: lsp-ui-mode and eldoc.

I found lsp-ui-mode inside lsp-mode-hook and added (remove-hook 'lsp-mode-hook 'lsp-ui-mode) to my init.el, which fixed that.

But I can't find where eldoc-mode is being called. How do I search for it within (all?) hooks?

agentofuser
  • 501
  • 3
  • 11

2 Answers2

3

Use M-x debug-on-entry RET eldoc-mode RET

(and M-x cancel-debug-on-entry RET to undo that.)

This will show you what called eldoc-mode, each time it is invoked.

To learn about the debugger, see C-hig (elisp)Debugger and especially (elisp)Debugger Commands (so you know how to use it).


In this case, the cause is almost certainly global-eldoc-mode which is a globalized minor mode. Globalized modes act in after-change-major-mode-hook, which happens after the major mode hook has run (and so you can't use the major mode hook to disable the associated buffer-local eldoc-mode).

If you don't want eldoc at all, just add (global-eldoc-mode -1) to your init file.

phils
  • 48,657
  • 3
  • 76
  • 115
  • 1
    Thank you, `debug-on-entry` did it. I added `(global-eldoc-mode -1)` to my init file but it wasn't enough. Then through the debugger I found out I had to also set `lsp-enable-eldoc nil`. Also found `lsp-ui-doc-enable` and `lsp-ui-sideline-enable` and turned them off to stop annoying overlays on hover. – agentofuser Sep 07 '18 at 00:57
1

You can use command apropos-value to find all variables whose values match some pattern: M-x apropos-value eldoc-mode. Then search the results buffer for just the variables whose names end in -hook.

Drew
  • 75,699
  • 9
  • 109
  • 225
  • Thank you! This does exactly what I asked for, but it was less helpful as there were too many results and I couldn't sift through them to find the culprit. Using `debug-on-entry` I also found out that `eldoc-mode` wasn't getting called in a hook at all, but rather in a piece of code that checked for the `lsp-enable-eldoc` condition and then called `eldoc-mode` directly. – agentofuser Sep 07 '18 at 01:02