[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Behavior of `this-command-keys'

From: Jay Belanger
Subject: Behavior of `this-command-keys'
Date: Mon, 11 Sep 2006 12:54:02 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

The behavior of `this-command-keys' doesn't seem to match its
documentation; perhaps I'm misunderstanding something.  The
documentation for `this-command-keys' is:
   This function returns a string or vector containing the key
   sequence that invoked the present command, plus any previous
   commands that generated the prefix argument for this command.
   However, if the command has called `read-key-sequence', it returns
   the last read key sequence.  *Note Key Sequence Input::.  The
   value is a string if all events in the sequence were characters
   that fit in a string.  *Note Input Events::.
Consider something like:
  (defun test ()
    (sit-for 1)
    (setq result (this-command-keys)))
  (global-set-key "a" 'test)
To me, it sounds like as if `result' should equal "a" (the key which
calls the function) if "ab" were pressed, whether or not the `sit-for'
had run its course.  However, `result' equals "a" or "ab" depending on
how close together the "a" and "b" are pressed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]