From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: Re: [Babel] Lisp error: (wrong-type-argument listp hline) Date: Tue, 24 Sep 2013 10:43:07 +0200 Message-ID: <86fvsuk3tw.fsf@somewhere.org> References: <86zjr3bp2y.fsf@somewhere.org> <87ob7j15ci.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: 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-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hi Eric, Eric Schulte wrote: > I think you're confused by headers which are re-added by the colnames > machinery. Blush! I mixed the two in my head, yes. > See the following which returns scalar output avoiding any colnames > post-processing. Why are you talking of *post* processing machinery for colnames? The documentation[1] says that ":colnames no" means "no column name *pre* processing takes place." I may miss something important here. > #+Property: results scalar > > #+name: table > | Key | Value | > |-----+-------| > | ABJ | 1 | > | DEK | 2 | > > #+begin_src emacs-lisp :var data=table :hlines no > data > #+end_src > > #+RESULTS: > : (("Key" "Value") ("ABJ" 1) ("DEK" 2)) > > #+begin_src emacs-lisp :var data=table :hlines yes > data > #+end_src > > #+RESULTS: > : (("Key" "Value") hline ("ABJ" 1) ("DEK" 2)) > >> * Set :hlines to "yes" >> >> `:hlines yes' should leave the horizontal line, but generates an error. >> >> #+begin_src emacs-lisp :var data=table :results output :hlines yes >> (mapc (lambda (item) (princ (format "UPDATE dim SET val=%s WHERE code='%s'\n" >> (nth 1 item) (nth 0 item)))) >> data) >> #+end_src > > This is not a babel error, this is an error in your code block body, > which assumes that every element of `data' will be a list. The symbol > `hline' is not a list. OK, that now becomes clear to me! >> Finally, how am I then supposed to *ignore the header line*? By adding >> >> #+begin_src emacs-lisp >> (setq table (cdr table)) >> #+end_src >> >> ? >> >> Do I have to do that explicitly in my code block, or is there an option for >> telling that to Babel? > > Use the :colnames processing to strip the headings. > > #+begin_src emacs-lisp :var data=table :colnames yes > data > #+end_src > > #+RESULTS: > : (("ABJ" 1) ("DEK" 2)) I always wondered why emacs-lisp is the _only_ language with ":colnames no" as its default. Is there a reason therefore? If no really good reason, could we suppress that? Best regards, Seb -- Sebastien Vauban [1] http://orgmode.org/org.html#colnames