emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [bug][babel] noweb gotcha


From: Charles C. Berry
Subject: Re: [O] [bug][babel] noweb gotcha
Date: Thu, 12 Jun 2014 14:21:14 -0700
User-agent: Alpine 2.00 (OSX 1167 2008-08-23)

On Thu, 12 Jun 2014, Eric Schulte wrote:

Charles Berry <address@hidden> 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
| <<print-abc>>
| <<print-def>>
| #+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. "<<abc>>"
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

        "<<text-I-want>>"

so maybe modifying the regex is good enough?

OTOH, <<no-such-chunk>> has no effect. Maybe checking that the reference actually resolves is better than tweaking the regexes.


HTH,

Chuck





reply via email to

[Prev in Thread] Current Thread [Next in Thread]