Listing all top level global variables in emacs

旧时模样 提交于 2019-12-23 12:33:58

问题


Mostly for my own edification I'm trying to list all of the global variables loaded in the current Emacs session. What I was thinking about doing is producing an HTML file with all of the functions listed. Of course, what would also be useful is the file where the function, var, etc was defined.

Is there anything already built into emacs to help?

L-


回答1:


Something along these lines should do:

(let ((result '()))
  (mapatoms (lambda (x)
              (when (boundp x)
                (let ((file (ignore-errors
                              (find-lisp-object-file-name x 'defvar))))
                  (when file
                    (push (cons x file) result))))))
  result)

Warning: it takes a long time to finish.



来源:https://stackoverflow.com/questions/8031246/listing-all-top-level-global-variables-in-emacs

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