help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eval keymapp in a macros


From: Michael Heerdegen
Subject: Re: Eval keymapp in a macros
Date: Thu, 05 Aug 2021 01:56:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Arthur Miller <arthur.miller@live.com> writes:

> > Your `keymapp' fix is an emergency solution but it's not perfect:
> > that test happens at compile time.  If the keymap is not defined at
> > compile time your compiled code will be inappropriate.

I see now that I was wrong here - the test is performed at run-time.

> I agree, but do I wish to pass name of undefined keymap to define-key?

Not at run-time: when the `define-key' call is evaluated, the symbol
must be bound, else you would get an error.

But some way or the other something has to decide how to interpret a
symbol.  If you want to use the same notation for the cases, you need to
use some kind of heuristic: in theory a symbol might name a function and
might be bound to a keymap at the same time.

And instead of `eval' better use `bound-and-true-p' - you know that you
look at a symbol.  You could also check whether the `symbol-name' ends
with "...-map".

Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]