Eldoc really bogs down the editor when used over SSH with TRAMP. I want to disable it in those cases. What I've tried is this:
(defun no-tramp-eldoc ()
(interactive)
(when (string-prefix-p "/ssh" (buffer-file-name)) (anaconda-eldoc-mode -1)))
(add-hook 'python-mode-hook 'no-tramp-eldoc)
Regarding that last line, I'm not sure if it should be
(add-hook 'python-mode-hook #'no-tramp-eldoc)
instead, but I've tried both and it does not work.
The no-tramp-eldoc
function itself should be correct: when called manually, eldoc does get disabled in TRAMP/SSH buffers --- it's the hook that does not work; maybe something re-enables eldoc after the hook has run?
I'm using Spacemacs.