How do I get a list of Emacs lisp non-interactive functions?

梦想与她 提交于 2019-12-02 20:54:14

Here's the basic idea - see the Emacs Lisp manual for any unclear concepts.

(flet ((first-line (text)
         (if text
             (substring text 0 (string-match "\n" text))
           "")))
  (mapatoms 
   (lambda (x)
     (and (fboundp x)                          ; does x name a function?
          (not (commandp (symbol-function x))) ; is it non-interactive?
          (subrp (symbol-function x))          ; is it built-in?
          (insert (symbol-name x) " - " (first-line (documentation x)) "\n")))))

Try apropos instead of apropos-command. That will give you all the functions, not just the interactive ones. C-h a is bound by default to the latter, but if you're doing a lot of elisp hacking, I recommend binding it to the former.

You could check the contents of obarray, though that contains all symbols, rather than "all functions".

Alternatively, the following may do the trick (will pull in parts of the CL compatability package):

(reduce (lambda (so-far next) (if (fboundp next) (cons next so-far) so-far)) obarray :initial-value nil)

you could do worse than look at the website

Try the apropos command with an empty input.

Nevermind. It turns out that C-h f (describe function) does include non-interactive functions, though I'd still be interested in finding a way of viewing/searching only the non-interactive ones (especially only the built in ones).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!