Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Michael Gauland
Nicolas Goaziou  gmail.com> writes:

> 
> Hello,
> 
> Nick Dokos  hp.com> writes:
> > Works for me.
> 
> I also get a correct date with it, even with a minimal set-up.



Well, this is embarassing. I tackled it fresh, after a cup of coffee (for me)
and a re-start (emacs), and it's working. User error? Quantum effects? Whatever
the cause, thanks for your patience and support.

Kind regards,
Mike





Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Nicolas Goaziou
Eric S Fraga  writes:

> The problem with the inf-loop now makes sense but the documentation
> implies otherwise:
>
> ,
> | Also,
> | `{{{date(FORMAT)}}}' and `{{{modification-time(FORMAT)}}}' refer to
> | current date time and to the modification time of the file being
> `

I changed the date macro on purpose.

Since {{{title}}}, {{{author}}} and {{{email}}} refer to, respectively,
#+TITLE:, #+AUTHOR: and #+EMAIL:, {{{date}}} could as well refer to
#+DATE:.

For the sake of completeness, other hard-coded macros are
{{{property(name)}}}, {{{time(format-string)}}}, {{{input-file}}} and
{{{modification-time(format-string)}}}.


Regards,



Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Eric S Fraga
Nicolas Goaziou  writes:

> Michael Gauland  writes:
>> How can I set #+DATE to get an equivalent result?
>
> Doesn't
>
>#+DATE: {{{time(%Y-%m-%d %H:%M)}}}

Works perfectly fine for me.  And thanks for the explanation of the
cause of the inf-loop!

The problem with the inf-loop now makes sense but the documentation
implies otherwise:

,
| Also,
| `{{{date(FORMAT)}}}' and `{{{modification-time(FORMAT)}}}' refer to
| current date time and to the modification time of the file being
`

thanks,
eric

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.2.50.1 and Org release_7.9.2-536-g1f3a2c




Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Nicolas Goaziou
Hello,

Nick Dokos  writes:

> Michael Gauland  wrote:
>
>> On 30/10/12 22:29, Nicolas Goaziou wrote:
>> > Doesn't
>> >
>> >#+DATE: {{{time(%Y-%m-%d %H:%M)}}}
>> >
>> > get you what you expect?
>> 
>> That gives me an empty date string.
>> 
>
> Works for me.

I also get a correct date with it, even with a minimal set-up.

Michael: have you tried it on different back-ends?


Regards,

-- 
Nicolas Goaziou



Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Nick Dokos
Michael Gauland  wrote:

> On 30/10/12 22:29, Nicolas Goaziou wrote:
> > Doesn't
> >
> >#+DATE: {{{time(%Y-%m-%d %H:%M)}}}
> >
> > get you what you expect?
> 
> That gives me an empty date string.
> 

Works for me.

Nick

PS Re: the infinite loop with date() - D'oh! That's what I get by mindlessly
   cutting and pasting...




Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Michael Gauland
On 30/10/12 22:29, Nicolas Goaziou wrote:
> Doesn't
>
>#+DATE: {{{time(%Y-%m-%d %H:%M)}}}
>
> get you what you expect?

That gives me an empty date string.



signature.asc
Description: OpenPGP digital signature


Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Eric S Fraga
Nick Dokos  writes:
> With a minimal file, I get a cpu pegged at 100% with no end in
> sight. Setting debug-on-quit and C-g gives me the following backtrace.

I get this same problem (100% cpu) if I use the date macro in the #+DATE
line; I don't get this if I use the modification-time macro instead.

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.2.50.1 and Org release_7.9.2-536-g1f3a2c




Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Nicolas Goaziou
Michael Gauland  writes:

> I think I understand what's going on now, but I'm still at a loss as to
> how to get the date I want. Can I tell the exporter that the date on the
> document should be derived from the current time (or the last
> modification time), formatted a particular way? For example, I can use
> this macro to put the current time in my document:
>
> {{{time(%Y-%m-%d %H:%M)}}}
>
> How can I set #+DATE to get an equivalent result?

Doesn't

   #+DATE: {{{time(%Y-%m-%d %H:%M)}}}

get you what you expect?


Regards,



Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Nicolas Goaziou
Hello,

Achim Gratz  writes:

> Nicolas Goaziou writes:
>> {{{date(%c)}}} is another macro that is replaced with the #+DATE: value
>> during export. Since you try to replace #+DATE: value with itself, you
>> dive into an inf loop.
>
> Which raises the question if this shouldn't be detected and prevented,
> at least if direct recursion is involved.

It has already been fixed in master. I wouldn't leave an infloop in the
wild.


Regards,

-- 
Nicolas Goaziou



Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Michael Gauland
On 30/10/12 20:14, Nicolas Goaziou wrote:
> This is {{{time(...)}}}, not {{{date(...)}}}.
>
> {{{date(%c)}}} is another macro that is replaced with the #+DATE: value
> during export. Since you try to replace #+DATE: value with itself, you
> dive into an inf loop.

I think I understand what's going on now, but I'm still at a loss as to
how to get the date I want. Can I tell the exporter that the date on the
document should be derived from the current time (or the last
modification time), formatted a particular way? For example, I can use
this macro to put the current time in my document:

{{{time(%Y-%m-%d %H:%M)}}}

How can I set #+DATE to get an equivalent result?

Thanks for your help.

Kind regards,
Mike




signature.asc
Description: OpenPGP digital signature


Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Achim Gratz
Nicolas Goaziou writes:
> {{{date(%c)}}} is another macro that is replaced with the #+DATE: value
> during export. Since you try to replace #+DATE: value with itself, you
> dive into an inf loop.

Which raises the question if this shouldn't be detected and prevented,
at least if direct recursion is involved.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-30 Thread Nicolas Goaziou
Hello,

Nick Dokos  writes:

> Michael Gauland  wrote:
>
>> Nicolas Goaziou  gmail.com> writes:
>> 
>> > I just tried with a minimal init and it worked. Could you send the
>> > example you're trying to export?
>> 
>> The file is below. With a minimal init, I get the error "Symbol's function
>> definition is void: org-macro-initialize-templates'. If I use my full .emacs
>> file, the exporter just seems to freeze up.
>> 
>> -- test.org -
>> #+DATE: {{{date(%c)}}}
>> 
>> This ia a test file.
>> 
>> 
>> 
>
> With a minimal file, I get a cpu pegged at 100% with no end in
> sight. Setting debug-on-quit and C-g gives me the following backtrace.
>
> Org-mode version 7.9.2 (release_7.9.2-533-g07c889 @
> /home/nick/elisp/org-mode/lisp/)

This is {{{time(...)}}}, not {{{date(...)}}}.

{{{date(%c)}}} is another macro that is replaced with the #+DATE: value
during export. Since you try to replace #+DATE: value with itself, you
dive into an inf loop.


Regards,

-- 
Nicolas Goaziou



Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-29 Thread Nick Dokos
Michael Gauland  wrote:

> Nicolas Goaziou  gmail.com> writes:
> 
> > I just tried with a minimal init and it worked. Could you send the
> > example you're trying to export?
> 
> The file is below. With a minimal init, I get the error "Symbol's function
> definition is void: org-macro-initialize-templates'. If I use my full .emacs
> file, the exporter just seems to freeze up.
> 
> -- test.org -
> #+DATE: {{{date(%c)}}}
> 
> This ia a test file.
> 
> 
> 

With a minimal file, I get a cpu pegged at 100% with no end in
sight. Setting debug-on-quit and C-g gives me the following backtrace.

Org-mode version 7.9.2 (release_7.9.2-533-g07c889 @ 
/home/nick/elisp/org-mode/lisp/)

Nick


Debugger entered--Lisp error: (quit)
  mapc((lambda (type) (let* ((successor-fun (intern (format 
"org-element-%s-successor" (or (cdr ...) type (obj (funcall successor-fun 
limit))) (and obj (setq next-candidates (cons obj next-candidates) 
(inline-babel-call inline-src-block latex-or-entity link macro sub/superscript 
text-markup))
  (let (next-candidates types-to-search) (if (not objects) (setq 
types-to-search restriction) (mapc (function (lambda (obj) (if (< (cdr obj) 
(point)) (setq types-to-search (cons ... types-to-search)) (setq 
next-candidates (cons obj next-candidates) objects)) (mapc (function 
(lambda (type) (let* ((successor-fun (intern ...)) (obj (funcall successor-fun 
limit))) (and obj (setq next-candidates (cons obj next-candidates)) 
types-to-search) next-candidates)
  org-element--get-next-object-candidates(23 (inline-babel-call 
inline-src-block latex-or-entity link macro sub/superscript text-markup) nil)
  (setq candidates (org-element--get-next-object-candidates end restriction 
candidates))
  (while (setq candidates (org-element--get-next-object-candidates end 
restriction candidates)) (let ((closest-cand (rassq (apply (quote min) (mapcar 
(quote cdr) candidates)) candidates))) (if (> (cdr closest-cand) origin) (throw 
(quote exit) parent) (let* ((object (progn (goto-char ...) (funcall ...))) 
(cbeg (org-element-property :contents-begin object)) (cend 
(org-element-property :contents-end object))) (cond ((< (org-element-property 
:end object) origin) (goto-char (org-element-property :end object))) ((or (not 
cbeg) (> cbeg origin) (< cend origin)) (throw (quote exit) 
(org-element-put-property object :parent parent))) (t (goto-char cbeg) 
(org-element-put-property object :parent parent) (setq parent object 
restriction (org-element-restriction object) end cend)))
  (catch (quote exit) (while (setq candidates 
(org-element--get-next-object-candidates end restriction candidates)) (let 
((closest-cand (rassq (apply (quote min) (mapcar ... candidates)) candidates))) 
(if (> (cdr closest-cand) origin) (throw (quote exit) parent) (let* ((object 
(progn ... ...)) (cbeg (org-element-property :contents-begin object)) (cend 
(org-element-property :contents-end object))) (cond ((< ... origin) (goto-char 
...)) ((or ... ... ...) (throw ... ...)) (t (goto-char cbeg) 
(org-element-put-property object :parent parent) (setq parent object 
restriction ... end cend))) parent)
  (let ((restriction (org-element-restriction type)) (parent element) 
candidates) (catch (quote exit) (while (setq candidates 
(org-element--get-next-object-candidates end restriction candidates)) (let 
((closest-cand (rassq (apply ... ...) candidates))) (if (> (cdr closest-cand) 
origin) (throw (quote exit) parent) (let* ((object ...) (cbeg ...) (cend ...)) 
(cond (... ...) (... ...) (t ... ... ...)) parent))
  (if (not (or (let ((post (org-element-property :post-affiliated element))) 
(and post (> post origin) (< (org-element-property :begin element) origin) 
(progn (beginning-of-line) (looking-at org-element--affiliated-re) (member 
(upcase ...) org-element-parsed-keywords)) (setq type (quote keyword)) (if (and 
(match-end 2) (<= origin ...)) (progn (goto-char ...) (setq end ...)) 
(goto-char (match-end 0)) (setq end (line-end-position) (and (eq type 
(quote item)) (let ((tag (org-element-property :tag element))) (and tag (progn 
(beginning-of-line) (search-forward tag ...) (goto-char ...) (and ... ...) 
(and (memq type (quote (headline inlinetask))) (progn (beginning-of-line) 
(skip-chars-forward "* ") (setq end (point-at-eol (and (memq type (quote 
(paragraph table-row verse-block))) (let ((cbeg (org-element-property 
:contents-begin element)) (cend (org-element-property :contents-end element))) 
(and (>= origin cbeg) (<= origin cend) (progn (goto-char cbeg) (setq end 
cend
 ) (and (eq type (quote keyword)) (let ((key (org-element-property :key 
element))) (and (member key org-element-document-properties) (progn 
(beginning-of-line) (search-forward key ... t) (forward-char) (setq end 
...))) element (let ((restriction (org-element-restriction type)) (parent 
element) candidates) (catch (quote exit) (while (setq candidates 
(org-element--get-next-object-candidates end restriction candidates)) (l

Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-29 Thread Michael Gauland
Nicolas Goaziou  gmail.com> writes:

> I just tried with a minimal init and it worked. Could you send the
> example you're trying to export?

The file is below. With a minimal init, I get the error "Symbol's function
definition is void: org-macro-initialize-templates'. If I use my full .emacs
file, the exporter just seems to freeze up.

-- test.org -
#+DATE: {{{date(%c)}}}

This ia a test file.





Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-29 Thread Nicolas Goaziou
Michael Gauland  writes:

> Nicolas Goaziou  gmail.com> writes:
>> On the other hand, you have a hard-coded macro to solve this problem:
>> 
>>   #+DATE: {{{time(%c)}}}
>> 
>> It will work across every back-end (but you need the latest Org version,
>> since I recently to fixed a bug related to it).
>
> Thanks--that will do nicely. Unfortunately, I can't seem to get it working. 
> When
> I export to HTML, I get a blank date; when I try to export to LaTeX, the
> exporter doesn't appear to do anything. After hitting ^G, the .tex file is
> unchanged.

I just tried with a minimal init and it worked. Could you send the
example you're trying to export?

Thank you.


Regards,

-- 
Nicolas Goaziou



Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-29 Thread Michael Gauland
Nicolas Goaziou  gmail.com> writes:
> On the other hand, you have a hard-coded macro to solve this problem:
> 
>   #+DATE: {{{time(%c)}}}
> 
> It will work across every back-end (but you need the latest Org version,
> since I recently to fixed a bug related to it).

Thanks--that will do nicely. Unfortunately, I can't seem to get it working. When
I export to HTML, I get a blank date; when I try to export to LaTeX, the
exporter doesn't appear to do anything. After hitting ^G, the .tex file is
unchanged.

I've grabbed the latest from git
(commit 1f3a2c42c6317a4b0e97b237f079c51f0028cc90).








Re: [O] [new exporter] Date format string not handled for LaTeX export

2012-10-29 Thread Nicolas Goaziou
Hello,

Michael Gauland  writes:

> When I provide a format string to the #+DATE: option, the old LaTeX exporter
> correctly uses it to format the current date; the new exporter just uses the
> format string for the date.

I wasn't aware of that "feature". Though, I don't like it: it is fragile
for technical reasons (it may or may not work on every exporter) and it
adds yet another special rule to remember.

On the other hand, you have a hard-coded macro to solve this problem:

  #+DATE: {{{time(%c)}}}

It will work across every back-end (but you need the latest Org version,
since I recently to fixed a bug related to it).

> The new HTML exporter does not have this problem.

I am going to remove this hack from new back-ends as it isn't necessary.


Regards,

-- 
Nicolas Goaziou



[O] [new exporter] Date format string not handled for LaTeX export

2012-10-28 Thread Michael Gauland
When I provide a format string to the #+DATE: option, the old LaTeX exporter
correctly uses it to format the current date; the new exporter just uses the
format string for the date.

The new HTML exporter does not have this problem.