help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How the backquote and the comma really work?


From: Marcin Borkowski
Subject: Re: How the backquote and the comma really work?
Date: Thu, 25 Jun 2015 20:46:26 +0200

On 2015-06-25, at 20:10, Drew Adams <drew.adams@oracle.com> wrote:

>> So, I assume that when Emacs Lisp interpreter encounters a
>> backquote, it looks at the expression after it.  If it is anything
>> but a list, it just works like the usual quote, and the backquoted
>> expression evaluates to what was backquoted.
>
> Not really.  A comma (& additional backquotes & additional commas...)
> still tells the backquote preceding it to evaluate whatever sexp the
> comma precedes.
>
> So `,foo evaluates variable foo, and `',foo evaluates foo and quotes
> the result.
>
> (setq foo 'bar)    ; => bar
> (setq toto `,foo)  ; => bar
> (setq titi `',foo) ; => 'bar
>
> (setq titi `',foo) is equivalent to (setq titi (list 'quote foo))
>
> Michael H's advice about following the macroexpansion is good. 

Thanks, I stand corrected!

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]