emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] [Babel] Do not try to process inline source in macro templates
@ 2013-08-23  7:55 Nicolas Girard
  2013-09-02 16:35 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Girard @ 2013-08-23  7:55 UTC (permalink / raw)
  To: emacs-orgmode

When a buffer contains such

    #+MACRO: m src_emacs-lisp[:results raw]{(do-something "$1")}

macro template, calling =org-babel-execute-buffer= using =C-c C-v C-b= yields

    if: No id found: $1

It seems to me that Babel shouldn't be looking for inline code within
macro templates.

Cheers,

-- 
Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] [Babel] Do not try to process inline source in macro templates
  2013-08-23  7:55 [BUG] [Babel] Do not try to process inline source in macro templates Nicolas Girard
@ 2013-09-02 16:35 ` Eric Schulte
  2013-09-02 16:47   ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2013-09-02 16:35 UTC (permalink / raw)
  To: Nicolas Girard; +Cc: emacs-orgmode

Nicolas Girard <girard.nicolas@gmail.com> writes:

> When a buffer contains such
>
>     #+MACRO: m src_emacs-lisp[:results raw]{(do-something "$1")}
>
> macro template, calling =org-babel-execute-buffer= using =C-c C-v C-b= yields
>
>     if: No id found: $1
>
> It seems to me that Babel shouldn't be looking for inline code within
> macro templates.
>

I've just pushed up a fix for this issue which should now ignore inline
source blocks on lines starting with "#+" during export.  I don't know
if there is a better way than using a regex to detect such non-exporting
lines but this appears to work.

Cheers,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] [Babel] Do not try to process inline source in macro templates
  2013-09-02 16:35 ` Eric Schulte
@ 2013-09-02 16:47   ` Carsten Dominik
  2013-09-06 21:57     ` Nicolas Girard
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2013-09-02 16:47 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode, Nicolas Girard

Thank you Eric.

- Carsten

On 2.9.2013, at 18:35, Eric Schulte <schulte.eric@gmail.com> wrote:

> Nicolas Girard <girard.nicolas@gmail.com> writes:
> 
>> When a buffer contains such
>> 
>>    #+MACRO: m src_emacs-lisp[:results raw]{(do-something "$1")}
>> 
>> macro template, calling =org-babel-execute-buffer= using =C-c C-v C-b= yields
>> 
>>    if: No id found: $1
>> 
>> It seems to me that Babel shouldn't be looking for inline code within
>> macro templates.
>> 
> 
> I've just pushed up a fix for this issue which should now ignore inline
> source blocks on lines starting with "#+" during export.  I don't know
> if there is a better way than using a regex to detect such non-exporting
> lines but this appears to work.
> 
> Cheers,
> 
> -- 
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] [Babel] Do not try to process inline source in macro templates
  2013-09-02 16:47   ` Carsten Dominik
@ 2013-09-06 21:57     ` Nicolas Girard
  2013-09-08 10:55       ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Girard @ 2013-09-06 21:57 UTC (permalink / raw)
  To: emacs-orgmode

2013/9/2 Eric Schulte <schulte.eric@gmail.com> :
>>
>> I've just pushed up a fix for this issue which should now ignore inline
>> source blocks on lines starting with "#+" during export.  I don't know
>> if there is a better way than using a regex to detect such non-exporting
>> lines but this appears to work.
>>

Thanks very much !

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] [Babel] Do not try to process inline source in macro templates
  2013-09-06 21:57     ` Nicolas Girard
@ 2013-09-08 10:55       ` Eric Schulte
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Schulte @ 2013-09-08 10:55 UTC (permalink / raw)
  To: Nicolas Girard; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

Nicolas Girard <girard.nicolas@gmail.com> writes:

> 2013/9/2 Eric Schulte <schulte.eric@gmail.com> :
>>>
>>> I've just pushed up a fix for this issue which should now ignore inline
>>> source blocks on lines starting with "#+" during export.  I don't know
>>> if there is a better way than using a regex to detect such non-exporting
>>> lines but this appears to work.
>>>
>
> Thanks very much !
>

I've just pushed up a better (read: functional) solution suggested by
Nicolas Goaziou which uses org-element to determine when code blocks
should be executed.  This the current Org-mode the following example
file exports without error as expected.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: something.org --]
[-- Type: text/x-org, Size: 1294 bytes --]

#+Title: Example
#+Options: ^:{}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
natoque penatibus et magnis src_emacs-lisp{(current-time-string)} dis
parturient montes, nascetur ridiculus mus. Nulla posuere. Donec vitae
dolor. Nullam tristique diam non turpis. Cras placerat accumsan
nulla. Nullam rutrum. Nam vestibulum accumsan nisl.

# Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
# hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
# nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
# natoque penatibus et magnis src_emacs-lisp{(error "don't evaluate me!!")}
# dis parturient montes, nascetur ridiculus mus. Nulla posuere. Donec
# vitae dolor. Nullam tristique diam non turpis. Cras placerat
# accumsan nulla. Nullam rutrum. Nam vestibulum accumsan nisl.

- Lorem
- ipsum
- dolor src_emacs-lisp{(current-time-string)}
- sit
- amet

#+MACRO: name src_emacs-lisp{(error "don't evaluate me!!")}

#+begin_src emacs-lisp :exports results
  (current-time-string)
  ;; foo
  (current-time-string)
#+end_src

# #+begin_src emacs-lisp :export results
#   (error "don't evaluate me!!")
# #+end_src

[-- Attachment #3: Type: text/plain, Size: 72 bytes --]


Cheers,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-08 11:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23  7:55 [BUG] [Babel] Do not try to process inline source in macro templates Nicolas Girard
2013-09-02 16:35 ` Eric Schulte
2013-09-02 16:47   ` Carsten Dominik
2013-09-06 21:57     ` Nicolas Girard
2013-09-08 10:55       ` Eric Schulte

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).