How to print all the symbols in emacs using elisp.
It is possible to test wheather a lisp object is a symbol using symbolp function. But how to collect all the symbols.
Is it possible to access symbol table of emacs?
A symbol in GNU Emacs Lisp is an object with a name. The symbol name serves as the printed representation of the symbol. In ordinary Lisp use, with one single obarray (see Creating Symbols), a symbol's name is unique—no two symbols have the same name.
function (aka #' ) is used to quote functions, whereas quote (aka ' ) is used to quote data.
A symbol in GNU Emacs Lisp is an object with a name. The symbol name serves as the printed representation of the symbol. In ordinary Lisp use, with one single obarray (see Creating and Interning Symbols ), a symbol’s name is unique—no two symbols have the same name. A symbol can serve as a variable, as a function name, or to hold a property list.
Common Lisp note: In Common Lisp, you can intern an existing symbol in an obarray. In Emacs Lisp, you cannot do this, because the argument to intern must be a string, not a symbol. Function: intern-soft name &optional obarray This function returns the symbol in obarray whose name is name, or nil if obarray has no symbol with that name.
A symbol in GNU Emacs Lisp is an object with a name. The symbol name serves as the printed representation of the symbol. In ordinary Lisp use, with one single obarray (see Creating Symbols ), a symbol's name is unique—no two symbols have the same name.
Here's one way to do it:
(require 'cl)
(loop for x being the symbols
if (boundp x)
collect (symbol-name x))
loop
is a Common Lisp macro, that has been ported to Emacs Lisp as well. It's part of the cl
package (part of the standard Emacs distribution), that you'll have to require
to use it.
Another option to consider is probably:
(apropos "." t)
The apropos
invokation will take significantly more time to complete, but you'll get more information about the symbols that way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With