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