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: Best way to intercept terminal escape sequences? Date: Fri, 27 Aug 2010 18:40:44 +0300 Message-ID: <834oegm5c3.fsf@gnu.org> References: <20100827142724.E1DD712F@hazard.ece.cmu.edu> <4C77CF3C.6050406@ece.cmu.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1282923650 4435 80.91.229.12 (27 Aug 2010 15:40:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 27 Aug 2010 15:40:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: Ryan Johnson Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 27 17:40:47 2010 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.69) (envelope-from ) id 1Op12p-0007ez-07 for ged-emacs-devel@m.gmane.org; Fri, 27 Aug 2010 17:40:43 +0200 Original-Received: from localhost ([127.0.0.1]:56978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Op12n-0001CM-Uz for ged-emacs-devel@m.gmane.org; Fri, 27 Aug 2010 11:40:42 -0400 Original-Received: from [140.186.70.92] (port=59743 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Op12e-0001Bb-Gb for emacs-devel@gnu.org; Fri, 27 Aug 2010 11:40:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Op12V-0005XT-Gm for emacs-devel@gnu.org; Fri, 27 Aug 2010 11:40:32 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:55239) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Op12V-0005Vy-9y for emacs-devel@gnu.org; Fri, 27 Aug 2010 11:40:23 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0L7T00F00I54FY00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Fri, 27 Aug 2010 18:40:18 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.186.164]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L7T00F64I756Z70@a-mtaout21.012.net.il>; Fri, 27 Aug 2010 18:40:18 +0300 (IDT) In-reply-to: <4C77CF3C.6050406@ece.cmu.edu> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:129310 Archived-At: > Date: Fri, 27 Aug 2010 16:44:12 +0200 > From: Ryan Johnson > > Is there really no other way to do this? You could use the :post-read-conversion attribute of a coding-system. That is, define a new coding-system that has this attribute specifying a function you will write. That function will first decode the mouse stuff, and then decode the rest by the terminal-coding-system set by the user. You can see an example of this in ctext-with-extensions. It is defined on mule-conf.el and its post-read-conversion function is defined on mule.el. Other than that, it's no surprise that this is not easy: we ask Emacs to read keyboard input that is encoded in two different encodings, which is not how keyboard input was designed. I think the only way that is easier and cleaner would be if Emacs could read the mouse input from a separate file descriptor. We could then set that file descriptor to use a different encoding. Of course, that would need low-level changes in Emacs, even if it is possible in xterm.