From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs Subject: bug#22107: this-command-keys no longer returns prefix argument Date: Wed, 11 May 2016 13:33:18 +0000 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113cf2f64e88950532911648 X-Trace: ger.gmane.org 1462973666 23073 80.91.229.3 (11 May 2016 13:34:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 May 2016 13:34:26 +0000 (UTC) To: 22107@debbugs.gnu.org, Eli Zaretskii , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 11 15:34:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b0UHI-0002N0-5M for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 May 2016 15:34:16 +0200 Original-Received: from localhost ([::1]:52265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0UHH-0000DB-B8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 May 2016 09:34:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0UH9-0008WG-99 for bug-gnu-emacs@gnu.org; Wed, 11 May 2016 09:34:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0UH3-0002Vi-Ts for bug-gnu-emacs@gnu.org; Wed, 11 May 2016 09:34:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0UH3-0002Vd-Qj for bug-gnu-emacs@gnu.org; Wed, 11 May 2016 09:34:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b0UH3-0008R4-Lt for bug-gnu-emacs@gnu.org; Wed, 11 May 2016 09:34:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 May 2016 13:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22107 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22107-submit@debbugs.gnu.org id=B22107.146297361732397 (code B ref 22107); Wed, 11 May 2016 13:34:01 +0000 Original-Received: (at 22107) by debbugs.gnu.org; 11 May 2016 13:33:37 +0000 Original-Received: from localhost ([127.0.0.1]:46876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0UGf-0008QS-B7 for submit@debbugs.gnu.org; Wed, 11 May 2016 09:33:37 -0400 Original-Received: from mail-oi0-f48.google.com ([209.85.218.48]:34889) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0UGd-0008QF-6R for 22107@debbugs.gnu.org; Wed, 11 May 2016 09:33:36 -0400 Original-Received: by mail-oi0-f48.google.com with SMTP id x19so67303575oix.2 for <22107@debbugs.gnu.org>; Wed, 11 May 2016 06:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=OOmoQqDaEFDPcO1ujvU/R/uTmMjMs4QS37DR77qD3yE=; b=PTlsWkW3o6Z0eK7ASwIsa+Dpy98jthKqct+T4uXbPV0U5Ah/JxMU49y7bwZf1sqnIi aJlDLJ4jYNmtTIquqoL66G7MYzG1V6KvDHbYlgatabMs2J3J7ZXasFLMGQX471I4Zq+u Qktn071pG2b8AyvuDzgu9TyWMwJPMbyQbKDHNxWruN/MXeR9gIrxoIwsfF+7p2uDkEqk wdZYQaKhEbhVG8YNovtY5lV6BC7+cnb66rZOsw2UxQHVOba7DGh1AA2K4wM1MW2/KSG2 nu0r68V7jYTEouBjx4+O96b/Bu93TiS2Uit2DEP2UkkSKfe+4kPc+m7BmvFPJdz4Rb18 s6pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OOmoQqDaEFDPcO1ujvU/R/uTmMjMs4QS37DR77qD3yE=; b=nEJX0bqQ1X5EIwAAbGgBliMU7z0Ru+OytaJeXHJvfxXGj2vbJqDHOHWB37JjsU+QbN IOazIXUO/a4giMsxkRdFqJvc49DPxdyI9vq0qx4SqhfA74qG5RTOpqCwKElpzoJeGbOW uWBFeMXzxHQIor3EFQvYuUwwkFN2PeuRbWAGHhynd7P7gwEK69UBtc45qCZAMv5zaOQA uL+9BFK2MTFosl4670shkuSyG5y4YWfqzKUQrIYqXgYms9QDC1lSLvfNEqnMpqRpI9CC GKy1KvIllNAv4cRSEVlFneykVAhJ7BESEA/80LtKOLSGRRak0Mo7bExSEiu8uYmx3l6F 56JQ== X-Gm-Message-State: AOPr4FXJ9aHEYcbcCN0MbTCLELs/qFezkL0Q612+QAgDZyPDWxxhSiKi9ZCFvlNJogrWLpVpfk0KkxqEUzijWA== X-Received: by 10.202.175.200 with SMTP id y191mr1678649oie.107.1462973609443; Wed, 11 May 2016 06:33:29 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118122 Archived-At: --001a113cf2f64e88950532911648 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi all, I stumbled upon this bug recently, when something in my config ( https://github.com/kaushalmodi/.emacs.d/commit/912c4fc8bf4ed0c84e28dc837b05= 00b9a2e172ca ) 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): =3D=3D=3D=3D=3D (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) =3D=3D=3D=3D=3D 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=3Demacs-= 25&id=3D9d2b8e768f2015a89f7609dedf7b28ea5e8123b5 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: =3D=3D=3D=3D=3D this-command-keys is a built-in function in =E2=80=98C source code=E2=80=99= . (this-command-keys) Return the key sequence that invoked this command. However, if the command has called =E2=80=98read-key-sequence=E2=80=99, it = returns the last key sequence that has been read. The value is a string or a vector. =3D=3D=3D=3D=3D C-h f this-single-command-keys on emacs 25.0.93 gives: =3D=3D=3D=3D=3D this-single-command-keys is a built-in function in =E2=80=98C source code= =E2=80=99. (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 =E2=80=98read-key-sequence=E2=80=99. Unlike =E2=80=98this-command-keys=E2=80=99, this function=E2=80=99s value ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ does not include prefix arguments. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The value is always a vector. =3D=3D=3D=3D=3D --=20 --=20 Kaushal Modi --001a113cf2f64e88950532911648 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi all,

