From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [babel] Export problem (Wrong type argument: consp, nil) Date: Thu, 15 Sep 2011 09:10:47 -0600 Message-ID: <87wrd9hkfv.fsf@gmail.com> References: <80litzcbg1.fsf@somewhere.org> <87hb4ndj1f.fsf@gmail.com> <80y5xrld4x.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4EFC-0002pO-6v for emacs-orgmode@gnu.org; Thu, 15 Sep 2011 11:52:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4EFA-0007Nv-Gh for emacs-orgmode@gnu.org; Thu, 15 Sep 2011 11:52:54 -0400 Received: from mail-yi0-f41.google.com ([209.85.218.41]:33544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4EFA-0007Nr-EB for emacs-orgmode@gnu.org; Thu, 15 Sep 2011 11:52:52 -0400 Received: by yia25 with SMTP id 25so1977726yia.0 for ; Thu, 15 Sep 2011 08:52:51 -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 > > Question: Would it be possible to add the src-name in the error > message? Unfortunately the code block name is not known to the function (namely `org-babel-merge-params') which throws errors when variables are not assigned default values. In fact this function may be called when there are no code blocks present. I think that this is why you ran into problems trying to thread the code block info down into this error message. Another option may be to check when a code block is initially parsed to ensure that all variables are assigned default parameters. If the checking is done initially then the code block name and position will be known and could be included into the error message. There exists a function for checking code blocks (namely `org-babel-check-src-block'), I've added a TODO to this function to add a check that all variables are initialized. > > * Test > > #+begin_src emacs-lisp > (ert-deftest test-org-babel/no-defaut-value-for-var () > "Test that the absence of a default value for a variable does throw a proper > error." > (org-test-at-id "f2df5ba6-75fa-4e6b-8441-65ed84963627" > (org-babel-next-src-block) > (should-error (org-babel-execute-src-block)) > :type 'error)) > #+end_src > > Though, I have 2 questions: > > - How can I differentiate between the clean error (with a message) and the one > which wasn't correctly trapped? Based on the first line of a backtrace > (string comparison) or on the type of the error? In the latter case, how > can I know what's the type of the current error thrown, and the one of the > error before your fix? > I believe Martyn answered this question > > - I wonder why we need twice the =org-babel-next-src-block= call, and > not only once in the =should-error= form. > I only see a single call to org-babel-next-src-block in the above test. Thanks for working on this test, I look forward to adding it once it is completed. Cheers -- Eric > > Thanks. > > Best regards, > Seb -- Eric Schulte http://cs.unm.edu/~eschulte/