Subject: bug#14615: xterm--query results in slow -nw startup on some terminals

From: Glenn Morris <[email-masked]>
Date: Thu, 13 Jun 2013 21:36:56 -0400

Stefan Monnier wrote:

> Could you add some `message's to xterm--query to see whether we take the
> synchronous or the asynchronous route?

Commenting out the

("\e[>" . xterm--version-handler)

makes it fast again.
Otherwise the slowness seems to be at this part:

(while (and (< i (length (car handler)))
     (let ((evt (read-event nil nil 2)))

When handler == ("\e[>" . xterm--version-handler), i = 0, read-event
takes 2 seconds to return nil.

> Also, can you try to set debug-on-quit and get a backtrace during the
> 2s wait?

Not informative:

Debugger entered--Lisp error: (quit)
  xterm--query("^[[>0c" (("^[[?" . xterm--version-handler) ("^[[>" . xterm--version-handler)))
  terminal-init-xterm()
  tty-run-terminal-initialization(#<frame F1 0xb8cbc0>)
  command-line()
  normal-top-level()

>         Stefan "who installed Debian's aterm, but whose aterm refuses to
>                 start, giving him a BadWindow error instead"

Mine is some ancient [1] self-compiled version on RHEL6.

[1] Hah, I just checked: installed 6.5 years ago.