emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: [Babel] Lisp error: (wrong-type-argument listp hline)
Date: Mon, 23 Sep 2013 16:16:37 +0200	[thread overview]
Message-ID: <86zjr3bp2y.fsf@somewhere.org> (raw)

Hello Eric,

This ECM does generate an error, when run with ":hlines yes".

#+name: table
| Key | Value |
|-----+-------|
| ABJ |     1 |
| DEK |     2 |

As you can see, there is one header and one horizontal line in the input
table.

* Set :hlines to "no"

Adding `:hlines no' strips the horizontal line, but does keep the header.

  #+begin_src emacs-lisp :var data=table :results output :hlines no
  (mapc (lambda (item) (princ (format "UPDATE dim SET val=%s WHERE code='%s'\n"
                                      (nth 1 item) (nth 0 item))))
   data)
  #+end_src

  #+results:
  #+begin_example
  UPDATE dim SET val=Value WHERE code = 'Key'              <<< LINE NOT WANTED
  UPDATE dim SET val=1 WHERE code = 'ABJ'
  UPDATE dim SET val=2 WHERE code = 'DEK'
  #+end_example

* 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

--8<---------------cut here---------------start------------->8---
  Debugger entered--Lisp error: (wrong-type-argument listp hline)
    nth(1 hline)
    (format "UPDATE dim SET val=%s WHERE code='%s'\n" (nth 1 item) (nth 0 item))
    (princ (format "UPDATE dim SET val=%s WHERE code='%s'\n" (nth 1 item) (nth 0 item)))
    (lambda (item) (princ (format "UPDATE dim SET val=%s WHERE code='%s'\n" (nth 1 item) (nth 0 item))))(hline)
    mapc((lambda (item) (princ (format "UPDATE dim SET val=%s WHERE code='%s'\n" (nth 1 item) (nth 0 item)))) (("Key" "Value") hline ("ABJ" 1) ("DEK" 2)))
    ...
    call-interactively(org-self-insert-command nil nil)
--8<---------------cut here---------------end--------------->8---

* Ignore the table header

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?

Best regards,
  Seb

-- 
Sebastien Vauban

             reply	other threads:[~2013-09-23 14:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23 14:16 Sebastien Vauban [this message]
2013-09-23 23:26 ` [Babel] Lisp error: (wrong-type-argument listp hline) Eric Schulte
2013-09-24  8:43   ` Sebastien Vauban
2013-09-28 12:21     ` [Babel] :colnames "no" no longer default for Emacs Lisp [Was] " Eric Schulte
2013-09-30  9:03       ` Sebastien Vauban
2013-10-01 22:04       ` Thomas S. Dye
2013-10-02 13:13         ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86zjr3bp2y.fsf@somewhere.org \
    --to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).