From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Kevin Burton" Newsgroups: gmane.emacs.devel Subject: Re: Possible to show tooltip at (point) ???? Date: Mon, 29 Dec 2008 10:52:23 -0800 Message-ID: <30c6373b0812291052s5185dea3r40e43a5a53f46fbf@mail.gmail.com> References: <30c6373b0812272248y7c51447ax15bcea34d8cce132@mail.gmail.com> <30c6373b0812280124r6301ec1ka7e12d2e719126a1@mail.gmail.com> <49574CB0.5050600@gnu.org> <30c6373b0812280920y722b7822s7c844f0c73636545@mail.gmail.com> <30c6373b0812281805odc4b2d7n549c6304ceb62553@mail.gmail.com> <4958448C.5060700@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_131509_2458926.1230576743877" X-Trace: ger.gmane.org 1230576763 1586 80.91.229.12 (29 Dec 2008 18:52:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Dec 2008 18:52:43 +0000 (UTC) Cc: Chong Yidong , emacs-devel@gnu.org, Jason Rumney To: "Lennart Borgman" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 29 19:53:49 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LHNFN-0003ak-35 for ged-emacs-devel@m.gmane.org; Mon, 29 Dec 2008 19:53:49 +0100 Original-Received: from localhost ([127.0.0.1]:39073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LHNE9-0000y7-Iu for ged-emacs-devel@m.gmane.org; Mon, 29 Dec 2008 13:52:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LHNE5-0000w3-1m for emacs-devel@gnu.org; Mon, 29 Dec 2008 13:52:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LHNE4-0000vr-Dv for emacs-devel@gnu.org; Mon, 29 Dec 2008 13:52:28 -0500 Original-Received: from [199.232.76.173] (port=49230 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LHNE4-0000vo-AR for emacs-devel@gnu.org; Mon, 29 Dec 2008 13:52:28 -0500 Original-Received: from yx-out-1718.google.com ([74.125.44.158]:37662) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LHNE1-000627-No; Mon, 29 Dec 2008 13:52:25 -0500 Original-Received: by yx-out-1718.google.com with SMTP id 34so1616695yxf.66 for ; Mon, 29 Dec 2008 10:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type:references :x-google-sender-auth; bh=+cCa2XLLa1UEGW3thTfSktdLf3rvvKZ44LiZ6Z4Pv44=; b=BU3+q2G1vRVa0+WwuoN7wFV8GIGjmeI6nhFjdi/k/5gQA0Hlmzcb19+X7gHFD96Brq t1FXuHyLXh0St0H36YAsmc2XzfqmFQfcBItYIDqI/XpOTs66EGSQXzNX4fwjgmICUW2t TF4bXqvoL1Hlf6NXAg6IDxdZRsRoEGY8zFEYU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:references:x-google-sender-auth; b=F5pzJYQGFJYBmz619pZdkRHpeeHSjAGk2bdZ/i+Poa2IZfDbnS2kCJlxS9HyiEG/B3 ZGB/MLY+MzfPQrWo5yXyd9YSgAWI8ciwlO6W+2sUDaxEdGJuiQb4hb9E4/CXtfMRoweh RLIgwLUsYitiFd2KDxe/mz07FufDyTyO91thg= Original-Received: by 10.90.98.13 with SMTP id v13mr6637192agb.112.1230576743879; Mon, 29 Dec 2008 10:52:23 -0800 (PST) Original-Received: by 10.90.98.6 with HTTP; Mon, 29 Dec 2008 10:52:23 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: 96c24925f6ee7fa4 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:107380 Archived-At: ------=_Part_131509_2458926.1230576743877 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Here's my prototype implementation of tooltip-at-point: (defun tooltip-at-point(message) "This is a proof of concep for a tooltip-at-point function for GNU Emacs. " (interactive (list (read-string "Message: " ))) (let*((mp (mouse-position)) (x-max-tooltip-size (cons (frame-width) (frame-height))) (posn (posn-at-point)) (x nil) (y nil)) (setq posn-xy (posn-actual-col-row posn)) (setq x (car posn-xy)) (setq y (cdr posn-xy)) (set-mouse-position (selected-frame) x y) ;;FIXME: see if there's a way to preserve source buffer font lock ;;information. Setting a global 'face' can reset faces for EVERYTHING. (x-show-tip (propertize message 'face 'tooltip-at-point) (selected-frame) (list) tooltip-hide-delay tooltip-x-offset tooltip-y-offset) ;;restore the mouse position (set-mouse-position (nth 0 mp) (car (cdr mp)) (cdr (cdr mp))))) ... for what its worth. I also wrote a tooltip-at-point-elisp package so that you can run C-? and lookup a symbol at point. I can post both of these here. It would be NICE to have an official way to do this...... Kevin On Mon, Dec 29, 2008 at 1:52 AM, Lennart Borgman wrote: > On Mon, Dec 29, 2008 at 4:31 AM, Jason Rumney wrote: > > Lennart Borgman wrote: > >> > >> For me it works also if the window is split. The only problem I have > >> seen is with the margins. Maybe this is platform dependent? > >> > > > > I don't see any problems with margins in current CVS or 22.3. Can you > give a > > specific example? > > Try this > > (point-to-coord (point)) > (posn-at-point (point)) > (set-window-margins (selected-window) 20 0) > (point-to-coord (point)) > (posn-at-point (point)) > > I get the same result before and after set-window-margins. > -- Founder/CEO Spinn3r.com Location: San Francisco, CA AIM/YIM: sfburtonator Skype: burtonator Work: http://spinn3r.com ------=_Part_131509_2458926.1230576743877 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Here's my prototype implementation of tooltip-at-point:

(defun tooltip-at-point(message)
  "This is a proof of concep for a tooltip-at-point function for
GNU Emacs.   "
  (interactive
   (list
    (read-string "Message: " )))
  
  (let*((mp (mouse-position))
        (x-max-tooltip-size (cons (frame-width) (frame-height)))
        (posn (posn-at-point))
        (x nil)
        (y nil))

    (setq posn-xy (posn-actual-col-row posn))
    (setq x (car posn-xy))
    (setq y (cdr posn-xy))

    (set-mouse-position (selected-frame) x y)

    ;;FIXME: see if there's a way to preserve source buffer font lock
    ;;information.  Setting a global 'face' can reset faces for EVERYTHING.
    (x-show-tip (propertize message 'face 'tooltip-at-point)
                (selected-frame)
                (list)
                tooltip-hide-delay
                tooltip-x-offset
                tooltip-y-offset)

    ;;restore the mouse position
    (set-mouse-position (nth 0 mp) (car (cdr mp)) (cdr (cdr mp)))))

... for what its worth. I also wrote a tooltip-at-point-elisp package so that you can run C-? and lookup a symbol at point.

I can post both of these here.

It would be NICE to have an official way to do this......

Kevin


On Mon, Dec 29, 2008 at 1:52 AM, Lennart Borgman <lennart.borgman@gmail.com> wrote:
On Mon, Dec 29, 2008 at 4:31 AM, Jason Rumney <jasonr@gnu.org> wrote:
> Lennart Borgman wrote:
>>
>> For me it works also if the window is split. The only problem I have
>> seen is with the margins. Maybe this is platform dependent?
>>
>
> I don't see any problems with margins in current CVS or 22.3. Can you give a
> specific example?

Try this

 (point-to-coord (point))
 (posn-at-point (point))
 (set-window-margins (selected-window) 20 0)
 (point-to-coord (point))
 (posn-at-point (point))

I get the same result before and after set-window-margins.



--
Founder/CEO Spinn3r.com
Location: San Francisco, CA
AIM/YIM: sfburtonator
Skype: burtonator
Work: http://spinn3r.com
------=_Part_131509_2458926.1230576743877--