all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carlos Pita <carlosjosepita@gmail.com>
Cc: 37782@debbugs.gnu.org
Subject: bug#37782: Emacs 27 client adding [I] to the beginning of the buffer
Date: Fri, 18 Oct 2019 01:29:41 -0300	[thread overview]
Message-ID: <CAELgYhf7H+Af3hC=7hVTWK7KcyNs8q6J8OstXQ78X8xaYxHP0g@mail.gmail.com> (raw)
In-Reply-To: <83d0evbjb1.fsf@gnu.org>

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

> Most probably (which is why I pointed to the corresponding escape
> sequences), but the question is exactly why does this not work as
> expected?  Is the terminal you are using too fast or too slow to
> respond?  Is something else wrong?  We need to answer these questions
> to make some progress with this issue.
>
> Maybe someone else can reproduce and debug this.

I've had a hard time debugging this issue but the cause is still unclear to me.

I can easily reproduce the problem with an empty configuration, see
the attached screencast. There I'm just running

emacs --daemon
emacsclient -t

with an empty configuration. Since the behavior is not very
"deterministic" I was many times mislead to believe that the cause was
this or that theme or package, and maybe some packages that make heavy
use of color or other escape sequences do might tend to produce the
artifact more often, I don't know.

Things that I can say for (99%) sure:

1. It only happens in a terminal.
2. It only happens in client/server mode.
3. It only happens the first time I open a client in the terminal.
4. Commenting the  `(send-string-to-terminal "\e[?1004h")` line in
xterm.el suppresses the `[I` sequence (but this of course by disabling
focus tracking).
5. After the initial artifact, focus is indeed tracked correctly, i.e.
xterm-translate-focus-in/out are called as expected for `[I` and `[O`
sequences. But the first time xterm-translate-focus-in is NOT called.
6. When focus tracking is activated xterm-function-map was already
pushed to input-decode-map so AFAICS focus handlers should already be
properly installed.
7. Sometimes it is `[I`, sometimes it is `[I]`.

My hunch is that the escape sequence is not correctly parsed, that the
`[I` part is taken as normal input from the keyboard because the
escape prefix got lost or was interspersed with another sequence.
Probably the answer is in some part of read_key_sequence, but the
combination of client/server mode and low-level tty input is beyond my
debugging abilities.

Best regards
--
Carlos

[-- Attachment #2: Screencast from 18-10-19 01:01:46.webm --]
[-- Type: video/webm, Size: 659386 bytes --]

  reply	other threads:[~2019-10-18  4:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 22:45 bug#37782: Emacs 27 client adding [I] to the beginning of the buffer Carlos Pita
2019-10-17  2:18 ` Carlos Pita
2019-10-17  2:33   ` Carlos Pita
2019-10-17  8:03     ` Eli Zaretskii
2019-10-17 12:08       ` Carlos Pita
2019-10-17 12:26         ` Carlos Pita
2019-10-17 13:01           ` Carlos Pita
2019-10-17 13:20             ` Eli Zaretskii
2019-10-18  4:29               ` Carlos Pita [this message]
2019-10-19  3:20                 ` Carlos Pita
2019-10-19  7:06                   ` Eli Zaretskii
2019-10-26 10:30                   ` Eli Zaretskii
2019-10-17 13:16           ` Eli Zaretskii
2019-10-17 13:12         ` Eli Zaretskii
2019-11-08  5:09 ` bug#37782: Emacs 27 client adding [I] to the beginning of the Joseph Mingrone

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='CAELgYhf7H+Af3hC=7hVTWK7KcyNs8q6J8OstXQ78X8xaYxHP0g@mail.gmail.com' \
    --to=carlosjosepita@gmail.com \
    --cc=37782@debbugs.gnu.org \
    /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.