如何获得可以在Emacs Lisp中使用的非交互式功能的完整列表?

交互式的很容易在帮助系统中找到,但我想要一个完整的列表,列出我可以使用的所有其他功能。例如 concat car cdr 等(最好带文档)。

由于

编辑:回答感谢Jouni。我对他的回答进行了一些调整,然后对结果进行排序(使用他的代码结果来帮助我找到正确的排序函数!)

(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))))
有帮助吗?

解决方案

以下是基本想法 - 请参阅 Emacs Lisp手册不清楚的概念。

(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")))))

其他提示

尝试 apropos 而不是 apropos-command 。这将为您提供所有功能,而不仅仅是交互功能。 C-h a 默认绑定到后者,但如果你做了很多elisp黑客攻击,我建议将它绑定到前者。

你可以检查obarray的内容,虽然它包含所有符号,而不是“所有函数”。

或者,以下可能会做到这一点(将拉入CL兼容包的部分内容):

(减少(lambda(到目前为止)(if(fboundp next)(下一个到目前为止)到目前为止))     obarray     :初始值为零)

你可能比查看网站更糟糕

尝试使用空输入的apropos命令。

没关系。事实证明,Ch f(描述函数)确实包含非交互式函数,但我仍然有兴趣找到一种只查看/搜索非交互式函数的方法(特别是只有内置函数)。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top