At work, I very commonly have to look up bits of information about strings in my code. For instance, we might use an incomprehensible ID, "a587fg", to refer to a customer with a perfectly comprehensible name, "FooCorp". It's fairly easy to define a function and bind it to a key mapping to look up a thing under point -- but what I'd much prefer is an ElDoc-style "here's some info about thing-under-point in the echo area, automatically" situation.
My reflex was to go to ElDoc itself, but I can't get it to work and I've no idea why. My best theory so far is that ElDoc only triggers on symbols -- which, of course, an arbitrary string isn't, and probably shouldn't be.
So: maybe I'm wiring up ElDoc wrong? Maybe there's a better way to do info-of-string-at-point? Who can help me understand how to get this working?
For reference, here's how I'm wiring things up:
(defun my-eldoc-function ()
"Get info about string at point"
(let (the-str)
(if (setq the-str (thing-at-point 'string t))
(my-str-doc-fun the-str) ;; Returns a string or nil
nil)))
(set (make-local-variable 'eldoc-documentation-function)
'my-eldoc-function)