* On definition of `kbd'
@ 2006-10-11 11:09 Herbert Euler
2006-10-11 11:16 ` David Kastrup
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Euler @ 2006-10-11 11:09 UTC (permalink / raw)
I find definition of `kbd' is:
(defmacro kbd (keys)
"Convert KEYS to the internal Emacs key representation.
KEYS should be a string constant in the format used for
saving keyboard macros (see `edmacro-mode')."
(read-kbd-macro keys))
This would cause problem when evaluating
(kbd (car list))
where the `car' of a list is a key sequence text. Is the
definition correct? I think the body should be
`(read-kbd-macro ,keys)
Regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: On definition of `kbd'
2006-10-11 11:09 On definition of `kbd' Herbert Euler
@ 2006-10-11 11:16 ` David Kastrup
2006-10-11 14:24 ` Stuart D. Herring
0 siblings, 1 reply; 3+ messages in thread
From: David Kastrup @ 2006-10-11 11:16 UTC (permalink / raw)
Cc: emacs-devel
"Herbert Euler" <herberteuler@hotmail.com> writes:
> I find definition of `kbd' is:
>
> (defmacro kbd (keys)
> "Convert KEYS to the internal Emacs key representation.
> KEYS should be a string constant in the format used for
> saving keyboard macros (see `edmacro-mode')."
> (read-kbd-macro keys))
>
> This would cause problem when evaluating
>
> (kbd (car list))
>
> where the `car' of a list is a key sequence text.
In this case, KEYS is the list `(car list)' and not a string constant.
> Is the definition correct? I think the body should be
>
> `(read-kbd-macro ,keys)
That would completely defeat the purpose of having a macro, namely
being able to do compile-time evaluation.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: On definition of `kbd'
2006-10-11 11:16 ` David Kastrup
@ 2006-10-11 14:24 ` Stuart D. Herring
0 siblings, 0 replies; 3+ messages in thread
From: Stuart D. Herring @ 2006-10-11 14:24 UTC (permalink / raw)
Cc: Herbert Euler, emacs-devel
>> Is the definition correct? I think the body should be
>>
>> `(read-kbd-macro ,keys)
>
> That would completely defeat the purpose of having a macro, namely
> being able to do compile-time evaluation.
To elaborate on David's response: if you really want to get a key sequence
representation of a dynamic string, just use the `read-kbd-macro' function
that the `kbd' macro calls. `kbd' is for when you just want to do
something simple and direct (read: hardcoded) in Lisp: (kbd "C-x C-c").
The result is human-readable but during byte-compilation actually becomes
"^X^C" (two characters), so there's no performance penalty.
Hope this helps,
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-10-11 14:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-11 11:09 On definition of `kbd' Herbert Euler
2006-10-11 11:16 ` David Kastrup
2006-10-11 14:24 ` Stuart D. Herring
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).