GNU bug report logs - #36836
Tmux and Focus-In Events

Previous Next

Package: emacs;

Reported by: Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com>

Date: Mon, 29 Jul 2019 13:52:01 UTC

Severity: normal

Tags: moreinfo

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36836 in the body.
You can then email your comments to 36836 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36836; Package emacs. (Mon, 29 Jul 2019 13:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 29 Jul 2019 13:52:02 GMT) Full text and rfc822 format available.

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

From: Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Tmux and Focus-In Events
Date: Mon, 29 Jul 2019 15:50:48 +0200
Hello,

I noticed a rather strange and somewhat hard to track down bug that's related to
tmux and terminal focus-in events.

Using Emacs 27 and tmux 2.1: If you start tmux with the option `tmux set-option
-g focus-events on` enabled and then inside tmux start an emacsclient, e.g.,
via:

```
emacs -Q --daemon=test && emacsclient --socket-name=test ."
```

Then Emacs starts and unexpectedly inserts the characters "[I]" in the buffer
that is opened. This only seem to happen the first time the client is started.

A quick bisection on the Emacs code-base lead me to this commit:

```
commit 6fdc3fac5658a7ab142c358cddd90f3db5665ef5
Author: Daniel Colascione <dancol <at> dancol.org>
Date:   Fri Jun 8 22:47:27 2018 -0700
    Support terminal focus notifications

    * lisp/frame.el (handle-focus-in,handle-focus-out): Make event
    argument optional.
    (blink-cursor-check): Make sure that the current frame is a
    window-system frame before restarting the blink timer. TTY frames
    can get focus, but don't need a blink timer because the terminal
    will do the blinking.

    * lisp/term/xterm.el
    (xterm-handle-focus-in,xterm-handle-focus-out): New functions.
    (xterm-rxvt-function-map): Recognize focus notification sequences.
    (xterm--init-focus-tracking): New function.
    (terminal-init-xterm): Call it.
```

Apparently it seems like "\e[I" is the focus-in event, which is translated to
"[I]" by `electric-pair-mode`.

I'm not entirely sure where the bug is in this case however. Is it up to Emacs
to handle focus-in events from the terminal or is that something tmux itself
should handle in this case? Or is there some setting somewhere that should be
toggled to prevent this kind of thing from happening?

I originally observed this behavior in Konsole, but the same thing happen in
xterm itself as well, and possibly other terminal emulators.



In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2019-07-29 built on E105888
Repository revision: a9593253e90aa58134833078ae1fc5505ae9f58c
Repository branch: master
System Description: Ubuntu 16.04.6 LTS

Recent messages:
Mark set
Quit
Mark set
Detected language: English [9 times]
Auto-saving...done
Saving file /home/guswal01/test.md...
Wrote /home/guswal01/test.md
Mark set [2 times]
(No changes need to be saved) [2 times]
Making completion list... [3 times]

Configured using:
 'configure --prefix=/home/guswal01/.local
 '--program-transform-name=s/^ctags$/ctags.emacs/''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
GNUTLS LIBXML2 FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
XDBE XIM THREADS PDUMPER LCMS2 GMP

Important settings:
  value of $LC_MONETARY: sv_SE.UTF-8
  value of $LC_NUMERIC: sv_SE.UTF-8
  value of $LC_TIME: sv_SE.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Markdown

Minor modes in effect:
  orgtbl-mode: t
  shell-dirtrack-mode: t
  orgstruct-mode: t
  guess-language-mode: t
  poly-markdown-mode: t
  beacon-mode: t
  flyspell-mode: t
  flycheck-pos-tip-mode: t
  projectile-mode: t
  hes-mode: t
  global-linum-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-company-mode: t
  company-mode: t
  global-anzu-mode: t
  anzu-mode: t
  perspeen-mode: t
  global-atomic-chrome-edit-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  which-key-mode: t
  anyclip-mode: t
  override-global-mode: t
  electric-pair-mode: t
  save-place-mode: t
  global-subword-mode: t
  subword-mode: t
  show-paren-mode: t
  winner-mode: t
  global-auto-revert-mode: t
  xterm-mouse-mode: t
  savehist-mode: t
  ido-everywhere: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort bbdb-message mail-extr emacsbug sendmail echistory chistory
