* Passing key bound to function as argument
@ 2005-10-27 17:03 August Karlstrom
2005-10-27 18:53 ` Kevin Rodgers
[not found] ` <mailman.12946.1130439541.20277.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 5+ messages in thread
From: August Karlstrom @ 2005-10-27 17:03 UTC (permalink / raw)
Hello all,
Suppose I want to make my own `self-insert-command' (but implemented in
Elisp). How would I go about?
August
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Passing key bound to function as argument
2005-10-27 17:03 Passing key bound to function as argument August Karlstrom
@ 2005-10-27 18:53 ` Kevin Rodgers
[not found] ` <mailman.12946.1130439541.20277.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2005-10-27 18:53 UTC (permalink / raw)
August Karlstrom wrote:
> Suppose I want to make my own `self-insert-command' (but implemented in
> Elisp). How would I go about?
(defun self-insert-command (n)
(interactive "p")
...)
But it won't get called, because command_loop_1 optimizes out the call
to the Lisp binding and uses the C binding (Fself_insert_command) directly.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Passing key bound to function as argument
[not found] ` <mailman.12946.1130439541.20277.help-gnu-emacs@gnu.org>
@ 2005-10-27 20:58 ` August Karlstrom
2005-10-27 21:10 ` Edward O'Connor
[not found] ` <mailman.12961.1130447654.20277.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 5+ messages in thread
From: August Karlstrom @ 2005-10-27 20:58 UTC (permalink / raw)
Kevin Rodgers wrote:
> August Karlstrom wrote:
> > Suppose I want to make my own `self-insert-command' (but implemented in
> > Elisp). How would I go about?
>
> (defun self-insert-command (n)
> (interactive "p")
> ...)
>
> But it won't get called, because command_loop_1 optimizes out the call
> to the Lisp binding and uses the C binding (Fself_insert_command) directly.
I have already tried
(defun my-self-insert-command (n)
(interactive "p")
(insert n))
(global-set-key "a" 'my-self-insert-command)
(global-set-key "b" 'my-self-insert-command)
Pressing either a or b inserts the character with ordinal number 1
(instead of a or b) so that doesn't work.
August
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Passing key bound to function as argument
2005-10-27 20:58 ` August Karlstrom
@ 2005-10-27 21:10 ` Edward O'Connor
[not found] ` <mailman.12961.1130447654.20277.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 5+ messages in thread
From: Edward O'Connor @ 2005-10-27 21:10 UTC (permalink / raw)
This is not the best way to do what you'd like, but ItWorksForMe(TM):
(defun ted-self-insert-command ()
(insert (this-command-keys)))
Ted
--
Edward O'Connor
hober0@gmail.com
Ense petit placidam sub libertate quietem.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Passing key bound to function as argument
[not found] ` <mailman.12961.1130447654.20277.help-gnu-emacs@gnu.org>
@ 2005-10-27 21:55 ` August Karlstrom
0 siblings, 0 replies; 5+ messages in thread
From: August Karlstrom @ 2005-10-27 21:55 UTC (permalink / raw)
Edward O'Connor wrote:
> This is not the best way to do what you'd like, but ItWorksForMe(TM):
>
> (defun ted-self-insert-command ()
> (insert (this-command-keys)))
Thanks. I wrote my function like
(defun f (key)
(interactive (list (this-command-keys)))
...)
August
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-10-27 21:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-27 17:03 Passing key bound to function as argument August Karlstrom
2005-10-27 18:53 ` Kevin Rodgers
[not found] ` <mailman.12946.1130439541.20277.help-gnu-emacs@gnu.org>
2005-10-27 20:58 ` August Karlstrom
2005-10-27 21:10 ` Edward O'Connor
[not found] ` <mailman.12961.1130447654.20277.help-gnu-emacs@gnu.org>
2005-10-27 21:55 ` August Karlstrom
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).