How to print all defined variables in emacs?

Mx <TAB> prints all defined functions.

To test a variable, the following expression is defined or not evaluated (variable boundp name) Cx Ce will print t if the variable name is otherwise specified nill.

How to print all defined variables in emacs.

+8
emacs
source share
3 answers

It is not clear what exactly you want to do with a complete list of characters, since the way to display Mx function names is somewhat specialized.

Assuming you want to programmatically get a list of all the specific characters, here is how auto-complete.el does it:

 (loop for x being the symbols if (boundp x) collect (symbol-name x)) 

Note that you can also type Mx describe-var RET , and then press TAB to get a list of sorted terminations of all characters.

+8
source share

I assume that (apropos-variable "." t) will show you all the variables defined at that point in time.

edit: I assumed this is wrong.

Interestingly, this actually shows me significantly fewer results than autocomplete from describe-var .

Can anyone shed some light on this?

eg. differences between them when winner-mode enabled:

  • Cu Mx apropos-variable RET winner- RET
  • Ch v winner- TAB

edit 2: Ah ... it looks like apropos can ignore any character that doesn't have a documentation line.

If possible, I suggest reassigning the accepted answer.

+4
source share

Extrapolating (strongly!) What the query is about, here is a way to get a pretty-printed list of all the buffer local variables with their values. This is very convenient for finding out why, for example, the mode does not behave as you expect.

To get this list, do:

 Mx pp-eval-expression RET (buffer-local-variables) RET 

Relevant parts from this list can be added almost verbatim to the .dir-locals.el for use with multiple files.

+2
source share

All Articles