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

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

Re: How to get a list of all commands with given prefix?


From: Thorsten Jolitz
Subject: Re: How to get a list of all commands with given prefix?
Date: Wed, 19 Mar 2014 01:09:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Jambunathan K <kjambunathan@gmail.com> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Hi List, 
>>
>> I wonder how I can easily get a list of all interactive commands with a
>> given prefix 'foo-' in a program (non-interactively)?
>
>
> Use this as a starter.
>
>     (require 'cl)
>     (remove-if-not 'commandp obarray)

thanks, that brought me on the right track. So its really easy to get
a list of the impressive number of org-mode commands:

#+begin_src emacs-lisp
  (setq org-cmds nil)
  (defun omm-get-org-cmd-syms (s)
    "Return a list of all symbols in obarray that are Org commands."
    (and (commandp s)
         (string-match "\\(^org-\\|^orgtbl-\\)" (symbol-name s))
         (push s org-cmds)))
  (mapatoms 'omm-get-org-cmd-syms)
  (length org-cmds)
#+end_src

#+results:
: 639


-- 
cheers,
Thorsten




reply via email to

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