all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Po Lu <luangruo@yahoo.com>
Cc: Dmitry Gutov <dmitry@gutov.dev>,  emacs-devel@gnu.org
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	[thread overview]
Message-ID: <8634zv7cyg.fsf@mail.linkov.net> (raw)
In-Reply-To: <86o7imidzk.fsf@mail.linkov.net> (Juri Linkov's message of "Fri,  01 Sep 2023 09:50:23 +0300")

>> 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	other threads:[~2023-09-03 17:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <169344150641.11482.13012085201452768898@vcs2.savannah.gnu.org>
     [not found] ` <20230831002506.C0C6DC038B5@vcs2.savannah.gnu.org>
2023-08-31  0:43   ` master 128ed5c9f17: Add one more mouse-set-point call to functions xref-find-*-at-mouse Po Lu
2023-08-31  0:54     ` Dmitry Gutov
2023-08-31  1:10       ` Po Lu
2023-08-31  2:05         ` Dmitry Gutov
2023-08-31  2:51           ` Po Lu
2023-08-31  6:37             ` Juri Linkov
2023-09-01  0:59               ` Po Lu
2023-09-01  6:50                 ` Juri Linkov
2023-09-03 17:34                   ` Juri Linkov [this message]
2023-09-04 16:42                     ` Juri Linkov
2023-08-31 11:03             ` Dmitry Gutov
2023-08-31 11:35               ` Po Lu
2023-08-31 16:38               ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8634zv7cyg.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=dmitry@gutov.dev \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.