emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Support routines for popup menus


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

I just noticed that a library in Emacs opened a popup menu in such a way that the line it should give information about was hided. I think I have forgotten to send the two routines below which simplifies poping up menus alined to the point. Could they (or something similar) please be added to Emacs?

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]