unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jared Finder <jared@finder.org>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Re: master 9ccd459e845: Enable xterm-mouse-mode by default in xterm
Date: Fri, 13 Dec 2024 21:03:59 -0800	[thread overview]
Message-ID: <f0e5ba95e531996c4bec8bd8513c2f11@finder.org> (raw)
In-Reply-To: <87wmg49dtr.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]

On 2024-12-13 00:39, Michael Albinus wrote:
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> Hi,
> 
>> branch: master
>> commit 9ccd459e8452cc9e6e81e53f26bbeef20d2d5bb7
>> Author: Jared Finder <jared@finder.org>
>> Commit: Eli Zaretskii <eliz@gnu.org>
>> 
>>     Enable xterm-mouse-mode by default in xterm
>> 
>>     * lisp/xt-mouse.el (xterm-mouse-mode): Change default value of
>>     xterm-mouse-mode to t.
>>     * lisp/term/xterm.el (xterm--init): Enable xterm-mouse-mode if
>>     the default value is still set.
>>     * etc/NEWS: Document new behavior.
> 
> This fails xt-mouse-tests:
> 
> --8<---------------cut here---------------start------------->8---
> # make -C test xt-mouse-tests.log
> 
> Ran 3 tests, 0 results as expected, 3 unexpected (2024-12-13 
> 09:35:08+0100, 1.359088 sec)
> 
> 3 unexpected results:
>    FAILED  xt-mouse-tracking-basic
>    FAILED  xt-mouse-tracking-sgr
>    FAILED  xt-mouse-tracking-utf-8
> --8<---------------cut here---------------end--------------->8---

Apologies for that. Attached is a fix for the test. Unfortunately, for 
some reason I don't quite understand xt-mouse-tests.el does not work 
when called inside a running Emacs session. It only works when called in 
batch mode. This limitation predates turning xterm-mouse-mode on by 
default, so I just added a FIXME for that.

   -- MJF

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-for-xt-mouse-tests.el-broken-in-prior-commit.patch --]
[-- Type: text/x-diff; name=0001-Fix-for-xt-mouse-tests.el-broken-in-prior-commit.patch, Size: 2640 bytes --]

From 0f4143d26b805f83c1dd47a8720f2db426800a05 Mon Sep 17 00:00:00 2001
From: Jared Finder <jared@finder.org>
Date: Fri, 13 Dec 2024 20:59:50 -0800
Subject: [PATCH] Fix for xt-mouse-tests.el broken in prior commit

xt-mouse-tests not turning on xterm-mouse-mode if it was already
on did not work with xterm-mouse-mode being set to t by default.
It turns out that xt-mouse-tests already does not report proper
results when called inside a running Emacs session so the code
path is not useful anyways.

* test/lisp/xt-mouse-tests.el (with-xterm-mouse-mode): Always
turn on xterm-mouse-mode, even if it is already on.
---
 test/lisp/xt-mouse-tests.el | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el
index cfc8042f796..f64b3aed73e 100644
--- a/test/lisp/xt-mouse-tests.el
+++ b/test/lisp/xt-mouse-tests.el
@@ -25,6 +25,8 @@
 
 (require 'xt-mouse)
 
+;; FIXME: this doesn't work when called inside a non-batch mode Emacs
+;; session.
 (defmacro with-xterm-mouse-mode (&rest body)
   "Run BODY with `xterm-mouse-mode' temporarily enabled."
   (declare (indent 0))
@@ -42,18 +44,16 @@ with-xterm-mouse-mode
                      ((terminal-parameter nil 'xterm-mouse-y) nil)
                      ((terminal-parameter nil 'xterm-mouse-last-down) nil)
                      ((terminal-parameter nil 'xterm-mouse-last-click) nil))
-             (if xterm-mouse-mode
-                 ,(macroexp-progn body)
-               (unwind-protect
-                   (progn
-                     ;; `xterm-mouse-mode' doesn't work in the initial
-                     ;; terminal.  Since we can't create a second
-                     ;; terminal in batch mode, fake it temporarily.
-                     (cl-letf (((symbol-function 'terminal-name)
-                                (lambda (&optional _terminal) "fake-terminal")))
-                       (xterm-mouse-mode))
-                     ,@body)
-                 (xterm-mouse-mode 0)))))
+             (unwind-protect
+                 (progn
+                   ;; `xterm-mouse-mode' doesn't work in the initial
+                   ;; terminal.  Since we can't create a second
+                   ;; terminal in batch mode, fake it temporarily.
+                   (cl-letf (((symbol-function 'terminal-name)
+                              (lambda (&optional _terminal) "fake-terminal")))
+                     (xterm-mouse-mode 1))
+                   ,@body)
+               (xterm-mouse-mode 0))))
        (set-frame-width nil width)
        (set-frame-height nil height))))
 
-- 
2.39.5


  reply	other threads:[~2024-12-14  5:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <173400071920.1603224.9897683501673718041@vcs3.savannah.gnu.org>
     [not found] ` <20241212105159.B81A566E610@vcs3.savannah.gnu.org>
2024-12-12 12:21   ` master 9ccd459e845: Enable xterm-mouse-mode by default in xterm Andrea Corallo
2024-12-13  8:39   ` Michael Albinus
2024-12-14  5:03     ` Jared Finder [this message]
2024-12-14  8:42       ` Michael Albinus

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=f0e5ba95e531996c4bec8bd8513c2f11@finder.org \
    --to=jared@finder.org \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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).