emacs-devel
[Top][All Lists]
Advanced

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

Re: Possible to show tooltip at (point) ????


From: Kevin Burton
Subject: Re: Possible to show tooltip at (point) ????
Date: Mon, 29 Dec 2008 10:52:23 -0800

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 <address@hidden> wrote:
On Mon, Dec 29, 2008 at 4:31 AM, Jason Rumney <address@hidden> 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

reply via email to

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