From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#18355: unicode and multi-byte key-event support for function recent-keys Date: Fri, 29 Aug 2014 14:39:45 -0400 Message-ID: References: <5400C195.1010808@gmx.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1409337698 23423 80.91.229.3 (29 Aug 2014 18:41:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 29 Aug 2014 18:41:38 +0000 (UTC) Cc: 18355-done@debbugs.gnu.org To: Boruch Baum Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 29 20:41:30 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XNR70-0001ck-7K for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Aug 2014 20:41:26 +0200 Original-Received: from localhost ([::1]:43762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNR6z-0005ek-Lg for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Aug 2014 14:41:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNR6o-0005dV-JM for bug-gnu-emacs@gnu.org; Fri, 29 Aug 2014 14:41:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNR6g-00046g-6a for bug-gnu-emacs@gnu.org; Fri, 29 Aug 2014 14:41:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNR6g-00046b-3N for bug-gnu-emacs@gnu.org; Fri, 29 Aug 2014 14:41:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XNR6f-0001kz-JY for bug-gnu-emacs@gnu.org; Fri, 29 Aug 2014 14:41:05 -0400 Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Aug 2014 18:41:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 18355 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Mail-Followup-To: 18355@debbugs.gnu.org, monnier@iro.umontreal.ca, boruch_baum@gmx.com Original-Received: via spool by 18355-done@debbugs.gnu.org id=D18355.14093376236669 (code D ref 18355); Fri, 29 Aug 2014 18:41:04 +0000 Original-Received: (at 18355-done) by debbugs.gnu.org; 29 Aug 2014 18:40:23 +0000 Original-Received: from localhost ([127.0.0.1]:53757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XNR5x-0001jU-T0 for submit@debbugs.gnu.org; Fri, 29 Aug 2014 14:40:22 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:36530) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XNR5s-0001jF-29; Fri, 29 Aug 2014 14:40:17 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 9272C84E46; Fri, 29 Aug 2014 14:40:15 -0400 (EDT) Original-Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 0707D1E5B8A; Fri, 29 Aug 2014 14:39:45 -0400 (EDT) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id D9C1BB40F7; Fri, 29 Aug 2014 14:39:45 -0400 (EDT) In-Reply-To: <5400C195.1010808@gmx.com> (Boruch Baum's message of "Fri, 29 Aug 2014 14:08:21 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.6, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_AFFAIRE 0.11, MC_TRANSFR 0.11, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92822 Archived-At: tags 18355 notabug thanks > DISCUSSION: Function `recent-keys' returns a 300-byte vector of most > recent keyboard events, and describes this as the 300 most recent > keypresses. However, between the advent of unicode variable-byte locales > and modern keyboards, those 300 bytes represent an unknown number of > keyboard events, that become very difficult to parse. There is no > guarantee that the bottom of the FIFO corresponds to the first byte of a > keyboard event, and there isn't clarity how many bytes at the top > of the FIFO are the first event, since it is the FINAL byte of the most > recent event that is on the top of the FIFO.. The problem you're encountering is because you run Emacs in a tty. Under a GUI the events you see are more closely mapped to "keyboard events". But under a tty, Emacs does not get told which sequences of bytes are "one event". It does manage to figure it out thanks to the input-decode-map and several of its friends, tho this is a rather tricky and unreliable business. E.g. try (under a typical tty) to hit ESC ESC Home. The recent-keys gives you the "low-level" view of what Emacs received from the OS. If it looks like a mess that's hard to parse, it's because it *is* a mess that's hard to parse. If code relies on recent-keys and parses that, I'd just say that this code gets what it asked for: recent-keys is meant for debugging, not for normal use. Stefan