From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: read a reply from the terminal Date: Sun, 15 Jul 2007 20:30:30 +0300 Message-ID: References: <200707140242.l6E2gpBC015778@oogie-boogie.ics.uci.edu> <200707150034.l6F0YYxT013883@oogie-boogie.ics.uci.edu> <200707151530.l6FFU15h003138@oogie-boogie.ics.uci.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1184520659 6898 80.91.229.12 (15 Jul 2007 17:30:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 Jul 2007 17:30:59 +0000 (UTC) Cc: schwab@suse.de, emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 15 19:30:56 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IA7vn-0000Sr-UL for ged-emacs-devel@m.gmane.org; Sun, 15 Jul 2007 19:30:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IA7vn-0005gr-9B for ged-emacs-devel@m.gmane.org; Sun, 15 Jul 2007 13:30:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IA7vj-0005fY-RV for emacs-devel@gnu.org; Sun, 15 Jul 2007 13:30:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IA7vi-0005eD-Tr for emacs-devel@gnu.org; Sun, 15 Jul 2007 13:30:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IA7vi-0005e4-RB for emacs-devel@gnu.org; Sun, 15 Jul 2007 13:30:46 -0400 Original-Received: from romy.inter.net.il ([213.8.233.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IA7vi-0003km-D7 for emacs-devel@gnu.org; Sun, 15 Jul 2007 13:30:46 -0400 Original-Received: from HOME-C4E4A596F7 ([81.5.49.91]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id IIW21460 (AUTH halo1); Sun, 15 Jul 2007 20:30:33 +0300 (IDT) In-reply-to: <200707151530.l6FFU15h003138@oogie-boogie.ics.uci.edu> (message from Dan Nicolaescu on Sun, 15 Jul 2007 08:30:00 -0700) X-detected-kernel: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74832 Archived-At: > From: Dan Nicolaescu > Date: Sun, 15 Jul 2007 08:30:00 -0700 > Cc: Stefan Monnier , emacs-devel@gnu.org > > Andreas Schwab writes: > > > Dan Nicolaescu 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.