Listing all top level global variables in emacs

2019-06-24 14:30发布

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条回答
别忘想泡老子
2楼-- · 2019-06-24 15:06

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.

查看更多
登录 后发表回答