From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryan Johnson Newsgroups: gmane.emacs.devel Subject: Re: Best way to intercept terminal escape sequences? Date: Fri, 27 Aug 2010 16:44:12 +0200 Message-ID: <4C77CF3C.6050406@ece.cmu.edu> References: <20100827142724.E1DD712F@hazard.ece.cmu.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1282920498 22370 80.91.229.12 (27 Aug 2010 14:48:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 27 Aug 2010 14:48:18 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 27 16:48:16 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 1Op0Dq-00008x-Iy for ged-emacs-devel@m.gmane.org; Fri, 27 Aug 2010 16:48:09 +0200 Original-Received: from localhost ([127.0.0.1]:41027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Op0De-0001aJ-E6 for ged-emacs-devel@m.gmane.org; Fri, 27 Aug 2010 10:47:50 -0400 Original-Received: from [140.186.70.92] (port=49528 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Op0B1-0008C3-DV for emacs-devel@gnu.org; Fri, 27 Aug 2010 10:47:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Op0AF-0002ch-DG for emacs-devel@gnu.org; Fri, 27 Aug 2010 10:44:24 -0400 Original-Received: from bache.ece.cmu.edu ([128.2.129.23]:52068) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Op0AF-0002cZ-A0 for emacs-devel@gnu.org; Fri, 27 Aug 2010 10:44:19 -0400 Original-Received: from [128.178.240.148] (tsf-wpa-2-0148.epfl.ch [128.178.240.148]) by bache.ece.cmu.edu (Postfix) with ESMTP id BD0F0BC for ; Fri, 27 Aug 2010 10:44:17 -0400 (EDT) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 In-Reply-To: <20100827142724.E1DD712F@hazard.ece.cmu.edu> X-detected-operating-system: by eggs.gnu.org: Solaris 9 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:129307 Archived-At: On Fri, 27 Aug 2010 16:17:14 +0200, David Kastrup wrote: >> On Fri, 27 Aug 2010 12:36:52 +0200, David Kastrup wrote: >>> Ryan Johnson writes >>>> I tried setting the keyboard-coding-system to iso-latin-1, but no >>>> luck. >>> You should set it to raw-text, do your mouse code preprocessing, and >>> afterwards decode the remainder using the intended coding system. >> Like this? >> (defun xterm-mouse-pos-read () >> (let ((old-coding (keyboard-coding-system))) >> (set-keyboard-coding-system 'raw-text) >> (unwind-protect >> (cons (xterm-mouse-event-read) (xterm-mouse-event-read)) >> (set-keyboard-coding-system old-coding)))) > You can't go setting the keyboard reading system back and forth. It > operates into a buffer even before calling read-char. You have to put > it to raw and stick with it. Makes sense. That's why I was hoping there was a way intercept input before coding systems get their claws on it. Otherwise xt-mouse finds itself worrying about what coding system the user has requested, whether it changed recently, etc. If coding systems stacked (and if user-defined ones worked properly) it might be easier, but AFAIK neither is true. Is there really no other way to do this? Ryan