[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about quotes on emacs lisp
From: |
Pascal Bourguignon |
Subject: |
Re: Question about quotes on emacs lisp |
Date: |
Sun, 17 Sep 2006 03:38:14 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"grocery_stocker" <cdalten@gmail.com> writes:
> Why can't I do something like this:
>
> (global-set-key "\C-x\n" "other-window")
>
> Aren't I still using quotes when calling the function other-window?
LISP = List & Intelligent Symbolic Programming language.
There are lists and symbols in lisp.
Symbols are not strings. (But the name of a symbol is a string).
Quoting of symbols becomes necessary when you want to consider the
symbol as data from code. In code, symbols are normally interpreted
as function or variable identifiers. If you want to have a symbol
interpreted as literal data, you must quote it with the special
operator quote:
(quote example) --> example
(global-set-key "\C-x\n" (quote other-window))
Now, some consider that writting (quote ...) is fastidiuous, and
prefer to use some shorter syntax. You can use a single prefix quote
instead:
'example == (quote example)
(global-set-key "\C-x\n" 'other-window)
--
__Pascal Bourguignon__ http://www.informatimago.com/
"I have challenged the entire quality assurance team to a Bat-Leth
contest. They will not concern us again."