emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/prop-menu 632ac43 4/9: Execute property-getting functions


From: ELPA Syncer
Subject: [nongnu] elpa/prop-menu 632ac43 4/9: Execute property-getting functions with point at click location
Date: Sun, 29 Aug 2021 11:29:15 -0400 (EDT)

branch: elpa/prop-menu
commit 632ac43b7bc3acd8aade1b1487ca31702b4118c5
Author: David Raymond Christiansen <david@davidchristiansen.dk>
Commit: David Raymond Christiansen <david@davidchristiansen.dk>

    Execute property-getting functions with point at click location
---
 prop-menu.el | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/prop-menu.el b/prop-menu.el
index 8d47875..69b88a4 100644
--- a/prop-menu.el
+++ b/prop-menu.el
@@ -82,17 +82,23 @@ this variable with appropriate functions.")
 
 When called interactively, WHERE defaults to point."
   (interactive "d")
-  (let* ((menu-items (prop-menu--items-for-location where))
-         (selection (completing-read "Command: " menu-items nil t)))
-    (when selection
-      (let ((cmd (assoc selection menu-items)))
-        (when cmd (funcall (cadr cmd)))))))
+  (let ((menu-items (prop-menu--items-for-location where)))
+    (when menu-items
+      (let ((selection (completing-read "Command: " menu-items nil t)))
+        (when selection
+          (let ((cmd (assoc selection menu-items)))
+            (when cmd (funcall (cadr cmd)))))))))
 
 (defun prop-menu-show-menu (click)
-  "Show a menu based on the location of CLICK, computed from the value of 
`prop-menu-item-functions'."
+  "Show a menu based on the location of CLICK, computed from the value of 
`prop-menu-item-functions'.
+
+When calling `prop-menu-item-functions', point is at the clicked
+location."
   (interactive "e")
   (let* ((where (posn-point (event-end click)))
-         (menu-items (prop-menu--items-for-location where)))
+         (menu-items (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

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