unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Possible to show tooltip at (point) ????
@ 2008-12-28  6:48 Kevin Burton
  2008-12-28  6:55 ` Lennart Borgman
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Kevin Burton @ 2008-12-28  6:48 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 901 bytes --]

A few years ago (has it REALLY been that long?) I was playing with
x-show-tooltip so that I could display a tooltip at the given point.

I was mostly interested in this so that I could build just in time code
completion.  This way one could have a function call:

foo(

And type something like C-enter to lookup the previous symbol and show
method argument documentation in a tooltip.

..... anyway.

I needed away to have x-show-tooltip generate under (point).  Is this
possible?

If I remember I can manually position the tooltip if I know the on screen
x/y pixel cartesian position of (point) but I don't think this was possible
either.

This was with an early version Emacs 21...  Anyone know a solution to this?
 Have features been added to Emacs 22 to enable this?

Kevin


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

[-- Attachment #2: Type: text/html, Size: 1212 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28  6:48 Possible to show tooltip at (point) ???? Kevin Burton
@ 2008-12-28  6:55 ` Lennart Borgman
  2008-12-28  9:05 ` Chong Yidong
  2008-12-28 17:07 ` Mathias Dahl
  2 siblings, 0 replies; 19+ messages in thread
From: Lennart Borgman @ 2008-12-28  6:55 UTC (permalink / raw)
  To: Kevin Burton; +Cc: emacs-devel

On Sun, Dec 28, 2008 at 7:48 AM, Kevin Burton <burton@spinn3r.com> wrote:
> A few years ago (has it REALLY been that long?) I was playing with
> x-show-tooltip so that I could display a tooltip at the given point.
> I was mostly interested in this so that I could build just in time code
> completion.  This way one could have a function call:
> foo(
> And type something like C-enter to lookup the previous symbol and show
> method argument documentation in a tooltip.
> ..... anyway.
> I needed away to have x-show-tooltip generate under (point).  Is this
> possible?
> If I remember I can manually position the tooltip if I know the on screen
> x/y pixel cartesian position of (point) but I don't think this was possible
> either.
> This was with an early version Emacs 21...  Anyone know a solution to this?
>  Have features been added to Emacs 22 to enable this?
> Kevin

There is a point-to-coord in ourcomments-util in nXhtml, but it does
not always work correctly.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28  6:48 Possible to show tooltip at (point) ???? Kevin Burton
  2008-12-28  6:55 ` Lennart Borgman
@ 2008-12-28  9:05 ` Chong Yidong
  2008-12-28  9:24   ` Kevin Burton
  2008-12-28 17:07 ` Mathias Dahl
  2 siblings, 1 reply; 19+ messages in thread
From: Chong Yidong @ 2008-12-28  9:05 UTC (permalink / raw)
  To: Kevin Burton; +Cc: emacs-devel

"Kevin Burton" <burton@spinn3r.com> writes:

> A few years ago (has it REALLY been that long?) I was playing with
> x-show-tooltip so that I could display a tooltip at the given point.
>
> I needed away to have x-show-tooltip generate under (point).  Is this
> possible?
>
> If I remember I can manually position the tooltip if I know the on
> screen x/y pixel cartesian position of (point) but I don't think this
> was possible either.

I think it is possible with some hackery--you have to adjust
tooltip-frame-parameters before calling tooltip-show.  If I'm not
mistaken, doc-view mode uses a similar approach to display search
results within pdfs.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28  9:05 ` Chong Yidong
@ 2008-12-28  9:24   ` Kevin Burton
  2008-12-28  9:53     ` Jason Rumney
  0 siblings, 1 reply; 19+ messages in thread
From: Kevin Burton @ 2008-12-28  9:24 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

>
> I think it is possible with some hackery--you have to adjust
> tooltip-frame-parameters before calling tooltip-show.  If I'm not
> mistaken, doc-view mode uses a similar approach to display search
> results within pdfs.
>

You mean by specifying top and left?  I think that is what I was going to do
to position the tooltip but first I need to find out the x/y of the current
point.

Kevin

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

[-- Attachment #2: Type: text/html, Size: 822 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28  9:24   ` Kevin Burton
@ 2008-12-28  9:53     ` Jason Rumney
  2008-12-28 17:14       ` Lennart Borgman
  0 siblings, 1 reply; 19+ messages in thread
From: Jason Rumney @ 2008-12-28  9:53 UTC (permalink / raw)
  To: Kevin Burton; +Cc: Chong Yidong, emacs-devel

Kevin Burton wrote:
> You mean by specifying top and left?  I think that is what I was going 
> to do to position the tooltip but first I need to find out the x/y of 
> the current point.

(posn-at-point &optional POS WINDOW)






^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28  6:48 Possible to show tooltip at (point) ???? Kevin Burton
  2008-12-28  6:55 ` Lennart Borgman
  2008-12-28  9:05 ` Chong Yidong
@ 2008-12-28 17:07 ` Mathias Dahl
  2008-12-28 17:14   ` Kevin Burton
  2 siblings, 1 reply; 19+ messages in thread
From: Mathias Dahl @ 2008-12-28 17:07 UTC (permalink / raw)
  To: Kevin Burton, emacs-devel

I am a user of `predictive' which in my opinion has good facilities
for showing candidates. I think even that the completion stuff has
been factored out in its own package. I think it uses tooltips as one
of the options. Why don't you check it out.


2008/12/28, Kevin Burton <burton@spinn3r.com>:
> A few years ago (has it REALLY been that long?) I was playing with
> x-show-tooltip so that I could display a tooltip at the given point.
>
> I was mostly interested in this so that I could build just in time code
> completion.  This way one could have a function call:
>
> foo(
>
> And type something like C-enter to lookup the previous symbol and show
> method argument documentation in a tooltip.
>
> ..... anyway.
>
> I needed away to have x-show-tooltip generate under (point).  Is this
> possible?
>
> If I remember I can manually position the tooltip if I know the on screen
> x/y pixel cartesian position of (point) but I don't think this was possible
> either.
>
> This was with an early version Emacs 21...  Anyone know a solution to this?
>  Have features been added to Emacs 22 to enable this?
>
> Kevin
>
>
> --
> Founder/CEO Spinn3r.com
> Location: San Francisco, CA
> AIM/YIM: sfburtonator
> Skype: burtonator
> Work: http://spinn3r.com
>




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28  9:53     ` Jason Rumney
@ 2008-12-28 17:14       ` Lennart Borgman
  2008-12-28 17:20         ` Kevin Burton
  0 siblings, 1 reply; 19+ messages in thread
From: Lennart Borgman @ 2008-12-28 17:14 UTC (permalink / raw)
  To: Jason Rumney; +Cc: Kevin Burton, Chong Yidong, emacs-devel

On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org> wrote:
> Kevin Burton wrote:
>>
>> You mean by specifying top and left?  I think that is what I was going to
>> do to position the tooltip but first I need to find out the x/y of the
>> current point.
>
> (posn-at-point &optional POS WINDOW)

I think there is a bug with left margin. (Though I have not had time
to submit a bug report for this.)




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28 17:07 ` Mathias Dahl
@ 2008-12-28 17:14   ` Kevin Burton
  0 siblings, 0 replies; 19+ messages in thread
From: Kevin Burton @ 2008-12-28 17:14 UTC (permalink / raw)
  To: Mathias Dahl; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2136 bytes --]

