help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ElDoc Tooltips


From: Richard Riley
Subject: Re: ElDoc Tooltips
Date: Tue, 09 Feb 2010 15:02:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Nordlöw <per.nordlow@gmail.com> writes:

> Has anybody provided a tweak to ElDoc to make it display its prototype
> hint using a tooltip near (usually under) the cursor instead of a
> minibuffer-message?
>
> /Nordlöw
>

I was hoping for something similar and actually started a little while
ago to look at using company-mode's display for this but got
distracted. One thing I did knock up ages ago when trying to learn elisp
was to make eldoc actually tell me something that helped. This shows the
help for a symbol under the point in a dedicated buffer. If you hide it,
toggle twice to make it reappear. POssibly the "eldoc" advice and the main
context help function could form the basis (when rewritten no doubt ;))
for a "proper" tooltip in an overlay perhaps?

,----
|   (defun rgr/context-buffer()
|     (get-buffer-create "*Help*"))
|   
|   (defun rgr/toggle-context-help()
|     "Turn on or off the context help. Note that if ON and you hide the help 
buffer then you need to manually reshow it. A double toggle will make it 
reappear"
|     (interactive)
|     (with-current-buffer (rgr/context-buffer)
|       (unless (local-variable-p 'context-help) (set (make-local-variable 
'context-help) t))
|       (if (setq context-help (not context-help))
|           (progn
|             (if (not (get-buffer-window (help-buffer)))
|                 (display-buffer (help-buffer)))))
|       (message "Context help %s" (if context-help "ON" "OFF"))))
|   
|   (global-set-key (kbd "C-c h") 'rgr/toggle-context-help)
| 
|   (defun rgr/context-help()
|     " Display function or variable at point in the *Help* buffer if it is 
visible. Default behaviour can be turned off by setting the buffer local 
context-help to false"
|     (interactive)
|     
|     (let((helptext nil)( rgr-symbol (symbol-at-point)))(with-current-buffer 
(rgr/context-buffer)
|       (unless (local-variable-p 'context-help) (set (make-local-variable 
'context-help) t))
|       (if (and context-help (get-buffer-window (help-buffer)) rgr-symbol )
|           (if (fboundp  rgr-symbol) (describe-function rgr-symbol) 
|             (if (boundp  rgr-symbol) (describe-variable rgr-symbol))))))
|         )
|   
|    (defadvice eldoc-print-current-symbol-info
|      (around eldoc-show-c-tag activate)
|      (cond 
|           ((eq major-mode 'emacs-lisp-mode)(rgr/context-help) ad-do-it)
|           ((eq major-mode 'lisp-interaction-mode)(rgr/context-help) ad-do-it)
|           ((eq major-mode 'apropos-mode)(rgr/context-help) ad-do-it)
|           (t ad-do-it)))
|   
|   
`----






reply via email to

[Prev in Thread] Current Thread [Next in Thread]