Emacs hook tip: try to just add functions to hooks, e.g. (add-hook 'prog-mode #'eldoc-mode). It's easier to remove functions than lambdas.