Yeah...

I'm about to take the family to the beach but I will look when I get
home....

http://www.dr-qubit.org/predictive/user-guide/html/Completion-Tooltip.html#Completion-Tooltip

I *think* what they're doing is bringing up the tooltip based on a keyboard
event which *CAN* get the absolute x/y coords.

I have a different goal which is to show the tooltip during idle timeout or
when you enter an overlay.

Specifically, I'm writing a just in time compiler which compiles files right
after you save the and highlights your errors in red.

Anyway.... I'll look at the source and report back.

On Sun, Dec 28, 2008 at 9:07 AM, Mathias Dahl <mathias.dahl@gmail.com>wrote:

> I am a user of `predictive' which in my opinion has good facilities
> for showing candidates. I think even that the completion stuff has
> been factored out in its own package. I think it uses tooltips as one
> of the options. Why don't you check it out.
>
>
> 2008/12/28, Kevin Burton <burton@spinn3r.com>:
> > A few years ago (has it REALLY been that long?) I was playing with
> > x-show-tooltip so that I could display a tooltip at the given point.
> >
> > I was mostly interested in this so that I could build just in time code
> > completion.  This way one could have a function call:
> >
> > foo(
> >
> > And type something like C-enter to lookup the previous symbol and show
> > method argument documentation in a tooltip.
> >
> > ..... anyway.
> >
> > I needed away to have x-show-tooltip generate under (point).  Is this
> > possible?
> >
> > If I remember I can manually position the tooltip if I know the on screen
> > x/y pixel cartesian position of (point) but I don't think this was
> possible
> > either.
> >
> > This was with an early version Emacs 21...  Anyone know a solution to
> this?
> >  Have features been added to Emacs 22 to enable this?
> >
> > Kevin
> >
> >
> > --
> > Founder/CEO Spinn3r.com
> > Location: San Francisco, CA
> > AIM/YIM: sfburtonator
> > Skype: burtonator
> > Work: http://spinn3r.com
> >
>



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

[-- Attachment #2: Type: text/html, Size: 3066 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28 17:14       ` Lennart Borgman
@ 2008-12-28 17:20         ` Kevin Burton
  2008-12-28 17:31           ` Lennart Borgman
  0 siblings, 1 reply; 19+ messages in thread
