[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read a reply from the terminal
From: |
Dan Nicolaescu |
Subject: |
Re: read a reply from the terminal |
Date: |
Sun, 15 Jul 2007 13:42:29 -0700 |
Eli Zaretskii <address@hidden> writes:
> > From: Dan Nicolaescu <address@hidden>
> > Date: Sun, 15 Jul 2007 08:30:00 -0700
> > Cc: Stefan Monnier <address@hidden>, address@hidden
> >
> > Andreas Schwab <address@hidden> writes:
> >
> > > Dan Nicolaescu <address@hidden> 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.
- Re: read a reply from the terminal, (continued)
Re: read a reply from the terminal, Stefan Monnier, 2007/07/14
Re: read a reply from the terminal, Richard Stallman, 2007/07/15
Re: read a reply from the terminal, Dan Nicolaescu, 2007/07/15
Re: read a reply from the terminal, Johan Bockgård, 2007/07/14