问题描述
如何获取可在Emacs Lisp中使用的非交互式功能的完整列表?
How do I get a complete list of non-interactive functions that I can use in Emacs Lisp?
交互式功能很容易在帮助系统中找到,但我想要一个完整的列表,我可以使用所有其他功能。例如 concat
, car
, cdr
等(最好用文档)。
The interactive ones are easy enough to find in the help system, but I want a complete list of all the other functions I can use. For example concat
, car
, cdr
, etc. (And preferably with documentation).
谢谢
Ed
编辑:感谢Jouni。我玩了一下他的答案,并得到它来排序结果(使用他的代码的结果,以帮助我找到正确的排序功能!)
Answered thanks to Jouni. I played around with his answer a bit, and got it to sort the results (using the results of his code to help me find the correct sorting function!)
(flet ((first-line (text)
(if text
(substring text 0 (string-match "\n" text))
"")))
(let ((funclist (list)))
(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?
(add-to-list 'funclist
(concat (symbol-name x) " - " (first-line (documentation x))
"\n")))))
(dolist (item (sort funclist 'string<))
(insert item))))
推荐答案
这是基本的我dea - 有关任何不清楚的概念,请参阅。
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")))))
这篇关于如何获取Emacs lisp非交互式功能的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!