ehelp ecb-compatibility ecb-layout ecb-create-layout ecb-compilation
ecb-common-browser ecb-navigate eieio-compat ecb-cedet-wrapper
semantic/db-mode semantic/db-find semantic/db-ref semantic/analyze
semantic/sort semantic/scope semantic/analyze/fcn semantic/db
semantic/format ezimage semantic/tag-ls semantic/find semantic/ctxt
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local cedet ecb-mode-line ecb-face tree-buffer ecb-util
help-fns radix-tree term/tmux term/xterm xterm org-rmail org-mhe org-irc
org-info org-gnus nnir gnus-sum url url-proxy url-privacy url-expand
url-methods url-history mailcap shr svg xml dom gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
parse-time gnus-spec gnus-int gnus-range message rfc822 mml mml-sec epa
epg epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search
mail-utils mm-util mail-prsvr org-docview doc-view jka-compr image-mode
dired dired-loaddefs org-bibtex bibtex org-bbdb org-w3m org-table
ob-latex ob-plantuml ob-org ob-shell shell ob-gnuplot ob-python ob-ditaa
ob-dot org-element avl-tree org org-macro org-footnote org-pcomplete
pcomplete org-list org-faces org-entities time-date org-version
ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-menu
calendar cal-loaddefs guess-language poly-markdown polymode derived
poly-lock polymode-base polymode-weave polymode-export polymode-compat
polymode-methods polymode-core format-spec polymode-classes eieio-custom
eieio-base smart-mode-line-dark-theme smart-mode-line rich-minority
beacon server auto-complete-config auto-complete popup form-feed paredit
nameless lisp-mnt flyspell ispell whitespace flycheck-pos-tip pos-tip
flycheck find-func rainbow-delimiters projectile grep ibuf-ext ibuffer
ibuffer-loaddefs highlight-escape-sequences linum yasnippet-snippets
yasnippet company-oddmuse company-keywords company-etags etags fileloop
generator company-gtags company-dabbrev-code company-dabbrev
company-files company-capf company-cmake company-xcode company-clang
company-semantic company-eclim company-template company-bbdb company
anzu perspeen perspeen-tab powerline powerline-separators
powerline-themes atomic-chrome websocket url-cookie url-domsuf bindat
let-alist color-theme-approximate delim-col hydra-examples windmove rect
hydra lv dap-mode dap-overlays lsp lsp-mode ewoc markdown-mode
edit-indirect color noutline outline tree-widget xref url-util spinner
pcase network-stream puny nsm rmc inline imenu ht f s em-glob esh-util
dash-functional dash flymake-proc flymake compile warnings thingatpt
project bbdb bbdb-site timezone cus-edit cus-start cus-load wid-edit
ace-link avy undo-tree diff which-key advice anyclip-mode diminish
use-package use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key use-package-core finder-inf
local-autoloads cwarn cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs elec-pair saveplace
cap-words superword subword paren winner autorevert filenotify xt-mouse
tango-dark-theme savehist ido gud easy-mmode comint ansi-color ring
keybinds terminals autoinsert tex-site rx cl-extra help-mode
slime-autoloads edmacro kmacro info package easymenu browse-url
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 478739 54790)
 (symbols 48 43732 1)
 (strings 32 147104 5075)
 (string-bytes 1 5423337)
 (vectors 16 61266)
 (vector-slots 8 737765 36386)
 (floats 8 541 96)
 (intervals 56 2393 2891)
 (buffers 992 16)
 (heap 1024 31120 2033))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36836; Package emacs. (Thu, 26 Nov 2020 11:54:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com>
Cc: 36836 <at> debbugs.gnu.org
Subject: Re: bug#36836: Tmux and Focus-In Events
Date: Thu, 26 Nov 2020 12:53:43 +0100
Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com> writes:

> Using Emacs 27 and tmux 2.1: If you start tmux with the option `tmux set-option
> -g focus-events on` enabled and then inside tmux start an emacsclient, e.g.,
> via:
>
> ```
> emacs -Q --daemon=test && emacsclient --socket-name=test ."
> ```
>
> Then Emacs starts and unexpectedly inserts the characters "[I]" in the buffer
> that is opened. This only seem to happen the first time the client is started.

(This bug report unfortunately got no response at the time.)

I seem to recall a similar bug that was worked on recently in the
development version of Emacs, but I can't find it now.  Would it be
possibly for you to try the development version and see whether this bug
is still present there?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 26 Nov 2020 11:55:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36836; Package emacs. (Sun, 29 Nov 2020 20:20:02 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com>, 36836 <at> debbugs.gnu.org
Subject: Re: bug#36836: Tmux and Focus-In Events
Date: Sun, 29 Nov 2020 20:19:28 +0000
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com> writes:
>
>> Using Emacs 27 and tmux 2.1: If you start tmux with the option `tmux set-option
>> -g focus-events on` enabled and then inside tmux start an emacsclient, e.g.,
>> via:
>>
>> ```
>> emacs -Q --daemon=test && emacsclient --socket-name=test ."
>> ```
>>
>> Then Emacs starts and unexpectedly inserts the characters "[I]" in the buffer
>> that is opened. This only seem to happen the first time the client is started.
>
> (This bug report unfortunately got no response at the time.)
>
> I seem to recall a similar bug that was worked on recently in the
> development version of Emacs, but I can't find it now.  Would it be
> possibly for you to try the development version and see whether this bug
> is still present there?

Are you perhaps thinking of bug#35180 or bug#37782?

Replay key if kboard is interrupted while initializing (Bug#37782)
e3cebbb839 2019-10-26 13:29:29 +0300
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e3cebbb839fc94f314659bf667c6790edebf4297

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36836; Package emacs. (Mon, 30 Nov 2020 09:22:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com>, 36836 <at> debbugs.gnu.org
Subject: Re: bug#36836: Tmux and Focus-In Events
Date: Mon, 30 Nov 2020 10:21:10 +0100
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> Are you perhaps thinking of bug#35180 or bug#37782?
>
> Replay key if kboard is interrupted while initializing (Bug#37782)
> e3cebbb839 2019-10-26 13:29:29 +0300
> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e3cebbb839fc94f314659bf667c6790edebf4297

Yup.  So if there's no response from the bug reporter here within a
couple of weeks, I'm going to guess that this has been fixed and close
this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36836; Package emacs. (Mon, 14 Dec 2020 17:19:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com>, 36836 <at> debbugs.gnu.org
Subject: Re: bug#36836: Tmux and Focus-In Events
Date: Mon, 14 Dec 2020 18:18:19 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> "Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
>
>> Are you perhaps thinking of bug#35180 or bug#37782?
>>
>> Replay key if kboard is interrupted while initializing (Bug#37782)
>> e3cebbb839 2019-10-26 13:29:29 +0300
>> https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e3cebbb839fc94f314659bf667c6790edebf4297
>
> Yup.  So if there's no response from the bug reporter here within a
> couple of weeks, I'm going to guess that this has been fixed and close
> this bug report.

It's now been two weeks, so I'm closing this bug report.  If there's
still problems in this area, please respond to the debbugs address and
we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 36836 <at> debbugs.gnu.org and Gustaf Waldemarson <gustaf.waldemarson <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 14 Dec 2020 17:19:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 12 Jan 2021 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 99 days ago.

Previous Next


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