GNU bug report logs -
#22107
this-command-keys no longer returns prefix argument
Previous Next
Reported by: bruce.connor.am <at> gmail.com
Date: Mon, 7 Dec 2015 15:43:02 UTC
Severity: normal
Tags: fixed
Merged with 22111
Found in versions 25.0.50, 25.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #127 received at 22107 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi all,
I stumbled upon this bug recently, when something in my config (
https://github.com/kaushalmodi/.emacs.d/commit/912c4fc8bf4ed0c84e28dc837b0500b9a2e172ca
)
wasn't working the same way in emacs 24.5 as it does in emacs 25.x.
Here is a dummy example to demonstrate this (which is almost the same as
posted by Artur in the first email of this thread):
=====
(defun foo ()
(interactive)
(message (format "this-command-keys: %S, this-single-command-keys: %s"
(this-command-keys)
(this-single-command-keys))))
(global-set-key (kbd "C-c ;") #'foo)
=====
After evaluating the above, doing C-u C-c ; gives the following results on
different versions of emacs:
24.5: this-command-keys: "^U^C;", this-single-command-keys: [3 59]
25.0.93: this-command-keys: "^C;", this-single-command-keys: [3 59]
(of course I have stringified the ^U and ^C portions above to make them
visible in the email)
I looked at the related commit based on this bug:
http://git.savannah.gnu.org/cgit/emacs.git/commit/src/keyboard.c?h=emacs-25&id=9d2b8e768f2015a89f7609dedf7b28ea5e8123b5
It's commit log says "Restore the feature whereby C-u was part of
this-command-keys, but not of this-single-command-keys.". But it looks like
no restore happened. "^U" is still not part of this-command-keys.
Currently this-command-keys and this-single-command-keys look essentially
the same, except the this-command-keys is a string and
this-single-command-keys is a vector of asciis.
Also as Artur stated in the original bug report, the function documentation
is not in sync with what actually is happening:
C-h f this-command-keys on emacs 25.0.93 gives:
=====
this-command-keys is a built-in function in ‘C source code’.
(this-command-keys)
Return the key sequence that invoked this command.
However, if the command has called ‘read-key-sequence’, it returns
the last key sequence that has been read.
The value is a string or a vector.
=====
C-h f this-single-command-keys on emacs 25.0.93 gives:
=====
this-single-command-keys is a built-in function in ‘C source code’.
(this-single-command-keys)
Return the key sequence that invoked this command.
More generally, it returns the last key sequence read, either by
the command loop or by ‘read-key-sequence’.
Unlike ‘this-command-keys’, this function’s value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
does not include prefix arguments.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The value is always a vector.
=====
--
--
Kaushal Modi
[Message part 2 (text/html, inline)]
This bug report was last modified 4 years and 228 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.