Article View: gnu.emacs.bug
Article #98915Echoing keystrokes
From: David Gillespie
Date: Mon, 04 Feb 1991 01:15
Date: Mon, 04 Feb 1991 01:15
30 lines
2155 bytes
2155 bytes
A loop like the following has the nice feature that Emacs echoes the keystrokes in the echo area, just like when a multi-keystroke key sequence is being entered. But I've noticed a few bugs relating to this feature that only show up when a loop like this is used. (while (/= (read-char) ?a)) ; wait for "a" to be pressed First, M-RET and M-TAB are echoed as "M-^M" and "M- ", despite the efforts of push_key_description in keymap.c to do otherwise. I think this is because EchoThem passes KeyBuf[i], a char (which will be a signed char on my machine) to an unsigned int parameter of push_key_description. The result is a huge integer which, being greater than 0200, causes "M-" to be displayed. But the function uses c -= 0200 instead of c &= 0177 to mask off the low 7 bits, so the special formats for RET and TAB aren't used. The other problem is that echobuf is declared in keyboard.c to be char[100] and KeyBuf is a char[40]; echobuf is not large enough. I think 240 is big enough, if KeyBuf contains 40 M-TABs (assuming the above bug is fixed). Actually, since the prompt figures into the size of echobuf and its size is unconstrained by Fread_key_sequence, no fixed size is really enough. Anyway, if I run the above program and type TABs, Emacs mysteriously beeps as if I had typed C-g on the 24th one. And (read-key-sequence (make-string 1000 ?a)) blows Emacs right out of the water. (I discovered these bugs while using the looping commands of my Emacs calculator. Calc users, take note!) -- Dave
Technical Details
Message-ID:
<9102040115.AA17909@csvax.cs.caltech.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!CSVAX.CS.CALTECH.EDU!davegShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,8d2c73461a1c5d4c,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-02-04 03:54:33 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!CSVAX.CS.CALTECH.EDU!daveg From: daveg@CSVAX.CS.CALTECH.EDU (David Gillespie) Newsgroups: gnu.emacs.bug Subject: Echoing keystrokes Message-ID: <9102040115.AA17909@csvax.cs.caltech.edu> Date: 4 Feb 91 01:15:00 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 30 Approved: bug-gnu-emacs@prep.ai.mit.edu