On windows gnu emacs (~21.3) this code will return the pixel-position of the current point! (or at least, within a few pixels) Returns values in form (x . y).
I wanted this feature and couldn't find it... all I found were posts in lists also asking for the feature, with people denying it could be done in elisp. Well, that is not true! ;) I believe this should work in Xemacs and on other operating systems and recent emacs versions. I am currently using it to display an "intellisense"-like tooltip. Which, on windows, gnu emacs has no tooltip, so I am executing a little python app instead which handles the tooltip for me (via wx libraries). Works very nice. ; helper func (defun get-param-safe (s) "Sometimes frame-paramater returns values of (+ -4)" (let ((left (frame-parameter nil s))) (if (listp left) (cadr left) left))) ; this is it (defun point-to-pixel () "Converts the position of the current point to pixel coordinates relative to the screen (i.e. window manager)." (let ((left (car (window-edges))) (top (cadr (window-edges))) (point-left (- (point) (point-at-bol))) (point-top (point))) (let ((x (+ (* (frame-char-width) left) ; x = (* (frame-char-width) point-left) (get-param-safe 'left))) (y (+ (* (frame-char-height) ; y = (+ top (count-lines (window-start) (point)))) (get-param-safe 'top)))) (cons x y)))) _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs