For years I've used the
rgr/context-help solution from the EmacsWiki for this, with some slight tweaks. A few aspects still bothered me, though, so this question inspired me to write a new variant of that as a global minor mode. Among other differences, this utilises
help-xref-interned to display all (variable, function, face) kinds of help for a symbol instead of arbitrarily choosing between
describe-variable when both cells are defined.
"Displays help for the current symbol whenever the *Help* buffer is visible.
:lighter " C-h"
(require 'help-mode) ;; for `help-xref-interned'
(message "Contextual help is %s" (if my-contextual-help-mode "on" "off"))
(defadvice eldoc-print-current-symbol-info (before my-contextual-help activate)
"Triggers contextual elisp *Help*. Enabled by `my-contextual-help-mode'."
(defun my-contextual-help (&optional force)
"Display function or variable at point in *Help* buffer, if visible."
(when (or force (get-buffer-window (help-buffer)))
(let ((sym (eldoc-current-symbol)))
;; If something else changes the help buffer contents, ensure we
;; don't immediately revert back to the current symbol's help.
(not (keywordp sym))
(not (eq sym (get 'my-contextual-help 'last-sym)))
(put 'my-contextual-help 'last-sym sym)