all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: schwab@suse.de, emacs-devel@gnu.org
Subject: Re: read a reply from the terminal
Date: Sun, 15 Jul 2007 13:42:29 -0700	[thread overview]
Message-ID: <200707152042.l6FKgT31009360@oogie-boogie.ics.uci.edu> (raw)
In-Reply-To: <ur6n9shft.fsf@gnu.org> (Eli Zaretskii's message of "Sun\, 15 Jul 2007 20\:30\:30 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

  > > From: Dan Nicolaescu <dann@ics.uci.edu>
  > > Date: Sun, 15 Jul 2007 08:30:00 -0700
  > > Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
  > > 
  > > Andreas Schwab <schwab@suse.de> writes:
  > > 
  > >   > Dan Nicolaescu <dann@ics.uci.edu> writes:
  > >   > 
  > >   > > !       ;; 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) ?\e)
  > >   > 
  > >   > > ! 	(when (equal (read-event) 91)
  > >   > > ! 	  (while (not (equal (setq chr (read-event)) ?c))
  > >   > > ! 	    (setq str (concat str (string chr))))
  > >   > 
  > >   > What if the terminal is ignoring the query, or there is some other
  > >   > communication problem, wouldn't that mean that read-event would hang
  > >   > here?  IMHO the calls should use the timeout feature.
  > > 
  > > Good point.
  > 
  > I thought about the same problem as Andreas, but didn't ask the
  > question since you told that you've tested the code on many terminals,
  > and I assumed those terminals included at least one that didn't
  > support this command.  If that's not so, I suggest to test the new
  > code (with timeout) on such a terminal, as well as on those which do
  > support the command.

I have now tested the code using a timeout of 0.1 on xterm, rxvt,
gnome-terminal, konsole, putty, and a very old xterm (from an old
Solaris). It works fine for all of them. All these terminals support
the "\e[>0c" query. 
I also tested it on a Linux console, that does not support the query.

It works fine everywhere. 

  reply	other threads:[~2007-07-15 20:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-14  2:42 read a reply from the terminal Dan Nicolaescu
2007-07-14 10:39 ` Eli Zaretskii
2007-07-15 13:49   ` Johan Bockgård
2007-07-15 17:19     ` Eli Zaretskii
2007-07-15 22:04       ` Johan Bockgård
2007-07-16  3:11         ` Eli Zaretskii
2007-07-16 19:46           ` Johan Bockgård
2007-07-14 19:37 ` Stefan Monnier
2007-07-15  0:34   ` Dan Nicolaescu
2007-07-15  1:33     ` Stefan Monnier
2007-07-15  8:18     ` Andreas Schwab
2007-07-15 15:30       ` Dan Nicolaescu
2007-07-15 17:30         ` Eli Zaretskii
2007-07-15 20:42           ` Dan Nicolaescu [this message]
2007-08-03 21:54             ` Davis Herring
2007-08-03 22:23               ` Dan Nicolaescu
2007-08-04  1:00                 ` Stefan Monnier
2007-07-15 22:53     ` Richard Stallman
2007-07-16  0:56       ` Dan Nicolaescu
2007-07-14 22:16 ` Johan Bockgård
2007-07-14 22:35   ` Eli Zaretskii
2007-07-15  0:24     ` Johan Bockgård

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=200707152042.l6FKgT31009360@oogie-boogie.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@suse.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 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.