emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109167: * lisp/term/x-win.el (x-menu


From: martin rudalics
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109167: * lisp/term/x-win.el (x-menu-bar-open): Use `frame-parameter'
Date: Wed, 25 Jul 2012 16:14:15 +0200

This change

revno: 109167
author: Masatake YAMATO <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2012-07-20 07:32:30 -0400
message:
  * lisp/term/x-win.el (x-menu-bar-open): Use `frame-parameter'
  to check whether menu-bar is shown or not.  If not shown,
  show the menu-bar as a popup menu instead of using tmm.
  * lisp/mouse.el (popup-menu): Accept `point' as `position' argument.
modified:
  lisp/ChangeLog
  lisp/mouse.el
  lisp/term/x-win.el

[...]

=== modified file 'lisp/mouse.el'
--- a/lisp/mouse.el     2012-07-08 08:26:21 +0000
+++ b/lisp/mouse.el     2012-07-20 11:32:30 +0000
@@ -102,7 +102,8 @@
 MENU can be a keymap, an easymenu-style menu or a list of keymaps as for
 `x-popup-menu'.
 POSITION can be a click event or ((XOFFSET YOFFSET) WINDOW) and defaults to
-  the current mouse position.
+  the current mouse position. If POSITION is a symbol, `point' the current
point
+position is used.
 PREFIX is the prefix argument (if any) to pass to the command."
   (let* ((map (cond
               ((keymapp menu) menu)
@@ -112,9 +113,17 @@
                                   (plist-get (get map 'menu-prop) :filter))))
                    (if filter (funcall filter (symbol-function map)) map)))))
         event cmd)
-    (unless position
-      (let ((mp (mouse-pixel-position)))
-       (setq position (list (list (cadr mp) (cddr mp)) (car mp)))))
+  (setq position
+       (cond
+        ((eq position 'point)
+         (let* ((pp (posn-at-point pos window))
+                 (xy (posn-x-y pp)))
+           (list (list (car xy) (cdr xy)) (posn-window pp))))
+        ((not position)
+         (let ((mp (mouse-pixel-position)))
+           (list (list (cadr mp) (cddr mp)) (car mp))))
+        (t
+         position)))
     ;; The looping behavior was taken from lmenu's popup-menu-popup
     (while (and map (setq event

gets me, when byte-compiling mouse.el,

In popup-menu:
mouse.el:119:37:Warning: reference to free variable `pos'
mouse.el:119:41:Warning: reference to free variable `window'

What is the idea of this change?

martin



reply via email to

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