From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.help Subject: Re: ElDoc Tooltips Date: Tue, 09 Feb 2010 15:02:52 +0100 Organization: aich tea tea pea dicky riley dot net Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1265725033 18940 80.91.229.12 (9 Feb 2010 14:17:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Feb 2010 14:17:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 09 15:17:11 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Neqtq-0001lc-53 for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Feb 2010 15:17:10 +0100 Original-Received: from localhost ([127.0.0.1]:35237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Neqtp-000532-IW for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Feb 2010 09:17:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NeqsD-0004iC-Rw for help-gnu-emacs@gnu.org; Tue, 09 Feb 2010 09:15:29 -0500 Original-Received: from [199.232.76.173] (port=40090 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NeqsD-0004hv-4d for help-gnu-emacs@gnu.org; Tue, 09 Feb 2010 09:15:29 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NeqsB-0006CX-Fa for help-gnu-emacs@gnu.org; Tue, 09 Feb 2010 09:15:28 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:60262) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NeqsB-0006CL-2U for help-gnu-emacs@gnu.org; Tue, 09 Feb 2010 09:15:27 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Neqs7-0000Z1-Si for help-gnu-emacs@gnu.org; Tue, 09 Feb 2010 15:15:23 +0100 Original-Received: from 85.183.18.158 ([85.183.18.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 Feb 2010 15:15:23 +0100 Original-Received: from rileyrgdev by 85.183.18.158 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 Feb 2010 15:15:23 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 85.183.18.158 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:71760 Archived-At: Nordlöw 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))) | | `----