Mark H Weaver <m...@netris.org> skribis: > Shane Celis <shane.ce...@gmail.com> 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’.