unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 75219@debbugs.gnu.org, Visuwesh <visuweshm@gmail.com>
Subject: bug#75219: 31.0.50; mouse-2 mode-line binding overridden by mouse-1-click-follows-link
Date: Sun, 05 Jan 2025 13:10:45 -0500	[thread overview]
Message-ID: <jwvy0zpgmlz.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86zfk570iu.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 05 Jan 2025 17:17:45 +0200")

> The reason why key-binding considers the local keymap at point is this
> part of current-active-maps (which key-binding calls):
>
>       ptrdiff_t pt = click_position (position);  <<<<<<<<<<<<<<<<<<<<<
>       /* This usually returns the buffer's local map,
> 	 but that can be overridden by a `local-map' property.  */
>       Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map);
>       /* This returns nil unless there is a `keymap' property.  */
>       Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap);
>       Lisp_Object otlp = KVAR (current_kboard, Voverriding_terminal_local_map);
>
> and click_position does this:
>
>   static ptrdiff_t
>   click_position (Lisp_Object position)
>   {
>     EMACS_INT pos = (FIXNUMP (position) ? XFIXNUM (position)
> 		     : MARKERP (position) ? marker_position (position)
> 		     : PT);
>     if (! (BEGV <= pos && pos <= ZV))
>       args_out_of_range (Fcurrent_buffer (), position);
>     return pos;
>   }
>
> So if POSITION is a mouse click event, click_position will always
> return the position of point.

Yeah, we pay attention to the "window" part of the posn but not the
rest.  🙁

> Stefan, any ideas or suggestions?

Maybe something like the patch below, but maybe we should call
`posn-point` instead?


        Stefan


diff --git a/src/keymap.c b/src/keymap.c
index e3461243cdd..7393495b41a 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1659,6 +1659,10 @@ click_position (Lisp_Object position)
 {
   EMACS_INT pos = (FIXNUMP (position) ? XFIXNUM (position)
 		   : MARKERP (position) ? marker_position (position)
+		       /* FIXME: POSN_POSN seems to be less thorough
+		          than `posn-point'! */
+		   : CONSP (position) && INTEGERP (POSN_POSN (position))
+		     ?  POSN_POSN (position)
 		   : PT);
   if (! (BEGV <= pos && pos <= ZV))
     args_out_of_range (Fcurrent_buffer (), position);






  reply	other threads:[~2025-01-05 18:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-31  5:37 bug#75219: 31.0.50; mouse-2 mode-line binding overridden by mouse-1-click-follows-link Visuwesh
2025-01-05 15:17 ` Eli Zaretskii
2025-01-05 18:10   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2025-01-05 18:51     ` Eli Zaretskii
2025-01-05 21:51       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-07 18:57         ` Eli Zaretskii
2025-01-11 10:46           ` Eli Zaretskii
2025-01-11 15:11           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-11 15:40             ` Eli Zaretskii
2025-01-11 16:03               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-12  6:26                 ` Eli Zaretskii
2025-01-13 10:42                   ` Visuwesh

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvy0zpgmlz.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=75219@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=visuweshm@gmail.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).