From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/80662 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: Backquotes and commas and ",@" Date: Sat, 10 Dec 2011 05:39:20 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87ehwcn21z.fsf@lifelogs.com> 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> <87sjkskfsg.fsf_-_@dod.no> Reply-To: ding@gnus.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1323513628 25738 80.91.229.12 (10 Dec 2011 10:40:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Dec 2011 10:40:28 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M28944@lists.math.uh.edu Sat Dec 10 11:40:25 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 1RZKLw-0008Sr-Sw for ding-account@gmane.org; Sat, 10 Dec 2011 11:40:25 +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 1RZKLF-0003es-1E; Sat, 10 Dec 2011 04:39:41 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1RZKLB-0003eZ-Ug for ding@lists.math.uh.edu; Sat, 10 Dec 2011 04:39:37 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1RZKLA-0001YR-5s for ding@lists.math.uh.edu; Sat, 10 Dec 2011 04:39:37 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1RZKL8-0003na-D3 for ding@gnus.org; Sat, 10 Dec 2011 11:39:34 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RZKL6-0008GD-Eu for ding@gnus.org; Sat, 10 Dec 2011 11:39:32 +0100 Original-Received: from c-76-28-40-19.hsd1.vt.comcast.net ([76.28.40.19]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Dec 2011 11:39:32 +0100 Original-Received: from tzz by c-76-28-40-19.hsd1.vt.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Dec 2011 11:39:32 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 71 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-76-28-40-19.hsd1.vt.comcast.net X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux) Cancel-Lock: sha1:OvaaNXPTiUx6QlzxYj0onw4azU0= X-Spam-Score: -6.1 (------) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:80662 Archived-At: On Sat, 10 Dec 2011 09:10:55 +0100 Steinar Bang wrote: SB> So, what's still unclear, is: SB> 1. Why backquote (or for that matter: "why quote?") the body of a SB> 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 The function returns a list. It was more convenient to build the list all at once, with interpolation, than imperatively with push/pop or cons. SB> 2. What does ",@" mean? "Splice the result of the evaluation into SB> the list"...? Ah... I think I actually understand now. Looking SB> at the elisp manual examples for ",@", I see that it means that if SB> the result of the comma-evaluation is a list, the elements are SB> added as element of the list, not as a single element that is a SB> list. ,@ says "whatever list follows, splice it in." If the list is empty, nothing happens; it's convenient when you want some content to appear only if it's not nil. So for example #+begin_src emacs-lisp ,@(if topic (list (cons 'topic topic)) nil) #+end_src will result in an alist member like '(topic "xyz") if the `topic' variable was defined, and nothing will be inserted otherwise. SB> This means that the gnus-sync-lesync-pre-save-group-entry function SB> returns a list. And that list, is: SB> - If there is a revision, start the list with the symbol '_rev SB> followed by the revision SB> - Then the list will have an element that is a two element list, SB> consisting of the symbol '_id and the first element of the nentry SB> argument to the function (I don't understand why you have to have SB> the "." there, though...?) SB> - Then passed props are spliced in (what happens if there is no SB> passed-props argument sent to the function? It's optional...?) SB> - Then an element that is a list starting with "source" (whatever SB> that is), followed by the result of evaluating the "if" SB> - Then an element that is a two element list starting with 'level and SB> with a number(?) as the second element SB> - Then splice in the elements resulting from evaluating two "if"s SB> relating to topics SB> - Then an element that is a list containing the read marks SB> - Then an element that is a list containing other marks, and this is SB> the one that broke down for me, because it got a conflict marker SB> instead of the other marks SB> And I'm guessing this list is a translation of JSON into lisp lists... It's prep work for the actual save to JSON, converting arbitrary group data (especially marks) into a more neutral format that json.el can handle. Ted