|
From: | Ryan Johnson |
Subject: | Re: Best way to intercept terminal escape sequences? |
Date: | Fri, 27 Aug 2010 16:44:12 +0200 |
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 |
On Fri, 27 Aug 2010 16:17:14 +0200, David Kastrup wrote:
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.On Fri, 27 Aug 2010 12:36:52 +0200, David Kastrup wrote:Ryan Johnson<address@hidden> writesI 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.
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
[Prev in Thread] | Current Thread | [Next in Thread] |