unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15653: 24.3; call-interactively not sending keys
@ 2013-10-19 18:50 Matthew Fidler
  2019-08-15  3:12 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Fidler @ 2013-10-19 18:50 UTC (permalink / raw)
  To: 15653

[-- Attachment #1: Type: text/plain, Size: 6903 bytes --]

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)

[-- Attachment #2: Type: text/html, Size: 9278 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15653: 24.3; call-interactively not sending keys
  2013-10-19 18:50 bug#15653: 24.3; call-interactively not sending keys Matthew Fidler
@ 2019-08-15  3:12 ` Lars Ingebrigtsen
  2019-08-17  7:18   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-15  3:12 UTC (permalink / raw)
  To: Matthew Fidler; +Cc: 15653

Matthew Fidler <matthew.fidler@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15653: 24.3; call-interactively not sending keys
  2019-08-15  3:12 ` Lars Ingebrigtsen
@ 2019-08-17  7:18   ` Eli Zaretskii
  2019-08-17 21:21     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2019-08-17  7:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: matthew.fidler, 15653

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 14 Aug 2019 20:12:08 -0700
> Cc: 15653@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?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15653: 24.3; call-interactively not sending keys
  2019-08-17  7:18   ` Eli Zaretskii
@ 2019-08-17 21:21     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-17 21:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: matthew.fidler, 15653

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-17 21:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-19 18:50 bug#15653: 24.3; call-interactively not sending keys Matthew Fidler
2019-08-15  3:12 ` Lars Ingebrigtsen
2019-08-17  7:18   ` Eli Zaretskii
2019-08-17 21:21     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).