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: Drew Adams
Subject: RE: How to get a list of all commands with given prefix?
Date: Tue, 18 Mar 2014 16:25:53 -0700 (PDT)

> I wonder how I can easily get a list of all interactive commands with a
> given prefix 'foo-' in a program (non-interactively)?

(defun foo (prefix &optional msgp)
  (interactive "sPrefix: \np")
  (let ((cmds  ()))
    (mapatoms
     (lambda (symb) (when (and (commandp symb)
                          (string-match-p
                           (format "\\`%s" (regexp-quote prefix))
                           (symbol-name symb)))
                 (push symb cmds))))
    (when msgp (pp-eval-expression 'cmds))))

(Interactive only so you can check it.)



reply via email to

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