unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Please add point-to-coord to Emacs 23
@ 2008-09-25 21:40 Lennart Borgman (gmail)
  2008-09-25 23:02 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-25 21:40 UTC (permalink / raw)
  To: Emacs Devel

I have several times asked if not a function like the one below could be
added to Emacs. Here is my request again.

Even if it is not added could someone perhaps explain how to change it
so that it works when left margin is non-zero?


(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'."
  (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))




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

* Re: Please add point-to-coord to Emacs 23
  2008-09-25 21:40 Please add point-to-coord to Emacs 23 Lennart Borgman (gmail)
@ 2008-09-25 23:02 ` Lennart Borgman (gmail)
  2008-09-26  1:34   ` Miles Bader
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-25 23:02 UTC (permalink / raw)
  To: Emacs Devel

Lennart Borgman (gmail) wrote:
> I have several times asked if not a function like the one below could be
> added to Emacs. Here is my request again.
> 
> Even if it is not added could someone perhaps explain how to change it
> so that it works when left margin is non-zero?

It looks like a bug in posn-at-point to me, but I am not sure.

> (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'."
>   (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))
> 
> 
> 




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

* Re: Please add point-to-coord to Emacs 23
  2008-09-25 23:02 ` Lennart Borgman (gmail)
@ 2008-09-26  1:34   ` Miles Bader
  0 siblings, 0 replies; 3+ messages in thread
From: Miles Bader @ 2008-09-26  1:34 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: Emacs Devel

"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>> Even if it is not added could someone perhaps explain how to change it
>> so that it works when left margin is non-zero?
>
> It looks like a bug in posn-at-point to me, but I am not sure.
>
>> (defun point-to-coord (point)
>>   "Return coordinates of POINT in selected window.

Let's stop using the term "-at-point" or "point-to-" for functions which
actually take an arbitrary position....

-Miles

-- 
Barometer, n. An ingenious instrument which indicates what kind of weather we
are having.




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

end of thread, other threads:[~2008-09-26  1:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-25 21:40 Please add point-to-coord to Emacs 23 Lennart Borgman (gmail)
2008-09-25 23:02 ` Lennart Borgman (gmail)
2008-09-26  1:34   ` Miles Bader

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).