I stumbled upon this bug recent= ly, when something in my config (=C2=A0https://git= hub.com/kaushalmodi/.emacs.d/commit/912c4fc8bf4ed0c84e28dc837b0500b9a2e172c= a=C2=A0) wasn't working the same way in emacs 24.5 as it does in em= acs 25.x.

Here is a dummy example to demonstrate t= his (which is almost the same as posted by Artur in the first email of this= thread):

=3D=3D=3D=3D=3D
(defun fo= o ()
=C2=A0 (interactive)
=C2=A0 (message (format "= ;this-command-keys: %S, this-single-command-keys: %s"
=C2=A0 (this-c= ommand-keys)
=C2=A0 (this-single-command-keys))))
(global-set-k= ey (kbd "C-c ;") #'foo)
=3D=3D=3D=3D=3D
=

After evaluating the above, doing C-u C-c ; gives the f= ollowing results on different versions of emacs:

2= 4.5:=C2=A0this-command-keys: "^U^C;", this-single-command-keys: [= 3 59]
25.0.93: this-command-keys: "^C;", this-single-co= mmand-keys: [3 59]

(of course I have stringifi= ed the ^U and ^C portions above to make them visible in the email)


It= 9;s commit log says "Restore the feature whereby C-u=C2=A0was 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.

Current= ly 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 a= ctually is happening:

=
C-h f this-command-keys o= n emacs 25.0.93 gives:
=3D=3D=3D=3D=3D
this-command-keys is a built-in function in =E2=80=98C source= code=E2=80=99.

(this-command-keys)

=
Return the key sequence that invoked this command.
How= ever, if the command has called =E2=80=98read-key-sequence=E2=80=99, it ret= urns
the last key sequence that has been read.
The valu= e is a string or a vector.
=3D=3D=3D=3D=3D

C-h f this-single-command-keys on emacs 25.0.93 gives:
<= br>
=3D=3D=3D=3D=3D
this-single-command-keys is a = built-in function in =E2=80=98C source code=E2=80=99.

<= div>(this-single-command-keys)

Return the key sequ= ence that invoked this command.
More generally, it returns the la= st key sequence read, either by
the command loop or by =E2=80=98r= ead-key-sequence=E2=80=99.
Unlike =E2=80=98this-command-keys=E2= =80=99, this function=E2=80=99s value
^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^^^^^^^^^^^^^^^^^^^^^^
does not include prefix arguments.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The value is always a vector= .
=3D=3D=3D=3D=3D
--
=

--
Kaushal Modi

--001a113cf2f64e88950532911648--