all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jared Finder 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: stephen.berman@gmx.net, 67457@debbugs.gnu.org,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	visuweshm@gmail.com
Subject: bug#67457: 29.1; Error when dragging mode line in terminal
Date: Thu, 07 Dec 2023 14:35:57 -0800	[thread overview]
Message-ID: <69323e0e78afbf4b8c212f156c6af6d8@finder.org> (raw)
In-Reply-To: <d69d32091de8ffb9fa576b226091f6bc@finder.org>

Leaving this as one email so both changes are easy to follow.  I believe 
both patches are valuable to apply.

On 2023-12-06 15:55, Jared Finder wrote:
> On 2023-11-27 08:34, Eli Zaretskii wrote:
>>> Date: Mon, 27 Nov 2023 07:16:34 -0800
>>> From: Jared Finder <jared@finder.org>
>>> Cc: stephen.berman@gmx.net, visuweshm@gmail.com, 
>>> 67457@debbugs.gnu.org
>>> 
>>> >> 1. My original patch is likely inaccurate.  A better fix would be to
>>> >> align the mouse-movement event with how it is emitted under GPM and
>>> >> DOS.
>>> >>   I will investigate.

And I have a better patch here.  The real issue is that xt-mouse 
generated mouse-movement events were getting prefixed with mode-line or 
tab-line symbols but other mouse-movement events were not.  The 
following simple change fixes that:

--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -63,9 +63,14 @@ xterm-mouse-translate-1
            (is-move (eq 'mouse-movement ev-command))
            (is-down (string-match "down-" (symbol-name ev-command))))

-      ;; Mouse events symbols must have an 'event-kind property with
-      ;; the value 'mouse-click.
-      (when ev-command (put ev-command 'event-kind 'mouse-click))
+      ;; Mouse events symbols must have an 'event-kind property set.
+      ;; Most of them use the value 'mouse-click, but 'mouse-movement
+      ;; has a different value.  See head_table in
+      ;; keyboard.c. (bug#67457)
+      (when ev-command (put ev-command 'event-kind
+                            (if (eq ev-command 'mouse-movement)
+                                'mouse-movement
+                              'mouse-click)))

>>> >>
>>> >> 2. Something broke with how GPM mouse mode is enabled between Emacs
>>> >> 28.2
>>> >> and HEAD.  I can help with a bisect here.
>>> >
>>> > Thanks, please do, on both counts.
>>> 
>>> Bisect identified the following commit as the bad commit, confirmed
>>> locally:
>>> 
>>> jared@debian:^/emacs-devel$ git bisect bad
>>> a28ede3a61a70cf83dfcba6c9d314fbb051a3a94 is the first bad commit
>>> commit a28ede3a61a70cf83dfcba6c9d314fbb051a3a94
>>> Author: Stefan Monnier <monnier@iro.umontreal.ca>
>>> Date:
>>> t-mouse.el: Make sure we apply the setting to new terminals
>>> * lisp/t-mouse.el (gpm-mouse-tty-setup): New function.
>>> (gpm-mouse-mode): Use it as well as 'tty-setup-hook".
>>> * lisp/term/linux.el (terminal-init-linux): Remove gpm-specific code,
>>> not neded any more.
>>> lisp/t-mouse.el
>>> lisp/term/linux.el | 2 --
>> 
>> Thanks, adding Stefan to the discussion.
> 
> Following up on #2:  The issue here is that after a28ede, 
> gpm-mouse-tty-setup is never added to tty-setup-hook since it is only 
> added within gpm-mouse-mode. This is clearly visible by checking the 
> value of tty-setup-hook at startup, and after toggling gpm-mouse-mode 
> off and on again.
> 
> The following simple patch fixes that, while leaving the details of how 
> gpm-mouse-mode works an internal detail:
> 
> --- a/lisp/term/linux.el
> +++ b/lisp/term/linux.el
> @@ -13,6 +13,9 @@ terminal-init-linux
>   ;; Compositions confuse cursor movement.
>   (setq-default auto-composition-mode "linux")
> 
> + ;; Ensure additional terminal setup is done when `gpm-mouse-mode' is 
> enabled.
> + (ignore-errors (when gpm-mouse-mode (gpm-mouse-mode 1)))
> +
>   ;; Don't translate ESC TAB to backtab as directed by ncurses-6.3.
>   (define-key input-decode-map "\e\t" nil)
> 
> One could also just revert just the linux.el changes in a28ede, though 
> that assumes that gpm-mouse-enable exists.
> 
>   -- MJF





  reply	other threads:[~2023-12-07 22:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-26 17:31 bug#67457: 29.1; Error when dragging mode line in terminal Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-26 18:03 ` Eli Zaretskii
2023-11-26 18:09   ` Visuwesh
2023-11-26 18:19     ` Eli Zaretskii
2023-11-26 22:08       ` Stephen Berman
2023-11-27  0:24         ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-27  9:05           ` Stephen Berman
2023-11-27 12:37           ` Eli Zaretskii
2023-11-27 15:16             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-27 16:34               ` Eli Zaretskii
2023-12-06 23:55                 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-07 22:35                   ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-12-08 16:18                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-09  8:19                     ` Eli Zaretskii

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=69323e0e78afbf4b8c212f156c6af6d8@finder.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=67457@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jared@finder.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=stephen.berman@gmx.net \
    --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 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.