Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listing all top level global variables in emacs

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-

like image 235
lucidquiet Avatar asked Feb 22 '23 12:02

lucidquiet


1 Answers

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.

like image 104
huaiyuan Avatar answered Mar 04 '23 05:03

huaiyuan