[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacsy: Context Sensitive Commands Design Question
From: |
Ludovic Courtès |
Subject: |
Re: Emacsy: Context Sensitive Commands Design Question |
Date: |
Fri, 30 Aug 2013 13:32:02 +0200 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
Mark H Weaver <address@hidden> skribis:
> Shane Celis <address@hidden> writes:
>
>> 6. Tag commands as special procedures perhaps by adding something to
>> their procedure properties. Implement a "command?" procedure. Export
>> commands and procedures to the same module. Then just pluck the
>> commands out of all the procedures by using command?.
>
> This is closest to what Emacs does, and probably the best solution, IMO. See
> <https://www.gnu.org/software/emacs/manual/html_node/elisp/Interactive-Call.html>
> which describes the 'commandp' predicate, whose definition is in eval.c.
I concur (Thien-Thi’s message shows how this can be achieved.)
So it’s a matter of extending Emacsy’s ‘define-interactive’ to add an
object property.
Then you could have a ‘fold-commands’ procedure that traverses all the
bindings of all the available modules (or a subset thereof), and
iterates on those that match ‘command?’.
Ludo’.