From: Kevin Burton @ 2008-12-28 17:20 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Chong Yidong, emacs-devel, Jason Rumney

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

In the predictive package?
I think one just needs to compute the left-margin width.

I wrote a tooltip-at-point package a few years ago (but never got it t work
reliably) and added this into the mix....

Kevin

On Sun, Dec 28, 2008 at 9:14 AM, Lennart Borgman
<lennart.borgman@gmail.com>wrote:

> On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org> wrote:
> > Kevin Burton wrote:
> >>
> >> You mean by specifying top and left?  I think that is what I was going
> to
> >> do to position the tooltip but first I need to find out the x/y of the
> >> current point.
> >
> > (posn-at-point &optional POS WINDOW)
>
> I think there is a bug with left margin. (Though I have not had time
> to submit a bug report for this.)
>



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

[-- Attachment #2: Type: text/html, Size: 1387 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28 17:20         ` Kevin Burton
@ 2008-12-28 17:31           ` Lennart Borgman
  2008-12-28 17:38             ` Kevin Burton
  2008-12-29  2:05             ` Kevin Burton
  0 siblings, 2 replies; 19+ messages in thread
From: Lennart Borgman @ 2008-12-28 17:31 UTC (permalink / raw)
  To: Kevin Burton; +Cc: Chong Yidong, emacs-devel, Jason Rumney

On Sun, Dec 28, 2008 at 6:20 PM, Kevin Burton <burton@spinn3r.com> wrote:
> In the predictive package?
> I think one just needs to compute the left-margin width.

Here is what I have. There is indeed a problem with the left margin.
What change do you propose?

(defun point-to-coord (point)
  "Return coordinates of POINT in selected window.
The coordinates are in the form \(\(XOFFSET YOFFSET) WINDOW).
This form is suitable for `popup-menu'."
  ;; Fix-me: showtip.el adds (window-inside-pixel-edges
  ;; (selected-window)). Why?
  (let* ((pn (posn-at-point point))
         (x-y (posn-x-y pn))
         (x (car x-y))
         (y (cdr x-y))
         (pos (list (list x (+ y 20)) (selected-window))))
    pos))

