From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Alternate format for datetree Date: Thu, 06 Sep 2012 02:26:05 -0400 Message-ID: <3655.1346912765@alphaville> References: <20532.1346040247@alphaville> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9VXY-0004Bb-KS for emacs-orgmode@gnu.org; Thu, 06 Sep 2012 02:26:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9VXU-0001oc-Ee for emacs-orgmode@gnu.org; Thu, 06 Sep 2012 02:26:12 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:10173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9VXU-0001mW-8F for emacs-orgmode@gnu.org; Thu, 06 Sep 2012 02:26:08 -0400 In-Reply-To: Message from c b <24x7x366@gmail.com> of "Wed, 05 Sep 2012 22:42:18 PDT." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: c b <24x7x366@gmail.com> Cc: emacs-orgmode c b <24x7x366@gmail.com> wrote: > Thank a lot for your suggestions. I finally got it working. It took a while > to figure out that the back-tick is different from the quote. > I am an elisp newbie. Is there an easy explanation of why we need a > back-tick vs. quote? > quote says: take the next expression as is - do not evaluate anything in it. backquote says: take the next expression as is - do not evaluate anything in it, *except* do evaluate any subexpression preceded by a comma and put the result back into the original expression in place of the comma-ed subexpression. E.g '(a b c) -> (a b c) `(a b c) -> (a b c) ; because there is no comma '(a (+ 2 3)) -> (a (+ 2 3)) `(a (+ 2 3)) -> (a (+ 2 3)) ; again no comma `(a ,(+ 2 3)) -> (a 5) Incidentally, if you switch to the *scratch* buffer (which is in Lisp Interaction mode), you can type these expressions in and evaluate each one by pressing C-j at the end of each expression. So they both quote: the first one unconditionally, the second mostly but allowing partial evaluation of subexpressions. BTW, '(a b c) is shorthand for (quote (a b c)): internally, the lisp reader translates the first to the second and then the evaluator evaluates the quote form, returning its (unevaluated) argument: that's why quote is a "special form" - by contrast, ordinary functions always evaluate their arguments. `(a b ,(+ 2 3)) is also shorthand for (backquote (a b ,(+ 2 3))) but the implementation is necessarily more complicated: backquote is implemented as a macro (because it is a special form, its argument is not evaluated, so it cannot be implemented as a function; it has to be implemented as a macro), but then backquote has to dig into the structure to look for , (and also for the somewhat different ,@ construct - see the docs) and do what's necessary. Another example is provided by the docstring of backquote itself: C-h f backquote RET to see it. For more info, see the elisp manual, chapter 9 on evaluation: (info "(elisp) Evaluation") and two sections therein in particular, 9.3 Quoting, and 9.4 Backquote: (info "(elisp) Quoting") (info "(elisp) Backquote") Nick