unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Arthur Miller <arthur.miller@live.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Eval keymapp in a macros
Date: Thu, 05 Aug 2021 01:56:08 +0200	[thread overview]
Message-ID: <871r78ydbb.fsf@web.de> (raw)
In-Reply-To: <AM9PR09MB49775FC2C83DE038A49EFC4996F19@AM9PR09MB4977.eurprd09.prod.outlook.com> (Arthur Miller's message of "Wed, 04 Aug 2021 12:52:09 +0200")

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	other threads:[~2021-08-04 23:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 12:16 Eval keymapp in a macros Arthur Miller
2021-08-02 20:33 ` Michael Heerdegen
2021-08-02 20:53   ` [External] : " Drew Adams
2021-08-03 21:20   ` Arthur Miller
2021-08-04  0:18     ` Michael Heerdegen
2021-08-04 10:52       ` Arthur Miller
2021-08-04 23:56         ` Michael Heerdegen [this message]
2021-08-05  6:03           ` Arthur Miller
2021-08-06  3:54             ` Michael Heerdegen
2021-08-12 20:28               ` Arthur Miller
2021-08-04  4:54     ` Yuri Khan
2021-08-04  9:38       ` Arthur Miller
2021-08-04 15:37         ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-05  6:12           ` Arthur Miller
2021-08-05 13:53             ` Stefan Monnier
2021-08-05 16:04               ` Arthur Miller
2021-08-05 16:34                 ` Stefan Monnier
2021-08-06  4:17                   ` Michael Heerdegen
2021-08-12 20:21                     ` Arthur Miller
2021-08-05  0:03         ` Michael Heerdegen
2021-08-05  6:15           ` Arthur Miller
2021-08-06  3:18             ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871r78ydbb.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=arthur.miller@live.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).