> I wrote a tooltip-at-point package a few years ago (but never got it t work
> reliably) and added this into the mix....
> Kevin
>
> On Sun, Dec 28, 2008 at 9:14 AM, Lennart Borgman <lennart.borgman@gmail.com>
> wrote:
>>
>> On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org> wrote:
>> > Kevin Burton wrote:
>> >>
>> >> You mean by specifying top and left?  I think that is what I was going
>> >> to
>> >> do to position the tooltip but first I need to find out the x/y of the
>> >> current point.
>> >
>> > (posn-at-point &optional POS WINDOW)
>>
>> I think there is a bug with left margin. (Though I have not had time
>> to submit a bug report for this.)




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28 17:31           ` Lennart Borgman
@ 2008-12-28 17:38             ` Kevin Burton
  2008-12-29  2:05             ` Kevin Burton
  1 sibling, 0 replies; 19+ messages in thread
From: Kevin Burton @ 2008-12-28 17:38 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Chong Yidong, emacs-devel, Jason Rumney

[-- Attachment #1: Type: text/plain, Size: 1858 bytes --]

Thanks..... looks like this is window relative not screen absolute.
Pretty it sure it won't work with setting the tooltip but hope to be proven
wrong :)

I'll test it later tonight.

Kevin

On Sun, Dec 28, 2008 at 9:31 AM, Lennart Borgman
<lennart.borgman@gmail.com>wrote:

> On Sun, Dec 28, 2008 at 6:20 PM, Kevin Burton <burton@spinn3r.com> wrote:
> > In the predictive package?
> > I think one just needs to compute the left-margin width.
>
> Here is what I have. There is indeed a problem with the left margin.
> What change do you propose?
>
> (defun point-to-coord (point)
>  "Return coordinates of POINT in selected window.
> The coordinates are in the form \(\(XOFFSET YOFFSET) WINDOW).
> This form is suitable for `popup-menu'."
>  ;; Fix-me: showtip.el adds (window-inside-pixel-edges
>  ;; (selected-window)). Why?
>  (let* ((pn (posn-at-point point))
>         (x-y (posn-x-y pn))
>         (x (car x-y))
>         (y (cdr x-y))
>         (pos (list (list x (+ y 20)) (selected-window))))
>    pos))
>
> > I wrote a tooltip-at-point package a few years ago (but never got it t
> work
> > reliably) and added this into the mix....
> > Kevin
> >
> > On Sun, Dec 28, 2008 at 9:14 AM, Lennart Borgman <
> lennart.borgman@gmail.com>
> > wrote:
> >>
> >> On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org> wrote:
> >> > Kevin Burton wrote:
> >> >>
> >> >> You mean by specifying top and left?  I think that is what I was
> going
> >> >> to
> >> >> do to position the tooltip but first I need to find out the x/y of
> the
> >> >> current point.
> >> >
> >> > (posn-at-point &optional POS WINDOW)
> >>
> >> I think there is a bug with left margin. (Though I have not had time
> >> to submit a bug report for this.)
>



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

[-- Attachment #2: Type: text/html, Size: 2824 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-28 17:31           ` Lennart Borgman
  2008-12-28 17:38             ` Kevin Burton
@ 2008-12-29  2:05             ` Kevin Burton
  2008-12-29  2:14               ` Lennart Borgman
  1 sibling, 1 reply; 19+ messages in thread
From: Kevin Burton @ 2008-12-29  2:05 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Chong Yidong, emacs-devel, Jason Rumney

[-- Attachment #1: Type: text/plain, Size: 1993 bytes --]

Yes..... this DOES work but for a window that's not split.... as soon as you
split the window the coord is for the first window (not the second).
I guess I could look at the current window configuration and double the
current Y if the window is split in half....

Kind of hacky but could work for a proof of concept.

Kevin

On Sun, Dec 28, 2008 at 9:31 AM, Lennart Borgman
<lennart.borgman@gmail.com>wrote:

> On Sun, Dec 28, 2008 at 6:20 PM, Kevin Burton <burton@spinn3r.com> wrote:
> > In the predictive package?
> > I think one just needs to compute the left-margin width.
>
> Here is what I have. There is indeed a problem with the left margin.
> What change do you propose?
>
> (defun point-to-coord (point)
>  "Return coordinates of POINT in selected window.
> The coordinates are in the form \(\(XOFFSET YOFFSET) WINDOW).
> This form is suitable for `popup-menu'."
>  ;; Fix-me: showtip.el adds (window-inside-pixel-edges
>  ;; (selected-window)). Why?
>  (let* ((pn (posn-at-point point))
>         (x-y (posn-x-y pn))
>         (x (car x-y))
>         (y (cdr x-y))
>         (pos (list (list x (+ y 20)) (selected-window))))
>    pos))
>
> > I wrote a tooltip-at-point package a few years ago (but never got it t
> work
> > reliably) and added this into the mix....
> > Kevin
> >
> > On Sun, Dec 28, 2008 at 9:14 AM, Lennart Borgman <
> lennart.borgman@gmail.com>
> > wrote:
> >>
> >> On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org> wrote:
> >> > Kevin Burton wrote:
> >> >>
> >> >> You mean by specifying top and left?  I think that is what I was
> going
> >> >> to
> >> >> do to position the tooltip but first I need to find out the x/y of
> the
> >> >> current point.
> >> >
> >> > (posn-at-point &optional POS WINDOW)
> >>
> >> I think there is a bug with left margin. (Though I have not had time
> >> to submit a bug report for this.)
>



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

