From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [bug][babel] noweb gotcha Date: Thu, 12 Jun 2014 19:41:54 -0400 Message-ID: <87d2edvgoc.fsf@gmail.com> References: <87d2edx4ta.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvEdv-0003Ex-Lm for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 19:42:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvEdr-0004wH-B1 for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 19:42:51 -0400 Received: from mail-oa0-x236.google.com ([2607:f8b0:4003:c02::236]:33416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvEdr-0004wD-67 for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 19:42:47 -0400 Received: by mail-oa0-f54.google.com with SMTP id eb12so2030320oac.41 for ; Thu, 12 Jun 2014 16:42:46 -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: "Charles C. Berry" Cc: emacs-orgmode@gnu.org "Charles C. Berry" writes: > On Thu, 12 Jun 2014, Eric Schulte wrote: > >> Charles Berry writes: >> >>> The following >>> >>> ,---- >>> | #+PROPERTY: tangle yes >>> | >>> | #+NAME: print-abc >>> | #+BEGIN_SRC emacs-lisp >>> | (format >>> | "<<%s>>" "abc") >>> | #+END_SRC >>> | >>> | #+NAME: print-def >>> | #+BEGIN_SRC emacs-lisp >>> | (concat >>> | "<<" "def" ">>") >>> | #+END_SRC >>> | >>> | #+BEGIN_SRC emacs-lisp :noweb yes >>> | <> >>> | <> >>> | #+END_SRC >>> `---- >>> >>> >>> >>> tangles as >>> >>> ,---- >>> | (format >>> | "<<%s>>" "abc") >>> | >>> | (concat >>> | "<<" "def" ">>") >>> | >>> | (format >>> | "<<%s>>" "abc") >>> | (concat >>> | "") >>> `---- >>> >>> >>> Note that ""<<" "def" ">>" disappeared from (concat ...). >>> >>> FWIW, adding quotes inside the constant string in org-babel-noweb-wrap: >>> >>> >>> "\\([^ \"\t\n][^\"]+?[^ \"\t]\\|[^ \"\t\n]\\)" >>> >>> fixes this instance. >>> >> >> Does this raise any error, or fail silently? >> >> Thanks, >> Eric > > > Alas, it fails silently -- producing the erroneous output. > > I guess the issue is that > > `(re-search-forward (org-babel-noweb-wrap) nil t)' > > finds quoted expressions like > > 1. "<>" > 2. (concat "<<" abc ">>") > > FWIW, > > (re-search-forward > (org-babel-noweb-wrap > "\\([^ \"\t\n][^\"]+?[^ \"\t]\\|[^ \"\t\n]\\)" > ) nil t) > > (adding quotes to the [^...] bits) takes care of example 2. Not sure > if example 1 is a feature or a bug - I sometimes use things like > > "<>" > > so maybe modifying the regex is good enough? > > OTOH, <> has no effect. Maybe checking that the > reference actually resolves is better than tweaking the regexes. > So it is currently possible to raise errors when noweb references don't resolve through the use of the `org-babel-noweb-error-all-langs' variable. I just added `org-babel-noweb-error-all-langs' which may be set to raise such errors regardless of the language of the code block. Best, Eric > > > HTH, > > Chuck > > -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw)