From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/80659 Path: news.gmane.org!not-for-mail From: Steinar Bang Newsgroups: gmane.emacs.gnus.general Subject: Backquotes and commas and ",@" (Was: gnus-sync-save fails with "wrong-type-argument number-or-marker-p") Date: Sat, 10 Dec 2011 09:10:55 +0100 Organization: Probably a good idea Message-ID: <87sjkskfsg.fsf_-_@dod.no> References: <87bos21un6.fsf@dod.no> <87y5v6zisl.fsf@dod.no> <87vcpt1jsq.fsf@dod.no> <87aa73p17i.fsf@lifelogs.com> <87aa72lw5p.fsf@dod.no> <8739cslx4d.fsf@dod.no> <87wra4khpe.fsf@dod.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1323504693 10411 80.91.229.12 (10 Dec 2011 08:11:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Dec 2011 08:11:33 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M28941@lists.math.uh.edu Sat Dec 10 09:11:29 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RZI1p-0003id-4S for ding-account@gmane.org; Sat, 10 Dec 2011 09:11:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1RZI1c-0002yW-Gp; Sat, 10 Dec 2011 02:11:16 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1RZI1Z-0002yG-M3 for ding@lists.math.uh.edu; Sat, 10 Dec 2011 02:11:13 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1RZI1Y-0005vI-BW for ding@lists.math.uh.edu; Sat, 10 Dec 2011 02:11:13 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1RZI1W-0000JZ-U3 for ding@gnus.org; Sat, 10 Dec 2011 09:11:10 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RZI1W-0003eb-Bn for ding@gnus.org; Sat, 10 Dec 2011 09:11:10 +0100 Original-Received: from cm-84.208.231.161.getinternet.no ([84.208.231.161]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Dec 2011 09:11:10 +0100 Original-Received: from sb by cm-84.208.231.161.getinternet.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Dec 2011 09:11:10 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 66 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cm-84.208.231.161.getinternet.no Mail-Copies-To: never User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:gR5NWIowLDIBOWDDZhKKS4hqYKo= X-Spam-Score: -6.1 (------) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:80659 Archived-At: >>>>> Steinar Bang : > (...and the reason it is hard to do anything about it myself, is that > backquotes, "," and ",@", are the bits of emacs lisp I've never been > able to wrap my head around. I mean: > You can also "splice" an evaluated value into the resulting list, > using the special marker `,@'. > Like... huh...? Anyway, I guess I must try harder...) Trying harder: Backquotes means quoting a list (quoting a list I, sort of, knows what means), in a way where you can evaluate parts of the list, by putting a "," in front of them. Ok, I understood that bit. I also understood the example in the elisp manual (comparing a regular quoted list, to a backqouted list with one element comma'd and evaluated). So, what's still unclear, is: 1. Why backquote (or for that matter: "why quote?") the body of a defun? What does that mean? #+begin_src emacs-lisp (defun gnus-sync-lesync-pre-save-group-entry (url nentry &rest passed-props) (let* ((loc "gnus-sync-lesync-save-group-entry") (k (car nentry)) (revision (gnus-sync-lesync-get-prop 'rev k)) (sname gnus-sync-lesync-name) (topic (gnus-group-topic k)) (topic-offset (gnus-sync-topic-group-position k topic)) (sources (gnus-sync-lesync-get-prop 'source k))) ;; set the revision so we don't have a conflict `(,@(when revision ... #+end_src 2. What does ",@" mean? "Splice the result of the evaluation into the list"...? Ah... I think I actually understand now. Looking at the elisp manual examples for ",@", I see that it means that if the result of the comma-evaluation is a list, the elements are added as element of the list, not as a single element that is a list. And the backqoute is just a convenient way of constructing a list. This means that the gnus-sync-lesync-pre-save-group-entry function returns a list. And that list, is: - If there is a revision, start the list with the symbol '_rev followed by the revision - Then the list will have an element that is a two element list, consisting of the symbol '_id and the first element of the nentry argument to the function (I don't understand why you have to have the "." there, though...?) - Then passed props are spliced in (what happens if there is no passed-props argument sent to the function? It's optional...?) - Then an element that is a list starting with "source" (whatever that is), followed by the result of evaluating the "if" - Then an element that is a two element list starting with 'level and with a number(?) as the second element - Then splice in the elements resulting from evaluating two "if"s relating to topics - Then an element that is a list containing the read marks - Then an element that is a list containing other marks, and this is the one that broke down for me, because it got a conflict marker instead of the other marks And I'm guessing this list is a translation of JSON into lisp lists...