14
votes
Accepted
How to use keyword symbols in Emacs Lisp?
They are usually used as keys ("properties") in a property list. E.g the variable org-publish-project-alist contains one or more property lists with keys like :base-directory, :publishing-...
13
votes
Accepted
How to make (make-symbol "foo") (make-symbol "foo") equal?
Do i have a misconception of symbols? Aren't they just strings without double-quotes?
You do indeed have a misconception.
A symbol is a lisp object containing numerous properties (including its name,...
13
votes
Meaning of CRM column in buffer list from `C-x C-b`?
`C' shows `>' if you have marked the buffer to be displayed,
`D' if you have marked it for deletion, and
`.' for the buffer from which you came (current).
`R' shows `%' if the ...
13
votes
Accepted
Exporting unicode characters to pdf using latex from org mode
You need the latex file to use \usepackage[utf8x]{inputenc} rather than the default \usepackage[utf8]{inputenc}. This works with standard (pdf)latex.
For org export to generate this you have to set ...
13
votes
Accepted
What does “:” mean in elisp?
It turns the symbol into a keyword. See chapter 12.2 Variables that Never Change in the Emacs Lisp manual.
Keywords are frequently used to identify named arguments to Lisp functions and macros. When ...
8
votes
Accepted
Function naming with forward slash?
There's no name space in Emacs lisp, so people use various prefixes to avoid name clash. Section D.1 of Emacs lisp reference manual recommends using a short prefix followed by one or two hyphen(s):
...
8
votes
When is the first element in the argument list regarded as a function symbol and when not?
the first element of a list is interpreted as a function symbol
That's the most common case, but it isn't an absolute rule.
First, you need to know that every symbol can have both a function meaning (...
7
votes
Accepted
Difference between (quote string) and "string"
'list and "list" are different datatypes:
ELISP> (type-of 'list)
symbol
ELISP> (type-of "list")
string
Note that they even show up differently in your example -- it's the difference between ...
7
votes
How to use keyword symbols in Emacs Lisp?
I think the documentation you've linked to is comprehensive on the matter of their value:
In Emacs Lisp, certain symbols normally evaluate to
themselves. These include nil and t, as well as any ...
7
votes
How to use keyword symbols in Emacs Lisp?
To add a tiny bit to what others have said -
Think of keywords as constants like t and nil, whose values are themselves (symbols). That is, like t and nil they are self-evaluating.
The general use ...
6
votes
How to make (make-symbol "foo") (make-symbol "foo") equal?
You're confusing make-symbol and intern. make-symbol is used specifically when you want such an equality not to hold.
6
votes
Accepted
practical relevance of storing value and function into one symbol
Emacs Lisp is a Lisp 2, which means only just what you described: the same symbol can have separate values as (1) a variable and (2) a function. (We call only #1 the "value" of the symbol.) Some ...
6
votes
Accepted
(symbol-name sym) vs. (format "%s" sym)
If KEYWORD is indeed always a symbol (in particular a keyword symbol) then IMO there's no special reason to use format. But there's no special reason not to, either: "better readability" is ...
5
votes
Accepted
What's the most reliable way to get the start and end positions of current symbol under cursor?
The thingatpt.el API works as follows:
(thing-at-point 'symbol) ;=> foo
(beginning-of-thing 'symbol) ;=> 42
(end-of-thing 'symbol) ;=> 45
(bounds-of-thing-at-point 'symbol) ;=> (42 . 45)
...
5
votes
Accepted
how to correctly pass around function as parameters?
Don't quote buffer-assassin when passing it to ninrod--protection. In your advice-functions, buffer-assassin is a variable, the value of which is the originial function. When you pass it quoted, ...
5
votes
Exporting unicode characters to pdf using latex from org mode
You'd just need to load proper unicode support in LaTeX via unicode-math and fontspec. Then you'd need to compile with xelatex or lualatex.
See the docstring of the following variables: org-latex-...
5
votes
Accepted
Understanding uninterned symbols and macro expansion?
As mentioned in the comments, you have to turn on this setting to see how macro-expansion works more precisely.
Note that it only changes how macroexpand is displayed, the macros still work the same ...
5
votes
How can I get list of all things supported by thing-at-point?
Yes, sure - use mapatoms:
(defun find-symbols-having-properties (properties)
(let (ret)
(mapatoms (lambda (s)
(when (cl-loop for prop in properties
...
5
votes
Accepted
How can I get the effect of buffer-local symbol plist property values?
I am certain that the answer is no, and that variables are the only kind of buffer-local bindings provided by elisp. (I'm sure one of the elisp language maintainers will correct me if I'm wrong about ...
4
votes
Accepted
Why requiring fails with dynamic symbols?
OK, it looks like the symbol needs to be "interned". http://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Symbols.html
This works as expected:
(require (intern "test"))
4
votes
Accepted
Modify face by its string name
(intern "name") returns the interned symbol name
make-symbol returns a new uninterned symbol, which is entirely distinct from the symbol with the face properties.
Refer to C-hig (elisp) Creating ...
4
votes
How can I get list of all things supported by thing-at-point?
It's not enough to test for properties beginning-op, end-op, bounds-of-thing-at-point, and thing-at-point. A thing can instead be defined by property forward-op or by a forward- THING function. (And ...
4
votes
Accepted
Why is function defined by defun not bound
If you assign a function to an uninterned symbol, then naturally you won't find that function on the interned symbol of that name -- they are two completely independent objects.
Your void-defun is ...
4
votes
Accepted
How to insert mathematical symbols in emacs
You can set the insert method with M-x set-input-method RET tex. Then type \beta and watch it get converted.
It can be toggled and set with C-\!
Tested and confirmed that it compiles and renders ...
4
votes
(symbol-name sym) vs. (format "%s" sym)
Is there a reason this is preferable to using symbol-name?
No, I think it just comes down to style and context. E.g. I can imagine someone preferring to consistently use format everywhere, because ...
4
votes
When is the first element in the argument list regarded as a function symbol and when not?
Lisp code and some Lisp data structures (lists, symbols, strings, vectors, etc.) can be the same thing. Lisp code is a Lisp data structure that's ready to be evaluated, that is, "run".
Both ...
3
votes
Accepted
How to use defvar with the symbol name in another variable?
It isn't equivalent. If you test the symbol of a defvar'd variable with special-variable-p you get t, however this is not the case for your code. This bit must be set for the variable to be usable ...
3
votes
Accepted
how to convert "foobar?" into 'foobar?
See C-hig (elisp)Symbol Type
In contrast to its use in strings, however, a backslash in the name
of a symbol simply quotes the single character that follows the
backslash. For example, in a ...
3
votes
Accepted
How to prettify symbols inside comments?
When symbols are composed with prettify-symbols-mode is controlled by prettify-symbols-compose-predicate. By default this will only compose symbols if they are at a word boundary and not inside a ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
symbols × 78variables × 13
functions × 11
elisp × 7
string × 6
keywords × 6
elisp-macros × 4
eval × 4
latex × 3
unicode × 3
quote × 3
thing-at-point × 3
org-mode × 2
org-export × 2
debugging × 2
fonts × 2
list × 2
defun × 2
prettify-symbols-mode × 2
setq × 2
property-lists × 2
math × 2
funcall × 2
defvar × 2
equality × 2