Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

print symbols of emacs in elisp

Tags:

emacs

elisp

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?

like image 436
Talespin_Kit Avatar asked Mar 02 '12 10:03

Talespin_Kit


People also ask

What is a symbol in 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.

What does #' mean in Emacs Lisp?

function (aka #' ) is used to quote functions, whereas quote (aka ' ) is used to quote data.

What is a symbol in Emacs Lisp?

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.

How to intern a symbol in an obarray in Emacs Lisp?

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.

What is a symbol name in Lisp?

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.


Video Answer


1 Answers

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.

like image 58
Bozhidar Batsov Avatar answered Sep 28 '22 07:09

Bozhidar Batsov