[-- Attachment #2: Type: text/html, Size: 2955 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-29  2:05             ` Kevin Burton
@ 2008-12-29  2:14               ` Lennart Borgman
  2008-12-29  2:33                 ` Kevin Burton
  2008-12-29  3:31                 ` Jason Rumney
  0 siblings, 2 replies; 19+ messages in thread
From: Lennart Borgman @ 2008-12-29  2:14 UTC (permalink / raw)
  To: Kevin Burton; +Cc: Chong Yidong, emacs-devel, Jason Rumney

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 use this in nXhtml where it used for popup menus for completion in
XHTML. If you want to it is easy to test there.


On Mon, Dec 29, 2008 at 3:05 AM, Kevin Burton <burton@spinn3r.com> wrote:
> Yes..... this DOES work but for a window that's not split.... as soon as you
> split the window the coord is for the first window (not the second).
> I guess I could look at the current window configuration and double the
> current Y if the window is split in half....
> Kind of hacky but could work for a proof of concept.
> Kevin
>
> On Sun, Dec 28, 2008 at 9:31 AM, Lennart Borgman <lennart.borgman@gmail.com>
> wrote:
>>
>> On Sun, Dec 28, 2008 at 6:20 PM, Kevin Burton <burton@spinn3r.com> wrote:
>> > In the predictive package?
>> > I think one just needs to compute the left-margin width.
>>
>> Here is what I have. There is indeed a problem with the left margin.
>> What change do you propose?
>>
>> (defun point-to-coord (point)
>>  "Return coordinates of POINT in selected window.
>> The coordinates are in the form \(\(XOFFSET YOFFSET) WINDOW).
>> This form is suitable for `popup-menu'."
>>  ;; Fix-me: showtip.el adds (window-inside-pixel-edges
>>  ;; (selected-window)). Why?
>>  (let* ((pn (posn-at-point point))
>>         (x-y (posn-x-y pn))
>>         (x (car x-y))
>>         (y (cdr x-y))
>>         (pos (list (list x (+ y 20)) (selected-window))))
>>    pos))
>>
>> > I wrote a tooltip-at-point package a few years ago (but never got it t
>> > work
>> > reliably) and added this into the mix....
>> > Kevin
>> >
>> > On Sun, Dec 28, 2008 at 9:14 AM, Lennart Borgman
>> > <lennart.borgman@gmail.com>
>> > wrote:
>> >>
>> >> On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org> wrote:
>> >> > Kevin Burton wrote:
>> >> >>
>> >> >> You mean by specifying top and left?  I think that is what I was
>> >> >> going
>> >> >> to
>> >> >> do to position the tooltip but first I need to find out the x/y of
>> >> >> the
>> >> >> current point.
>> >> >
>> >> > (posn-at-point &optional POS WINDOW)
>> >>
>> >> I think there is a bug with left margin. (Though I have not had time
>> >> to submit a bug report for this.)
>
>
>
> --
> Founder/CEO Spinn3r.com
> Location: San Francisco, CA
> AIM/YIM: sfburtonator
> Skype: burtonator
> Work: http://spinn3r.com
>




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-29  2:14               ` Lennart Borgman
@ 2008-12-29  2:33                 ` Kevin Burton
  2008-12-29  2:36                   ` Lennart Borgman
  2008-12-29  3:31                 ` Jason Rumney
  1 sibling, 1 reply; 19+ messages in thread
From: Kevin Burton @ 2008-12-29  2:33 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Chong Yidong, emacs-devel, Jason Rumney

