From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [Babel] Lisp error: (wrong-type-argument listp hline) Date: Mon, 23 Sep 2013 17:26:39 -0600 Message-ID: <87ob7j15ci.fsf@gmail.com> References: <86zjr3bp2y.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOFcM-0001hK-FZ for emacs-orgmode@gnu.org; Mon, 23 Sep 2013 19:32:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOFcH-0007vx-88 for emacs-orgmode@gnu.org; Mon, 23 Sep 2013 19:32:38 -0400 Received: from mail-pb0-x22d.google.com ([2607:f8b0:400e:c01::22d]:38643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOFcG-0007vm-S5 for emacs-orgmode@gnu.org; Mon, 23 Sep 2013 19:32:33 -0400 Received: by mail-pb0-f45.google.com with SMTP id mc17so3804927pbc.32 for ; Mon, 23 Sep 2013 16:32:31 -0700 (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: Sebastien Vauban Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi Seb, I think you're confused by headers which are re-added by the colnames machinery. See the following which returns scalar output avoiding any colnames post-processing. --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=hlines.org #+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)) --=-=-= Content-Type: text/plain > * 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. > > 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)) Best, > > Best regards, > Seb -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D --=-=-=--