0

How can one list all the globally defined variables (ideally with their global-scope values) for the current Emacs session?

1 Answer 1

4

Looking at the source code for describe-variable and obarray, it seems that the following should give you what you want.

(defun global-bindings () (let (res) (mapatoms (lambda (vv) (when (and (boundp vv) (not (keywordp vv)) (get vv 'variable-documentation)) (push (cons vv (symbol-value vv)) res)))) res)) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.