From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <87o70sbegu.fsf@gmail.com> <86zfk570iu.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23278"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 75219@debbugs.gnu.org, Visuwesh To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 05 19:12:21 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tUV6q-0005uQ-KM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 05 Jan 2025 19:12:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tUV6a-00022p-Do; Sun, 05 Jan 2025 13:12:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUV6Y-00022e-VE for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 13:12:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tUV6Y-0002CM-Gt for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 13:12:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=1N4SJKwKc3SPqG4TSq5ru2tgCk0s80/4rqcu1MHBYS4=; b=kRiCWjvSxjEwteWHRBsHzA0yihuAWGeTQ0vUCUHhHjJ1MdmpDYcEyeYjcpmLetRSW9iAK41DoGMFnQy9W37z09HuDgYjXvj6l6QqPGRt2wukV8xN0USxPnAEeE6405EhCIDPQu34jTd3C0d/lUYLuVB1ZH6t4G8HxHYnEYapnCirHor0FzakSp24D4SuGre6nNr0aFZKhVHLedT/VpW2xCT81VqNJoKhoJBVH5Xw8wfStbxdwrtWBYiY5Vga2LhYLcoZMwUgJFDSZrkp2TYgvwmceaMZIA/ak31z8o6w00OEmp0sa0ljT5nXE8eNFYpl5/STYoBqDS8BQB6nATkMIw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tUV6Y-0000qK-Al for bug-gnu-emacs@gnu.org; Sun, 05 Jan 2025 13:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Jan 2025 18:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75219 X-GNU-PR-Package: emacs Original-Received: via spool by 75219-submit@debbugs.gnu.org id=B75219.17361006693149 (code B ref 75219); Sun, 05 Jan 2025 18:12:02 +0000 Original-Received: (at 75219) by debbugs.gnu.org; 5 Jan 2025 18:11:09 +0000 Original-Received: from localhost ([127.0.0.1]:35119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUV5g-0000oi-KB for submit@debbugs.gnu.org; Sun, 05 Jan 2025 13:11:09 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:63087) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUV5c-0000o7-8P for 75219@debbugs.gnu.org; Sun, 05 Jan 2025 13:11:07 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A2CEC44107B; Sun, 5 Jan 2025 13:10:57 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1736100652; bh=ixECbVStOR0x51Sr1kgcAFr5W6fZuMvSgw82x5/tH8Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=oEHRBvwRV4TR24Uvq0BGw1+Ay8+sLeK+YWWJ+53EEgexooAaphcJom0ryjnNLsJOe rIzOcQlTwTRwJ3K/VN/m4dJI9Zb+WWUHwVW+lFtVsSzJIwF1ZYgbz8Bmw2Ahukbre0 8lWJ5usphb2blmMa9tU1+UtC7ojKH5gV+xPuVUadHsgosSKVO9dxLgvyznNw8uqFZ0 A81OgxWAQYLYMpnXHVlbUAucR5yVoynXaycQbBpQl33k5lfOD/xBWLEII0xVCJZAd8 YlxkogngEGWRjL3E2MSmMCv1dm5TlEAc1YGN3Wpx0jLJJVmZiaBfvp03vpXHpHJPrI oBiL5HQz+Wwtg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4347B441482; Sun, 5 Jan 2025 13:10:52 -0500 (EST) Original-Received: from alfajor (unknown [104.195.230.250]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 105BF120478; Sun, 5 Jan 2025 13:10:52 -0500 (EST) In-Reply-To: <86zfk570iu.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 05 Jan 2025 17:17:45 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298581 Archived-At: > 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 =3D 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 =3D get_local_map (pt, current_buffer, Qlocal= _map); > /* This returns nil unless there is a `keymap' property. */ > Lisp_Object keymap =3D get_local_map (pt, current_buffer, Qkeymap); > Lisp_Object otlp =3D KVAR (current_kboard, Voverriding_terminal_loc= al_map); > > and click_position does this: > > static ptrdiff_t > click_position (Lisp_Object position) > { > EMACS_INT pos =3D (FIXNUMP (position) ? XFIXNUM (position) > : MARKERP (position) ? marker_position (position) > : PT); > if (! (BEGV <=3D pos && pos <=3D 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. =F0=9F=99=81 > 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 =3D (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 <=3D pos && pos <=3D ZV)) args_out_of_range (Fcurrent_buffer (), position);