From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: [bug][babel] noweb gotcha Date: Thu, 12 Jun 2014 14:21:14 -0700 Message-ID: References: <87d2edx4ta.fsf@gmail.com> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvCRA-0006ol-Bp for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 17:21:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvCR3-0007Yu-Gg for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 17:21:32 -0400 Received: from iport-acv2-out.ucsd.edu ([132.239.0.174]:15008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvCR3-0007Ym-71 for emacs-orgmode@gnu.org; Thu, 12 Jun 2014 17:21:25 -0400 In-Reply-To: <87d2edx4ta.fsf@gmail.com> 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: Eric Schulte Cc: emacs-orgmode@gnu.org 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. HTH, Chuck