|
From: | Lennart Borgman (gmail) |
Subject: | Support routines for popup menus |
Date: | Mon, 03 Dec 2007 01:50:36 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
(defun point-to-coord (point) "Return coordinates of point in selected window. The coordinates are in the form \(\(XOFFSET YOFFSET) WINDOW)." (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)) (defun popup-menu-at-point (menu &optional prefix) "Popup the given menu at point. This is similar to `popup-menu' and MENU and PREFIX has the same meaning as there. The position for the popup is however where the window point is." (let ((where (point-to-coord (point)))) (popup-menu menu where prefix)))
[Prev in Thread] | Current Thread | [Next in Thread] |