GNU bug report logs - #15653
24.3; call-interactively not sending keys

Previous Next

Package: emacs;

Reported by: Matthew Fidler <matthew.fidler <at> gmail.com>

Date: Sat, 19 Oct 2013 18:51:02 UTC

Severity: normal

Tags: fixed

Found in version 24.3

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15653 in the body.
You can then email your comments to 15653 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15653; Package emacs. (Sat, 19 Oct 2013 18:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthew Fidler <matthew.fidler <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 19 Oct 2013 18:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matthew Fidler <matthew.fidler <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; call-interactively not sending keys
Date: Sun, 20 Oct 2013 02:50:16 +0800
[Message part 1 (text/plain, inline)]
After starting emacs -Q evaluate the following:


(defun test-me ()
(interactive)
(message "Test Me: %s" (key-description (this-single-command-keys))))

(defun test-me-2 ()
(interactive)
(message "Test Me 2: %s" (key-description (this-single-command-keys)))
(call-interactively 'test-me nil (read-kbd-macro "C-1" t)))


(global-set-key (read-kbd-macro "C-c a" t) 'test-me-2)

Then, Type C-c a. The message shows:

Test Me 2: C-c a
Test Me: C-c a

It should show

Test Me 2: C-1
Test Me: C-c a

At least thats how I understand the call-interactevly documentation:

This function calls the interactively callable function command, providing
arguments according to its interactive calling specifications. It returns
whatever command returns.

If, for instance, you have a function with the following signature:

(defun foo (begin end)
(interactive "r")
...)
then saying

(call-interactively 'foo)
will call foo with the region (point and mark) as the arguments.

An error is signaled if command is not a function or if it cannot be called
interactively (i.e., is not a command). Note that keyboard macros (strings
and vectors) are not accepted, even though they are considered commands,
because they are not functions. If command is a symbol, then
call-interactively uses its function definition.

If record-flag is non-nil, then this command and its arguments are
unconditionally added to the list command-history. Otherwise, the command
is added only if it uses the minibuffer to read an argument. See Command
History.

The argument keys, if given, should be a vector which specifies the
sequence of events to supply if the command inquires which events were used
to invoke it. If keys is omitted or nil, the default is the return value of
this-command-keys-vector. See Definition of this-command-keys-vector.



In GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
of 2013-08-29 on puppypc11169
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
Configured using:
`configure
'--bindir=/tmp/emacs-24.3-bin/App/emacs-24.3/linux-i686-2.15/bin'
'--libexecdir=/tmp/emacs-24.3-bin/App/emacs-24.3/linux-i686-2.15/libexec'
'--datadir=/tmp/emacs-24.3-bin/App/emacs-24.3/etc'
'--info=/tmp/emacs-24.3-bin/App/emacs-24.3/info'
'--prefix=/tmp/emacs-24.3-bin''

Important settings:
value of $EMACSDATA:
/initrd/mnt/dev_save/EmacsPortable.App/App/emacs-24.3/etc
value of $EMACSDOC:
/initrd/mnt/dev_save/EmacsPortable.App/App/emacs-24.3/etc
value of $EMACSLOADPATH:
/initrd/mnt/dev_save/EmacsPortable.App/App/emacs-24.3/lisp/:/initrd/mnt/dev_save/EmacsPortable.App/App/site-lisp/

value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
show-paren-mode: t
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t

Recent input:
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> g l o b a l - s e t - k e y SPC <backspace>
h f <backspace> <backspace> C-h f <return> <down-mouse-1>
<mouse-1> M-x e v a l - u <backspace> b u <tab> <return>
<down> <down> <down> <down> <down> <down> <left> <down-mouse-4>
<mouse-4> <help-echo> <help-echo> <help-echo> <help-echo>
<menu-bar> <options> <highlight-paren-mode> <backspace>
<backspace> <down-mouse-2> <mouse-2> <down> <down>
<down> <down> <down> <left> <down> <down> <left> )
_ <backspace> M-x e v a l - b u <tab> <return> <down>
<down> <down> <down> <down> ) ) <down> <down> <down>
<up> M-x e v a l - b u <tab> <return> <up> <up> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <up> <up> <up> <up> <up> <up> <up> <up> <up>
x 1 <down> <down> <down> <down> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> ) M-x e v a l - b u <tab> <return>
<right> <left> <up> <up> <up> <up> <up> <S-up> <S-left>
<S-home> <backspace> <backspace> <down> <down> <S-up>
<S-up> <S-up> <S-up> <S-home> <backspace> M-x e v a
l - b u <tab> <return> <down> <down> <down> <left>
<down> <down> <left> <backspace> M-x e v a l - b u
<tab> <return> <down> <down> <down> <down> <down> <down>
<down> <left> - 1 <backspace> 2 M-x e v a l - b u <tab>
<down-mouse-3> <mouse-3> <return> <down-mouse-5> <mouse-5>
<down-mouse-4> <mouse-4> <down-mouse-5> <mouse-5> <double-down-mouse-5>
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5>
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5>
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5>
<down-mouse-4> <mouse-4> <down-mouse-5> <mouse-5> <double-down-mouse-5>
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5>
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5>
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5>
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5>
<triple-mouse-5> <triple-down-mouse-5> <triple-mouse-5>
<triple-down-mouse-5> <triple-mouse-5> <help-echo>
<down-mouse-1> <mouse-movement> <mouse-1> <help-echo>
<help-echo> <return> c <backspace> C-c a <help-echo>
<down-mouse-1> <mouse-1> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu>
<send-emacs-bug-report>

Recent messages:
Show-Paren mode enabled
Mark set
call-interactively: End of file during parsing [3 times]
Mark set [2 times]
byte-code: Beginning of buffer
call-interactively: Invalid read syntax: ")"
byte-code: Beginning of buffer
byte-code: End of buffer [14 times]
Test Me 2: C-c a
Test Me: C-c a

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils edmacro kmacro cus-start cus-load paren help-mode
easymenu help-fns time-date tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15653; Package emacs. (Thu, 15 Aug 2019 03:13:02 GMT) Full text and rfc822 format available.

Message #8 received at 15653 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matthew Fidler <matthew.fidler <at> gmail.com>
Cc: 15653 <at> debbugs.gnu.org
Subject: Re: bug#15653: 24.3; call-interactively not sending keys
Date: Wed, 14 Aug 2019 20:12:08 -0700
Matthew Fidler <matthew.fidler <at> gmail.com> writes:

> After starting emacs -Q evaluate the following: 
>
> (defun test-me () 
> (interactive) 
> (message "Test Me: %s" (key-description (this-single-command-keys)))) 
>
> (defun test-me-2 () 
> (interactive) 
> (message "Test Me 2: %s" (key-description (this-single-command-keys))) 
> (call-interactively 'test-me nil (read-kbd-macro "C-1" t))) 
>
> (global-set-key (read-kbd-macro "C-c a" t) 'test-me-2) 
>
> Then, Type C-c a. The message shows: 
>
> Test Me 2: C-c a 
> Test Me: C-c a 
>
> It should show 
>
> Test Me 2: C-1 
> Test Me: C-c a 

The documentation here is rather unclear:

---
Optional third arg KEYS, if given, specifies the sequence of events to
supply, as a vector, if the command inquires which events were used to
invoke it.
---

But apparently `this-single-command-keys' is not the way to inquire
about what events were used to invoke it, and I'm not quite sure what
this is in reference to.  I thought that perhaps it was an interactive
spec or something, but no.

Reading the source code wasn't enlightening, either.  Anybody know what
"inquires which events" is in reference to?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15653; Package emacs. (Sat, 17 Aug 2019 07:19:02 GMT) Full text and rfc822 format available.

Message #11 received at 15653 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: matthew.fidler <at> gmail.com, 15653 <at> debbugs.gnu.org
Subject: Re: bug#15653: 24.3; call-interactively not sending keys
Date: Sat, 17 Aug 2019 10:18:41 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Wed, 14 Aug 2019 20:12:08 -0700
> Cc: 15653 <at> debbugs.gnu.org
> 
> > (defun test-me () 
> > (interactive) 
> > (message "Test Me: %s" (key-description (this-single-command-keys)))) 
> >
> > (defun test-me-2 () 
> > (interactive) 
> > (message "Test Me 2: %s" (key-description (this-single-command-keys))) 
> > (call-interactively 'test-me nil (read-kbd-macro "C-1" t))) 
> >
> > (global-set-key (read-kbd-macro "C-c a" t) 'test-me-2) 
> >
> > Then, Type C-c a. The message shows: 
> >
> > Test Me 2: C-c a 
> > Test Me: C-c a 
> >
> > It should show 
> >
> > Test Me 2: C-1 
> > Test Me: C-c a 

I don't understand the expectation: nothing in the documentation says
that the KEYS argument to call-interactively is stuffed into what
this-single-command-keys will return.  The documentation says that the
KEYS argument will be used instead of this-single-command-keys when
the called command needs to access the events that invoked it, that's
all.

> Optional third arg KEYS, if given, specifies the sequence of events to
> supply, as a vector, if the command inquires which events were used to
> invoke it.
> ---
> 
> But apparently `this-single-command-keys' is not the way to inquire
> about what events were used to invoke it, and I'm not quite sure what
> this is in reference to.  I thought that perhaps it was an interactive
> spec or something, but no.

Yes, it _is_ the interactive spec.  When that spec uses 'e' or '@' or
something else that needs to analyze the invoking events, then Emacs
provides the information from KEYS instead.

I don't really see hat needs to be clarified in the docs, but given
the above, perhaps Lars or Matthew could propose a clarification?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15653; Package emacs. (Sat, 17 Aug 2019 21:22:02 GMT) Full text and rfc822 format available.

Message #14 received at 15653 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: matthew.fidler <at> gmail.com, 15653 <at> debbugs.gnu.org
Subject: Re: bug#15653: 24.3; call-interactively not sending keys
Date: Sat, 17 Aug 2019 14:21:00 -0700
Eli Zaretskii <eliz <at> gnu.org> writes:

> Yes, it _is_ the interactive spec.  When that spec uses 'e' or '@' or
> something else that needs to analyze the invoking events, then Emacs
> provides the information from KEYS instead.
>
> I don't really see hat needs to be clarified in the docs, but given
> the above, perhaps Lars or Matthew could propose a clarification?

The confusion that both Matthew and me had here was that the doc string
talked about "inquiring what events that invoked it", and
`this-command-keys' talks about "return the key sequence that invoked
this command".  So it's not an unnatural inference to make that these
things are somehow tied together.

I've now clarified the call-interactively doc string to say explicitly
that the argument affects the return value of the interactive spec of
FUNCTION.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 17 Aug 2019 21:22:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 15653 <at> debbugs.gnu.org and Matthew Fidler <matthew.fidler <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 17 Aug 2019 21:22:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 15 Sep 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 337 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.