GNU bug report logs - #75219
31.0.50; mouse-2 mode-line binding overridden by mouse-1-click-follows-link

Previous Next

Package: emacs;

Reported by: Visuwesh <visuweshm <at> gmail.com>

Date: Tue, 31 Dec 2024 05:40:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 75219 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 75219 <at> debbugs.gnu.org, Visuwesh <visuweshm <at> gmail.com>
Subject: Re: 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
> 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);





This bug report was last modified 186 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.