Hot answers tagged

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-...
NickD's user avatar
  • 27.2k
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,...
phils's user avatar
  • 48.9k
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 ...
Drew's user avatar
  • 75.9k
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 ...
JeanPierre's user avatar
  • 7,333
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 ...
db48x's user avatar
  • 16k
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): ...
JeanPierre's user avatar
  • 7,333
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 (...
Gilles 'SO- stop being evil''s user avatar
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 ...
zck's user avatar
  • 9,004
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 ...
phils's user avatar
  • 48.9k
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 ...
Drew's user avatar
  • 75.9k
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.
Stefan's user avatar
  • 26.2k
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 ...
Drew's user avatar
  • 75.9k
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 ...
Drew's user avatar
  • 75.9k
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) ...
wasamasa's user avatar
  • 21.8k
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, ...
ChrisR's user avatar
  • 404
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-...
rasmus's user avatar
  • 2,682
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 ...
abo-abo's user avatar
  • 14k
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 ...
sds's user avatar
  • 5,958
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 ...
phils's user avatar
  • 48.9k
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"))
qwe's user avatar
  • 243
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 ...
phils's user avatar
  • 48.9k
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 ...
Drew's user avatar
  • 75.9k
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 ...
phils's user avatar
  • 48.9k
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 ...
young_souvlaki's user avatar
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 ...
Basil's user avatar
  • 12.1k
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 ...
Drew's user avatar
  • 75.9k
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 ...
wasamasa's user avatar
  • 21.8k
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 ...
phils's user avatar
  • 48.9k
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 ...
Prgrm.celeritas's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible