emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Sebastien Vauban <wxhgmqzgwmuf@spammotel.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [babel] Export problem (Wrong type argument: consp, nil)
Date: Thu, 08 Sep 2011 11:33:31 -0600	[thread overview]
Message-ID: <87hb4ndj1f.fsf@gmail.com> (raw)
In-Reply-To: 80litzcbg1.fsf@somewhere.org

Hi Seb,

All variables must be given a default value, which is why it is an error
to write a code block like the following.

#+source: circle(x)
#+begin_src python
return x*x
#+end_src

I've just pushed up a change which provides a better error message in
this case.

Best -- Eric

"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:

> Hi,
>
> #+TITLE:     Export problem
> #+AUTHOR:    Seb Vauban
> #+DATE:      2011-09-08
> #+LANGUAGE:  en
>
> * Works OK
>
> #+source: square(x=6)
> #+begin_src python
> return x*x
> #+end_src
>
> * Does not work
>
> If there is no value assigned to the code block...
>
> #+source: circle(x)
> #+begin_src python
> return x*x
> #+end_src
>
> ... there is no an error when exporting:
>
> #+begin_src text
> Debugger entered--Lisp error: (wrong-type-argument consp nil)
>   setcdr(nil "nil=x")
>   (setf (cddr (nth variable-index vars)) (concat (symbol-name ...) "=" (cdr pair)))
>   (prog1 (setf (cddr ...) (concat ... "=" ...)) (incf variable-index))
>   (if name (setq vars (append ... ...)) (prog1 (setf ... ...) (incf variable-index)))
>   (let ((name ...)) (if name (setq vars ...) (prog1 ... ...)))
>   (cond ((eql ... ...) (let ... ...)) ((eql ... ...) (setq results ...)) ((eql ... ...) (when ... ... ... ...)) ((eql ... ...) (setq exports ...)) ((eql ... ...) (setq tangle ...)) ((eql ... ...) (setq noweb ...)) ((eql ... ...) (setq cache ...)) ((eql ... ...) (setq padline ...)) ((eql ... ...) (setq shebang ...)) ((eql ... ...) (setq comments ...)) (t (setq params ...)))
>   (case (car pair) (:var (let ... ...)) (:results (setq results ...)) (:file (when ... ... ... ...)) (:exports (setq exports ...)) (:tangle (setq tangle ...)) (:noweb (setq noweb ...)) (:cache (setq cache ...)) (:padline (setq padline ...)) (:shebang (setq shebang ...)) (:comments (setq comments ...)) (t (setq params ...)))
>   (lambda (pair) (case (car pair) (:var ...) (:results ...) (:file ...) (:exports ...) (:tangle ...) (:noweb ...) (:cache ...) (:padline ...) (:shebang ...) (:comments ...) (t ...)))((:var . "x"))
>   mapc((lambda (pair) (case (car pair) (:var ...) (:results ...) (:file ...) (:exports ...) (:tangle ...) (:noweb ...) (:cache ...) (:padline ...) (:shebang ...) (:comments ...) (t ...))) ((:var . "x")))
>   (lambda (plist) (mapc (lambda ... ...) plist))(((:var . "x")))
>   mapc((lambda (plist) (mapc (lambda ... ...) plist)) (((:var . "x")) ((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results . "replace") (:padnewline . "yes") (:hlines . "no") (:session . "none"))))
>   (progn (fset (quote e-merge) (function* ...)) (mapc (lambda ... ...) plists))
>   (unwind-protect (progn (fset ... ...) (mapc ... plists)) (if --cl-letf-bound-- (fset ... --cl-letf-save--) (fmakunbound ...)))
>   (let* ((--cl-letf-bound-- ...) (--cl-letf-save-- ...)) (unwind-protect (progn ... ...) (if --cl-letf-bound-- ... ...)))
>   (letf ((... ...)) (mapc (lambda ... ...) plists))
>   (letf* ((... ...)) (mapc (lambda ... ...) plists))
>   (flet ((e-merge ... ...)) (mapc (lambda ... ...) plists))
>   (let ((results-exclusive-groups ...) (exports-exclusive-groups ...) (variable-index 0) params results exports tangle noweb cache vars shebang comments padline) (flet (...) (mapc ... plists)) (setq vars (reverse vars)) (while vars (setq params ...)) (mapc (lambda ... ...) (quote ...)) params)
>   org-babel-merge-params(((:var . "x")) ((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results . "replace") (:padnewline . "yes") (:hlines . "no") (:session . "none")))
>   (setcar (nthcdr 2 info) (org-babel-merge-params (mapcar ... ...) (nth 2 info)))
>   (setf (nth 2 info) (org-babel-merge-params (mapcar ... ...) (nth 2 info)))
>   (progn (setf (nth 2 info) (org-babel-merge-params ... ...)))
>   (if (match-string 6) (progn (setf ... ...)))
>   (when (match-string 6) (setf (nth 2 info) (org-babel-merge-params ... ...)))
>   (progn (setq name (org-babel-clean-text-properties ...)) (when (match-string 6) (setf ... ...)))
> #+end_src
>
> Best regards,
>   Seb

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2011-09-08 17:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-08 15:15 [babel] Export problem (Wrong type argument: consp, nil) Sebastien Vauban
2011-09-08 17:33 ` Eric Schulte [this message]
2011-09-14  8:52   ` Sebastien Vauban
2011-09-14 11:44     ` Martyn Jago
2011-09-15 15:10     ` Eric Schulte
2011-09-16  9:57       ` Sebastien Vauban
2011-09-16 10:12       ` Sebastien Vauban
2011-09-16 15:25         ` 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=87hb4ndj1f.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=wxhgmqzgwmuf@spammotel.com \
    /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).