Author: Tim XTim X Date: Aug 26, 2006 01:31
I have some code which uses last-input-event to test what was last
entered by the user. However, I've noticed that this value can vary
depending on whether you are running under X or within a console. I'm
wondering what the standard emacs lisp idiom is for handling this.
As an example, I have some code in a conditional which is like
((= last-input-event 127)
(do-somehting))
Under the console, this block will execute if the user hits backspace
to indicate a character has been deleted. However, if I execute this
code under X, I will get a wrong-type-argument number-or-marker-p
backspace error. This is because under X, rather than a number,
last-input-event will hold the symbol 'backspace.
Now, I could fix this by doing something like
((or (eq last-input-event 127)
(eq last-input-event 'backspace))
(do-something))
but that seems a bit clunky to me. Also, I'm not sure how well this
will work with other character sets or encodings or on other
platforms, like Windows.
|