emacs-devel
[Top][All Lists]
Advanced

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

Re: master 128ed5c9f17: Add one more mouse-set-point call to functions x


From: Juri Linkov
Subject: Re: master 128ed5c9f17: Add one more mouse-set-point call to functions xref-find-*-at-mouse
Date: Sun, 03 Sep 2023 20:34:55 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> Mind however that many of these commands are also meant to operate from
>> the mode line lighters, in which case this is precisely the desired
>> behavior.
>
> I see that such events show they originate from 'mode-line',
> and events from the menu bar contain 'menu-bar'.  So maybe
> it would be sufficient to filter out 'mode-line' and 'menu-bar'.

Instead of checking 'posn-area', much simpler would be to implement this
only for the context-menu with a new option similar to 'mouse-yank-at-point'.

Any objections to enabling this by default?

```
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 49549093985..48a3ab1acd3 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -407,6 +407,11 @@ context-menu-filter-function
   :type '(choice (const nil) function)
   :version "28.1")
 
+(defcustom context-menu-move-point nil
+  "If non-nil, move point to the mouse click before opening context menu."
+  :type 'boolean
+  :version "30.1")
+
 (defun context-menu-map (&optional click)
   "Return menu map constructed for context near mouse CLICK.
 The menu is populated by calling functions from `context-menu-functions'.
@@ -426,6 +431,9 @@ context-menu-map
     (unless (eq (selected-window) window)
       (select-window window))
 
+    (when context-menu-move-point
+      (goto-char (posn-point (event-start click))))
+
     (if (functionp fun)
         (setq menu (funcall fun menu click))
       (run-hook-wrapped 'context-menu-functions
```



reply via email to

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