M-x < TAB > prints all the defined functions.
To check a variable is defined or not evaluating the following expression, (boundp 'variable-name) C-x C-e will print开发者_如何学C t if the variable-name is defined else nill.
How to print all the defined variables in emacs.
It's unclear exactly what you want to do with a full list of symbols, since the way in which M-x
displays function names is somewhat specialized.
Assuming that you want to programmatically obtain a list of all defined symbols, here's how auto-complete.el
does it:
(loop for x being the symbols
if (boundp x)
collect (symbol-name x))
Note that you can also enter M-x describe-var RET
, and then press TAB
to get a sorted completion list of all symbols.
I presume (apropos-variable "." t)
would show you all the variables defined at that point in time.
edit: I presumed wrongly, it would seem.
Interestingly, this actually shows me significantly fewer results than the auto-completions from describe-var
.
Can anyone shed light on that?
e.g. the differences between these, when winner-mode
has been enabled:
- C-uM-x
apropos-variable
RETwinner-
RET - C-hv
winner-
TAB
edit 2: Ah... it looks like apropos may ignore any symbol which lacks a documentation string.
If it's possible, I suggest reassigning the accepted answer.
Extrapolating (heavily!) what is being asked for, here is a way to get a pretty-printed alist of all buffer-local variables with their values. This is very convenient for finding out why for instance a mode isn't behaving the way one expects.
To get this listing, do:
M-x pp-eval-expression RET (buffer-local-variables) RET
Relevant portions from this list can be added almost verbatim to a .dir-locals.el
file for use with multiple files.
精彩评论