emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: garbage characters inserted after "emacsclient -t"


From: Stefan Monnier
Subject: Re: garbage characters inserted after "emacsclient -t"
Date: Tue, 23 Oct 2007 10:53:44 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

> When I attach to an already-running emacs session with "emacsclient -t"
> from an gnome-terminal window, the characters ">1;1609;0c" get inserted
> into whatever buffer is first shown in the terminal.

> That looks sort of like an ANSI escape sequence, so I imagine it's some
> feature connected with term/xterm.el that isn't properly being handled
> by Emacs in this case?

I'd guess it comes from term/xterm.el's terminal-init-xterm where it does:

    ;; Try to turn on the modifyOtherKeys feature on modern xterms.
    ;; When it is turned on many more key bindings work: things like
    ;; C-. C-, etc.
    ;; To do that we need to find out if the current terminal supports
    ;; modifyOtherKeys. At this time only xterm does.
    (let ((coding-system-for-read 'binary)
          (chr nil)
          (str nil))
      ;; Try to find out the type of terminal by sending a "Secondary
      ;; Device Attributes (DA)" query.
      (send-string-to-terminal "\e[>0c")

      ;; The reply should be of the form: \e [ > NUMBER1 ; NUMBER2 ; NUMBER3 c
      (when (equal (read-event nil nil 0.1) ?\e)
        (when (equal (read-event nil nil 0.1) ?\[)
          (while (not (equal (setq chr (read-event nil nil 0.1)) ?c))
            (setq str (concat str (string chr))))
          (when (string-match ">0;\\([0-9]+\\);0" str)

Maybe some other event (like switch-frame or some such) gets in the way?
Maybe C-h l can give us a clue?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]