如何获取Emacs lisp非交互式功能的列表? [英] How do I get a list of Emacs lisp non-interactive functions?

查看:121
本文介绍了如何获取Emacs lisp非交互式功能的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取可在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 - 有关任何不清楚的概念,请参阅 Emacs Lisp手册

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非交互式功能的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