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: Improve input handling documentation (was Re: Best way to intercept terminal escape sequences?) Date: Sat, 04 Sep 2010 21:05:30 +0200 Message-ID: <4C82987A.4060300@ece.cmu.edu> References: <20100904160740.988082D5@osgood.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 1283627161 17471 80.91.229.12 (4 Sep 2010 19:06:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Sep 2010 19:06:01 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 04 21:05:59 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 1Ory3m-0001Tq-DO for ged-emacs-devel@m.gmane.org; Sat, 04 Sep 2010 21:05:54 +0200 Original-Received: from localhost ([127.0.0.1]:35742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ory3l-0004di-TT for ged-emacs-devel@m.gmane.org; Sat, 04 Sep 2010 15:05:53 -0400 Original-Received: from [140.186.70.92] (port=56003 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ory3c-0004bn-My for emacs-devel@gnu.org; Sat, 04 Sep 2010 15:05:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ory3Y-0003O0-BN for emacs-devel@gnu.org; Sat, 04 Sep 2010 15:05:44 -0400 Original-Received: from bache.ece.cmu.edu ([128.2.129.23]:49482) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ory3Y-0003Nq-9G for emacs-devel@gnu.org; Sat, 04 Sep 2010 15:05:40 -0400 Original-Received: from [192.168.0.2] (121-77.76-83.cust.bluewin.ch [83.76.77.121]) by bache.ece.cmu.edu (Postfix) with ESMTP id 43483C4 for ; Sat, 4 Sep 2010 15:05:35 -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: <20100904160740.988082D5@osgood.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:129678 Archived-At: On Sat, 04 Sep 2010 15:01:28 +0200 stepnem wrote: >> > It would be really nice to have, somewhere in the emacs docs, a diagram >> > showing what processing happens to keyboard input, starting from raw bytes and >> > UI events, and tracing them (or their translations) through coding systems, >> > input methods, command loop, various keymaps, etc. and showing where in that >> > process the different read-* functions intercept that data (and where the >> > various unread-*-events reinsert things). A similar diagram for reading and >> > writing files would probably also be useful. > Sounds great indeed! > > [...] >> > Unfortunately, even after spending so long on this problem I don't think I >> > know enough to generate that diagram... > But perhaps you could come up with some initial version that others > could continue improving upon? What format should the diagram take? I don't think I've ever seen ascii art, let alone an image, in the emacs docs... Meanwhile, here's what I have inferred, roughly, about input handling. Hopefully those familiar with emacs' guts can correct and improve it: <-------- keyboard input keyboard-coding-system <-------- unread-input-method-events [Input Method (optional, printable ascii chars only)] <-------- unread-post-input-method-events ??? <-------- non-keyboard (e.g. mouse) events <-------- unread-command-events (and unread-command-char) --------> read-char, read-event input-decode-map key-translation-map [local-]function-key-map --------> read-key assorted keymaps (global, local, minor mode, emulation, char/text properties, overriding) --------> read-key-sequence ??? read-number, read-string, etc. (???) (I have no idea where read-passwd fits in this hierarchy, nor how the command loop lines up with things). NOTE: the description of read-key and input-decode-map makes it sound like read-event comes before coding systems, but empirically this is not true. Regards, Ryan