branch: elpa/prop-menu
commit 2b0de81cdebab563a053026056b558bebfd98bce
Author: David Raymond Christiansen <da...@davidchristiansen.dk>
Commit: David Raymond Christiansen <da...@davidchristiansen.dk>

    Get properties from correct window on click
    
    Now, text properties for the mouse menu are computed for the correct
    window when clicking. Previously, the mouse menu only worked when the
    clicked window was already focused.
---
 prop-menu.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/prop-menu.el b/prop-menu.el
index 69b88a4..bb92a2e 100644
--- a/prop-menu.el
+++ b/prop-menu.el
@@ -5,7 +5,7 @@
 ;; Author: David Christiansen <da...@davidchristiansen.dk>
 ;; URL: https://github.com/david-christiansen/prop-menu-el
 ;; Package-Requires:  ((emacs "24") (cl-lib "0.5"))
-;; Version: 0.1
+;; Version: 0.1.1
 ;; Keywords: convenience
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -95,10 +95,13 @@ When called interactively, WHERE defaults to point."
 When calling `prop-menu-item-functions', point is at the clicked
 location."
   (interactive "e")
-  (let* ((where (posn-point (event-end click)))
-         (menu-items (save-excursion
-                       (goto-char where)
-                       (prop-menu--items-for-location where))))
+  (let* ((window (posn-window (event-end click)))
+         (buffer (window-buffer window))
+         (where (posn-point (event-end click)))
+         (menu-items (with-current-buffer buffer
+                       (save-excursion
+                         (goto-char where)
+                         (prop-menu--items-for-location where)))))
     (when menu-items
       (let* ((menu (make-sparse-keymap))
              (todo (cl-loop for (str action) in menu-items

Reply via email to