From: Richard Stallman <rms@gnu.org>
Cc: belanger@truman.edu, emacs-devel@gnu.org
Subject: Re: Behavior of `this-command-keys'
Date: Mon, 11 Sep 2006 22:01:04 -0400 [thread overview]
Message-ID: <E1GMxaC-0002QV-4U@fencepost.gnu.org> (raw)
In-Reply-To: <87hczel26d.fsf@vh213602.truman.edu> (message from Jay Belanger on Mon, 11 Sep 2006 12:54:02 -0500)
Consider something like:
(defun test ()
(interactive)
(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.
It seems that the documentation of this-command-keys is wrong. Its
value seems to include any keys that were read by read-event.
Given this fact, it is clear why sit-for now has the result it does:
it reads that event using read-event.
Does this fix it?
*** keyboard.c 11 Sep 2006 10:33:19 -0400 1.875
--- keyboard.c 11 Sep 2006 18:06:51 -0400
***************
*** 3257,3264 ****
goto retry;
}
! if (! reread || this_command_key_count == 0
! || this_command_key_count_reset)
{
/* Don't echo mouse motion events. */
--- 3257,3265 ----
goto retry;
}
! if ((! reread || this_command_key_count == 0
! || this_command_key_count_reset)
! && !end_time)
{
/* Don't echo mouse motion events. */
***************
*** 8765,8781 ****
the initial keymaps from the current buffer. */
nmaps = 0;
! if (!NILP (current_kboard->Voverriding_terminal_local_map)
! || !NILP (Voverriding_local_map))
{
! if (3 > nmaps_allocated)
{
! submaps = (Lisp_Object *) alloca (3 * sizeof (submaps[0]));
! defs = (Lisp_Object *) alloca (3 * sizeof (defs[0]));
! nmaps_allocated = 3;
}
if (!NILP (current_kboard->Voverriding_terminal_local_map))
submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
if (!NILP (Voverriding_local_map))
submaps[nmaps++] = Voverriding_local_map;
}
--- 8766,8790 ----
the initial keymaps from the current buffer. */
nmaps = 0;
! if (!NILP (current_kboard->Voverriding_terminal_local_map))
{
! if (2 > nmaps_allocated)
{
! submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0]));
! defs = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
! nmaps_allocated = 2;
}
if (!NILP (current_kboard->Voverriding_terminal_local_map))
submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map;
+ }
+ else if (!NILP (Voverriding_local_map))
+ {
+ if (2 > nmaps_allocated)
+ {
+ submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0]));
+ defs = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
+ nmaps_allocated = 2;
+ }
if (!NILP (Voverriding_local_map))
submaps[nmaps++] = Voverriding_local_map;
}
This updates the documentation of this-command-keys.
*** commands.texi 18 Aug 2006 08:26:35 -0400 1.93
--- commands.texi 11 Sep 2006 18:10:34 -0400
***************
*** 788,798 ****
@anchor{Definition of this-command-keys}
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 @code{read-key-sequence}, it returns the last read
! key sequence. @xref{Key Sequence Input}. The value is a string if
! all events in the sequence were characters that fit in a string.
! @xref{Input Events}.
@example
@group
--- 788,800 ----
@anchor{Definition of this-command-keys}
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. Any events read by the
! command using @code{read-event} without a timeout get tacked on to the end.
!
! However, if the command has called @code{read-key-sequence}, it
! returns the last read key sequence. @xref{Key Sequence Input}. The
! value is a string if all events in the sequence were characters that
! fit in a string. @xref{Input Events}.
@example
@group
next prev parent reply other threads:[~2006-09-12 2:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-11 17:54 Behavior of `this-command-keys' Jay Belanger
2006-09-11 22:13 ` Kim F. Storm
2006-09-12 16:42 ` Jay Belanger
2006-09-12 2:01 ` Richard Stallman [this message]
2006-09-12 16:40 ` Jay Belanger
2006-09-13 15:10 ` Richard Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1GMxaC-0002QV-4U@fencepost.gnu.org \
--to=rms@gnu.org \
--cc=belanger@truman.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.