Emacs lisp: which key was pressed?

Sometime you might want to know which key was pressed last in a lisp function. I came up with this little function for this purpose:

(defun last-key ()
  "Return the last key pressed."
  (car (reverse (append (recent-keys) nil))))

03.08.2017 17:24 CC0 emacs Emacs

Similar posts

Null Comment zu Emacs lisp: which key was pressed?

Add Comment:
Aus welchem Land kommen Sie?
Your comment will only displayed publicly after my approval! Fields marked with * are mandatory.
If you include an email address, it will be deleted automatically after one month. Nothing else will be stored.