[-- Attachment #1: Type: text/plain, Size: 2956 bytes --]

What platform are you on?  What's your emacs-version?
Mine is:

GNU Emacs 22.3.2 (i386-apple-darwin9.5.0, Carbon Version 1.6.0) of
2008-09-21 on plume.sr.unh.edu - Aquamacs Distribution 1.5


On Sun, Dec 28, 2008 at 6:14 PM, Lennart Borgman
<lennart.borgman@gmail.com>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 use this in nXhtml where it used for popup menus for completion in
> XHTML. If you want to it is easy to test there.
>
>
> On Mon, Dec 29, 2008 at 3:05 AM, Kevin Burton <burton@spinn3r.com> wrote:
> > Yes..... this DOES work but for a window that's not split.... as soon as
> you
> > split the window the coord is for the first window (not the second).
> > I guess I could look at the current window configuration and double the
> > current Y if the window is split in half....
> > Kind of hacky but could work for a proof of concept.
> > Kevin
> >
> > On Sun, Dec 28, 2008 at 9:31 AM, Lennart Borgman <
> lennart.borgman@gmail.com>
> > wrote:
> >>
> >> On Sun, Dec 28, 2008 at 6:20 PM, Kevin Burton <burton@spinn3r.com>
> wrote:
> >> > In the predictive package?
> >> > I think one just needs to compute the left-margin width.
> >>
> >> Here is what I have. There is indeed a problem with the left margin.
> >> What change do you propose?
> >>
> >> (defun point-to-coord (point)
> >>  "Return coordinates of POINT in selected window.
> >> The coordinates are in the form \(\(XOFFSET YOFFSET) WINDOW).
> >> This form is suitable for `popup-menu'."
> >>  ;; Fix-me: showtip.el adds (window-inside-pixel-edges
> >>  ;; (selected-window)). Why?
> >>  (let* ((pn (posn-at-point point))
> >>         (x-y (posn-x-y pn))
> >>         (x (car x-y))
> >>         (y (cdr x-y))
> >>         (pos (list (list x (+ y 20)) (selected-window))))
> >>    pos))
> >>
> >> > I wrote a tooltip-at-point package a few years ago (but never got it t
> >> > work
> >> > reliably) and added this into the mix....
> >> > Kevin
> >> >
> >> > On Sun, Dec 28, 2008 at 9:14 AM, Lennart Borgman
> >> > <lennart.borgman@gmail.com>
> >> > wrote:
> >> >>
> >> >> On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org>
> wrote:
> >> >> > Kevin Burton wrote:
> >> >> >>
> >> >> >> You mean by specifying top and left?  I think that is what I was
> >> >> >> going
> >> >> >> to
> >> >> >> do to position the tooltip but first I need to find out the x/y of
> >> >> >> the
> >> >> >> current point.
> >> >> >
> >> >> > (posn-at-point &optional POS WINDOW)
> >> >>
> >> >> I think there is a bug with left margin. (Though I have not had time
> >> >> to submit a bug report for this.)
> >
> >
> >
> > --
> > Founder/CEO Spinn3r.com
> > Location: San Francisco, CA
> > AIM/YIM: sfburtonator
> > Skype: burtonator
> > Work: http://spinn3r.com
> >
>



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

[-- Attachment #2: Type: text/html, Size: 4482 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-29  2:33                 ` Kevin Burton
@ 2008-12-29  2:36                   ` Lennart Borgman
  2008-12-29  2:41                     ` Kevin Burton
  0 siblings, 1 reply; 19+ messages in thread
From: Lennart Borgman @ 2008-12-29  2:36 UTC (permalink / raw)
  To: Kevin Burton; +Cc: Chong Yidong, emacs-devel, Jason Rumney

GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600) of 2008-12-26  - ie w32


On Mon, Dec 29, 2008 at 3:33 AM, Kevin Burton <burton@spinn3r.com> wrote:
> What platform are you on?  What's your emacs-version?
> Mine is:
> GNU Emacs 22.3.2 (i386-apple-darwin9.5.0, Carbon Version 1.6.0) of
> 2008-09-21 on plume.sr.unh.edu - Aquamacs Distribution 1.5
>
> On Sun, Dec 28, 2008 at 6:14 PM, Lennart Borgman <lennart.borgman@gmail.com>
> 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 use this in nXhtml where it used for popup menus for completion in
>> XHTML. If you want to it is easy to test there.
>>
>>
>> On Mon, Dec 29, 2008 at 3:05 AM, Kevin Burton <burton@spinn3r.com> wrote:
>> > Yes..... this DOES work but for a window that's not split.... as soon as
>> > you
>> > split the window the coord is for the first window (not the second).
>> > I guess I could look at the current window configuration and double the
>> > current Y if the window is split in half....
>> > Kind of hacky but could work for a proof of concept.
>> > Kevin
>> >
>> > On Sun, Dec 28, 2008 at 9:31 AM, Lennart Borgman
>> > <lennart.borgman@gmail.com>
>> > wrote:
>> >>
>> >> On Sun, Dec 28, 2008 at 6:20 PM, Kevin Burton <burton@spinn3r.com>
>> >> wrote:
>> >> > In the predictive package?
>> >> > I think one just needs to compute the left-margin width.
>> >>
>> >> Here is what I have. There is indeed a problem with the left margin.
>> >> What change do you propose?
>> >>
>> >> (defun point-to-coord (point)
>> >>  "Return coordinates of POINT in selected window.
>> >> The coordinates are in the form \(\(XOFFSET YOFFSET) WINDOW).
>> >> This form is suitable for `popup-menu'."
>> >>  ;; Fix-me: showtip.el adds (window-inside-pixel-edges
>> >>  ;; (selected-window)). Why?
>> >>  (let* ((pn (posn-at-point point))
>> >>         (x-y (posn-x-y pn))
>> >>         (x (car x-y))
>> >>         (y (cdr x-y))
>> >>         (pos (list (list x (+ y 20)) (selected-window))))
>> >>    pos))
>> >>
>> >> > I wrote a tooltip-at-point package a few years ago (but never got it
>> >> > t
>> >> > work
>> >> > reliably) and added this into the mix....
>> >> > Kevin
>> >> >
>> >> > On Sun, Dec 28, 2008 at 9:14 AM, Lennart Borgman
>> >> > <lennart.borgman@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org>
>> >> >> wrote:
>> >> >> > Kevin Burton wrote:
>> >> >> >>
>> >> >> >> You mean by specifying top and left?  I think that is what I was
>> >> >> >> going
>> >> >> >> to
>> >> >> >> do to position the tooltip but first I need to find out the x/y
>> >> >> >> of
>> >> >> >> the
>> >> >> >> current point.
>> >> >> >
>> >> >> > (posn-at-point &optional POS WINDOW)
>> >> >>
>> >> >> I think there is a bug with left margin. (Though I have not had time
>> >> >> to submit a bug report for this.)
>> >
>> >
>> >
>> > --
>> > Founder/CEO Spinn3r.com
>> > Location: San Francisco, CA
>> > AIM/YIM: sfburtonator
>> > Skype: burtonator
>> > Work: http://spinn3r.com
>> >
>
>
>
> --
> Founder/CEO Spinn3r.com
> Location: San Francisco, CA
> AIM/YIM: sfburtonator
> Skype: burtonator
> Work: http://spinn3r.com
>




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-29  2:36                   ` Lennart Borgman
@ 2008-12-29  2:41                     ` Kevin Burton
  0 siblings, 0 replies; 19+ messages in thread
From: Kevin Burton @ 2008-12-29  2:41 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Chong Yidong, emacs-devel, Jason Rumney

[-- Attachment #1: Type: text/plain, Size: 3792 bytes --]

Hm..... that's interesting.  So hopefully this is fixed in 23..... I can
implement a hack for 22 and then disable it under 23...
Kevin

On Sun, Dec 28, 2008 at 6:36 PM, Lennart Borgman
<lennart.borgman@gmail.com>wrote:

> GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600) of 2008-12-26  - ie w32
>
>
> On Mon, Dec 29, 2008 at 3:33 AM, Kevin Burton <burton@spinn3r.com> wrote:
> > What platform are you on?  What's your emacs-version?
> > Mine is:
> > GNU Emacs 22.3.2 (i386-apple-darwin9.5.0, Carbon Version 1.6.0) of
> > 2008-09-21 on plume.sr.unh.edu - Aquamacs Distribution 1.5
> >
> > On Sun, Dec 28, 2008 at 6:14 PM, Lennart Borgman <
> lennart.borgman@gmail.com>
> > 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 use this in nXhtml where it used for popup menus for completion in
> >> XHTML. If you want to it is easy to test there.
> >>
> >>
> >> On Mon, Dec 29, 2008 at 3:05 AM, Kevin Burton <burton@spinn3r.com>
> wrote:
> >> > Yes..... this DOES work but for a window that's not split.... as soon
> as
> >> > you
> >> > split the window the coord is for the first window (not the second).
> >> > I guess I could look at the current window configuration and double
> the
> >> > current Y if the window is split in half....
> >> > Kind of hacky but could work for a proof of concept.
> >> > Kevin
> >> >
> >> > On Sun, Dec 28, 2008 at 9:31 AM, Lennart Borgman
> >> > <lennart.borgman@gmail.com>
> >> > wrote:
> >> >>
> >> >> On Sun, Dec 28, 2008 at 6:20 PM, Kevin Burton <burton@spinn3r.com>
> >> >> wrote:
> >> >> > In the predictive package?
> >> >> > I think one just needs to compute the left-margin width.
> >> >>
> >> >> Here is what I have. There is indeed a problem with the left margin.
> >> >> What change do you propose?
> >> >>
> >> >> (defun point-to-coord (point)
> >> >>  "Return coordinates of POINT in selected window.
> >> >> The coordinates are in the form \(\(XOFFSET YOFFSET) WINDOW).
> >> >> This form is suitable for `popup-menu'."
> >> >>  ;; Fix-me: showtip.el adds (window-inside-pixel-edges
> >> >>  ;; (selected-window)). Why?
> >> >>  (let* ((pn (posn-at-point point))
> >> >>         (x-y (posn-x-y pn))
> >> >>         (x (car x-y))
> >> >>         (y (cdr x-y))
> >> >>         (pos (list (list x (+ y 20)) (selected-window))))
> >> >>    pos))
> >> >>
> >> >> > I wrote a tooltip-at-point package a few years ago (but never got
> it
> >> >> > t
> >> >> > work
> >> >> > reliably) and added this into the mix....
> >> >> > Kevin
> >> >> >
> >> >> > On Sun, Dec 28, 2008 at 9:14 AM, Lennart Borgman
> >> >> > <lennart.borgman@gmail.com>
> >> >> > wrote:
> >> >> >>
> >> >> >> On Sun, Dec 28, 2008 at 10:53 AM, Jason Rumney <jasonr@gnu.org>
> >> >> >> wrote:
> >> >> >> > Kevin Burton wrote:
> >> >> >> >>
> >> >> >> >> You mean by specifying top and left?  I think that is what I
> was
> >> >> >> >> going
> >> >> >> >> to
> >> >> >> >> do to position the tooltip but first I need to find out the x/y
> >> >> >> >> of
> >> >> >> >> the
> >> >> >> >> current point.
> >> >> >> >
> >> >> >> > (posn-at-point &optional POS WINDOW)
> >> >> >>
> >> >> >> I think there is a bug with left margin. (Though I have not had
> time
> >> >> >> to submit a bug report for this.)
> >> >
> >> >
> >> >
> >> > --
> >> > Founder/CEO Spinn3r.com
> >> > Location: San Francisco, CA
> >> > AIM/YIM: sfburtonator
> >> > Skype: burtonator
> >> > Work: http://spinn3r.com
> >> >
> >
> >
> >
> > --
> > Founder/CEO Spinn3r.com
> > Location: San Francisco, CA
> > AIM/YIM: sfburtonator
> > Skype: burtonator
> > Work: http://spinn3r.com
> >
>



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

[-- Attachment #2: Type: text/html, Size: 6069 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-29  2:14               ` Lennart Borgman
  2008-12-29  2:33                 ` Kevin Burton
@ 2008-12-29  3:31                 ` Jason Rumney
  2008-12-29  9:52                   ` Lennart Borgman
  1 sibling, 1 reply; 19+ messages in thread
From: Jason Rumney @ 2008-12-29  3:31 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Kevin Burton, Chong Yidong, emacs-devel

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?





^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-29  3:31                 ` Jason Rumney
@ 2008-12-29  9:52                   ` Lennart Borgman
  2008-12-29 18:52                     ` Kevin Burton
  0 siblings, 1 reply; 19+ messages in thread
From: Lennart Borgman @ 2008-12-29  9:52 UTC (permalink / raw)
  To: Jason Rumney; +Cc: Kevin Burton, Chong Yidong, emacs-devel

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.




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Possible to show tooltip at (point) ????
  2008-12-29  9:52                   ` Lennart Borgman
@ 2008-12-29 18:52                     ` Kevin Burton
  0 siblings, 0 replies; 19+ messages in thread
From: Kevin Burton @ 2008-12-29 18:52 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Chong Yidong, emacs-devel, Jason Rumney

[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3569 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2008-12-29 18:52 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-28  6:48 Possible to show tooltip at (point) ???? Kevin Burton
2008-12-28  6:55 ` Lennart Borgman
2008-12-28  9:05 ` Chong Yidong
2008-12-28  9:24   ` Kevin Burton
2008-12-28  9:53     ` Jason Rumney
2008-12-28 17:14       ` Lennart Borgman
2008-12-28 17:20         ` Kevin Burton
2008-12-28 17:31           ` Lennart Borgman
2008-12-28 17:38             ` Kevin Burton
2008-12-29  2:05             ` Kevin Burton
2008-12-29  2:14               ` Lennart Borgman
2008-12-29  2:33                 ` Kevin Burton
2008-12-29  2:36                   ` Lennart Borgman
2008-12-29  2:41                     ` Kevin Burton
2008-12-29  3:31                 ` Jason Rumney
2008-12-29  9:52                   ` Lennart Borgman
2008-12-29 18:52                     ` Kevin Burton
2008-12-28 17:07 ` Mathias Dahl
2008-12-28 17:14   ` Kevin Burton

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).