Re: [O] Can I wrap a Babel call inside a macro?

2014-01-24 Thread Nicolas Goaziou


Hello,

Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
writes:

 I did the following test, not fully successfull:

 #+name: current-time
 #+begin_src sh
 echo $(date '+%Y%m%d.%H%M')
 #+end_src

 #+results: current-time
 : 20140123.2339

 Date/time:
 #+CALL: current-time()

 #+results:
 : 20140123.2339

 #+MACRO: ct #+CALL: current-time()

 The current date and time is:
 {{{ct}}}.

 as the HTML export gives:

 div id=outline-container-sec-1 class=outline-2
   h2 id=sec-1span class=section-number-21/span Tests/h2

   div class=outline-text-2 id=text-1
 div class=org-src-container
   pre class=src src-sh id=current-time
 span style=color: #006FE0;echo/span span style=
 color: #036A07;$(date '+%Y%m%d.%H%M')/span
 /pre
 /div

 pDate/time:/p
 pre class=example
 20140123.2338
 /pre

 pThe current date and time is: #+CALL: current-time()./p
   /div ^^
 /div

 As macros are expanded _before_ Babel calls are executed, I'd think this
 is possible, but I must miss something...

FWIW, I couldn't reproduce your problem in either maint or master
branch.


Regards,

-- 
Nicolas Goaziou




Re: [O] Can I wrap a Babel call inside a macro?

2014-01-24 Thread Nicolas Goaziou


Nicolas Goaziou n.goaz...@gmail.com writes:

 The current date and time is:
 {{{ct}}}.

BTW, the period seems dubious here.

-- 
Nicolas Goaziou




Re: [O] Can I wrap a Babel call inside a macro?

2014-01-24 Thread Sebastien Vauban
Hello Nicolas,

Nicolas Goaziou wrote:
 Nicolas Goaziou n.goaz...@gmail.com writes:

 The current date and time is:
 {{{ct}}}.

 BTW, the period seems dubious here.

What do you mean?  That, because the macro will ultimately make a Babel
call, it can't be inserted inline in some text, right?

I'd have to write:

 The current date and time is:
 {{{ct}}}
 .

Is this what you mean?

Best regards,
  Seb

PS- I'll have to look why it works for you and not for me...

-- 
Sebastien Vauban




Re: [O] Can I wrap a Babel call inside a macro?

2014-01-24 Thread Nicolas Goaziou


Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
writes:

 Nicolas Goaziou n.goaziou-re5jqeeqqe8avxtiumw...@public.gmane.org writes:

 The current date and time is:
 {{{ct}}}.

 BTW, the period seems dubious here.

 What do you mean?  That, because the macro will ultimately make a Babel
 call, it can't be inserted inline in some text, right?

Correct. After macro expansion, this will become:

  #+CALL: current-time().

which isn't valid Babel syntax, AFAIK.


Regards,

-- 
Nicolas Goaziou




Re: [O] Can I wrap a Babel call inside a macro?

2014-01-24 Thread Sebastien Vauban
Hello Nicolas,

Nicolas Goaziou wrote:
 Sebastien Vauban writes:
 Nicolas Goaziou n.goaz...@gmail.com writes:

 The current date and time is:
 {{{ct}}}.

 BTW, the period seems dubious here.

 What do you mean?  That, because the macro will ultimately make a Babel
 call, it can't be inserted inline in some text, right?

 Correct. After macro expansion, this will become:

   #+CALL: current-time().

 which isn't valid Babel syntax, AFAIK.

OK. New tests confirm that, definitively.

So, when you said it worked for you, it wasn't with the exact same ECM,
then. Case closed. Thanks!

Best regards,
  Seb

-- 
Sebastien Vauban