emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* cautionary tale: avoid creating/using a macro called "title"
@ 2018-03-14 17:37 Eric S Fraga
  2018-03-21  1:06 ` Bastien
  0 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2018-03-14 17:37 UTC (permalink / raw)
  To: emacs-orgmode

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

Dear all,

I have, until now, used a macro

  #+macro title The title of the document

to be subsequently used in the actual #+title line, as in

  #+title: @@latex:...@@ {{{title}}} @@latex:...@@

(LaTeX details not important, I think.)

but this now leads to a recursive evaluation of the line when exporting,
causing an infinite loop.

Changing the name of the macro to something else avoids the issue.  I'm
not entirely sure why a macro expansion of the #+title line would be
recursive but there you are!

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-303-g6cf5fc.dirty

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-14 17:37 cautionary tale: avoid creating/using a macro called "title" Eric S Fraga
@ 2018-03-21  1:06 ` Bastien
  2018-03-21 11:01   ` Eric S Fraga
  0 siblings, 1 reply; 15+ messages in thread
From: Bastien @ 2018-03-21  1:06 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Hi Eric,

Eric S Fraga <esflists@gmail.com> writes:

> I have, until now, used a macro
>
>   #+macro title The title of the document
>
> to be subsequently used in the actual #+title line, as in
>
>   #+title: @@latex:...@@ {{{title}}} @@latex:...@@
>
> (LaTeX details not important, I think.)

just out of curiosity, I tried to reproduce this error but it works
fine here.  Do you still have this error?

Thanks,

-- 
 Bastien

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-21  1:06 ` Bastien
@ 2018-03-21 11:01   ` Eric S Fraga
  2018-03-22  8:34     ` Bastien
  0 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2018-03-21 11:01 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On Wednesday, 21 Mar 2018 at 02:06, Bastien wrote:
> Hi Eric,
>
> Eric S Fraga <esflists@gmail.com> writes:
>
>> I have, until now, used a macro
>>
>>   #+macro title The title of the document
>>
>> to be subsequently used in the actual #+title line, as in
>>
>>   #+title: @@latex:...@@ {{{title}}} @@latex:...@@
>>
>> (LaTeX details not important, I think.)
>
> just out of curiosity, I tried to reproduce this error but it works
> fine here.  Do you still have this error?

Yes.  The following minimal example does not export with my
configuration.

#+begin_src org
  ,#+macro: title The actual title
  ,#+title: @@latex:\fbox{@@ {{{title}}} @@latex:}@@
  ,#+options: toc:nil num:nil

  ,* heading
  And some text follows.

#+end_src

I have not tried with emacs -Q.  I will do so if this example works fine
for you.

Thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.7-475-g3ffc7d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-21 11:01   ` Eric S Fraga
@ 2018-03-22  8:34     ` Bastien
  2018-03-22  8:55       ` Eric S Fraga
  2018-03-22  9:22       ` Eric S Fraga
  0 siblings, 2 replies; 15+ messages in thread
From: Bastien @ 2018-03-22  8:34 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Hi Eric,

thanks for the time you took for an example.

Eric S Fraga <esflists@gmail.com> writes:

> I have not tried with emacs -Q.  I will do so if this example works fine
> for you.

Yes it works both with my configuration and with emacs -Q here, with
GNU Emacs 27.0.50 (build 51, i686-pc-linux-gnu) and Org mode version
9.1.8.

Thanks,

-- 
 Bastien

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22  8:34     ` Bastien
@ 2018-03-22  8:55       ` Eric S Fraga
  2018-03-22  9:22       ` Eric S Fraga
  1 sibling, 0 replies; 15+ messages in thread
From: Eric S Fraga @ 2018-03-22  8:55 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On Thursday, 22 Mar 2018 at 09:34, Bastien wrote:
> Yes it works both with my configuration and with emacs -Q here, with
> GNU Emacs 27.0.50 (build 51, i686-pc-linux-gnu) and Org mode version
> 9.1.8.

Interesting.  So obviously something in my configuration.  Sigh.  I may
be gone some time :-)

Thanks for checking,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-303-g6cf5fc

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22  8:34     ` Bastien
  2018-03-22  8:55       ` Eric S Fraga
@ 2018-03-22  9:22       ` Eric S Fraga
  2018-03-22  9:43         ` Bastien
  1 sibling, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2018-03-22  9:22 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On Thursday, 22 Mar 2018 at 09:34, Bastien wrote:
> Yes it works both with my configuration and with emacs -Q here, with
> GNU Emacs 27.0.50 (build 51, i686-pc-linux-gnu) and Org mode version
> 9.1.8.

Very strange.  Just tried with emacs -Q, org up to date from git, and it
still doesn't work for me.  Actual contents of file are:

#+begin_src org
  ,#+macro: title This is the actual title
  ,#+title: @@latex:\fbox{@@ {{{title}}} @@latex:}@@
  ,* heading
  this is some text.
#+end_src

The backtrace, after waiting a little bit, is:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (quit)
  org-macro-replace-all((("n" . "(eval (org-macro--counter-increment $1 $2))") ("modification-time" . "(eval\n(format-time-string $1\n                     (or (and (org-string-nw-p $2)\n                              (org-macro--vc-modified-time \"/tmp/t.org\"))\n                     '(23219 29867 476148 871000))))") ("input-file" . "t.org") ("time" . "(eval (format-time-string $1))") ("property" . "(eval (save-excursion\n        (let ((l $2))\n          (when (org-string-nw-p l)\n            (condition-case _\n                (let ((org-link-search-must-match-exact-headline t))\n                  (org-link-search l nil t))\n              (error\n               (error \"Macro property failed: cannot find location %s\"\n                      l)))))\n        (org-entry-get nil $1 'selective)))") ("results" . "$1") ("keyword" . "(eval (org-macro--find-keyword-value $1))") ("email") ("date") ("author") ("title" . "@@latex:\\fbox{@@ {{{title}}} @@latex:}@@")) ("DESCRIPTION" "KEYWORDS" "SUBTITLE" "DATE" "TITLE" "DATE" "AUTHOR"))
  org-export-as(latex nil nil nil (:output-file "t.tex"))
  org-export-to-file(latex "t.tex" nil nil nil nil nil)
  org-latex-export-to-latex(nil nil nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)
--8<---------------cut here---------------end--------------->8---

I am not surprised that there is an infinite loop given that title is
being replaced by something that includes the title macro?  Or am I
misreading the backtrace?

Interestingly, although I have updated org and the log says that 8 hours
ago you created the 9.1.8 release, the org version is still 9.1.6.

In any case, no worries as simply changing the macro name (& subsequent
use) to titlecontents or similar does the job.

thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22  9:22       ` Eric S Fraga
@ 2018-03-22  9:43         ` Bastien
  2018-03-22 12:12           ` Eric S Fraga
  2018-03-22 13:28           ` Nicolas Goaziou
  0 siblings, 2 replies; 15+ messages in thread
From: Bastien @ 2018-03-22  9:43 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Hi Eric,

Eric S Fraga <esflists@gmail.com> writes:

> Interestingly, although I have updated org and the log says that 8 hours
> ago you created the 9.1.8 release, the org version is still 9.1.6.

I hate to suggest this, but could there be something wrong in your
installation?

> In any case, no worries as simply changing the macro name (& subsequent
> use) to titlecontents or similar does the job.

Well, even if the workaround works, I think we should prevent Org from
crashing here.

I will try to test after you confirm it does not work with Org>9.1.6.

Thanks!

-- 
 Bastien

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22  9:43         ` Bastien
@ 2018-03-22 12:12           ` Eric S Fraga
  2018-03-22 12:23             ` Kaushal Modi
  2018-03-22 13:28           ` Nicolas Goaziou
  1 sibling, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2018-03-22 12:12 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On Thursday, 22 Mar 2018 at 10:43, Bastien wrote:
> I hate to suggest this, but could there be something wrong in your
> installation?

Hi Bastien,

don't hesitate at all to suggest this!  There's always that
possibility.  :-( I don't think I have a mixed installation although I'm
not sure how to verify this.

Now, the really interesting thing is that if I use emacs -Q and try
exporting the file with the version of org that comes with the latest
emacs snapshot,

   GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.29) of 2018-03-18, unofficial emacs-snapshot build: http://emacs.secretsauce.net

   Org mode version 9.1.6 (release_9.1.6-50-g96b33f @ /usr/share/emacs/27.0.50/lisp/org/)

the export works!  

If I emacs -Q and make sure the load path points to the git version of
org, it doesn't work.  When I do so, I have 

    Org mode version 9.1.6 (release_9.1.6-341-g3a4fd3 @ /home/ucecesf/git/org-mode/lisp/)

and git status says:

--8<---------------cut here---------------start------------->8---
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
--8<---------------cut here---------------end--------------->8---

I do not understand why the org version is not 9.1.8.  What does your
say?

>> In any case, no worries as simply changing the macro name (& subsequent
>> use) to titlecontents or similar does the job.
>
> Well, even if the workaround works, I think we should prevent Org from
> crashing here.

Indeed, but I am stuck as to how to proceed.  Suggestions welcome, of
course!

Thanks,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22 12:12           ` Eric S Fraga
@ 2018-03-22 12:23             ` Kaushal Modi
  2018-03-22 15:34               ` Eric S Fraga
  0 siblings, 1 reply; 15+ messages in thread
From: Kaushal Modi @ 2018-03-22 12:23 UTC (permalink / raw)
  To: Bastien, emacs-orgmode

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

On Thu, Mar 22, 2018, 8:14 AM Eric S Fraga <esflists@gmail.com> wrote:

>
> If I emacs -Q and make sure the load path points to the git version of
> org, it doesn't work.  When I do so, I have
>
>     Org mode version 9.1.6 (release_9.1.6-341-g3a4fd3 @
> /home/ucecesf/git/org-mode/lisp/)
>

Org is probably getting loaded before you tweak the load paths. e.g. emacs
-Q foo.org would do that. That version looks like the one that's on
emacs-26/master branch of Emacs.

I had written a post to fix such issues and be able to specifically use Org
(1) that ships with Emacs (2) from Elpa, or (3) from git.

Sorry if you have already read it and this sounds like spam:
https://scripter.co/building-org-development-version/.

> --

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1395 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22  9:43         ` Bastien
  2018-03-22 12:12           ` Eric S Fraga
@ 2018-03-22 13:28           ` Nicolas Goaziou
  2018-03-22 16:39             ` Eric S Fraga
  1 sibling, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2018-03-22 13:28 UTC (permalink / raw)
  To: Bastien; +Cc: Eric S Fraga, emacs-orgmode

Hello,

Bastien <bzg@gnu.org> writes:

> Eric S Fraga <esflists@gmail.com> writes:
>
>> Interestingly, although I have updated org and the log says that 8 hours
>> ago you created the 9.1.8 release, the org version is still 9.1.6.
>
> I hate to suggest this, but could there be something wrong in your
> installation?
>
>> In any case, no worries as simply changing the macro name (& subsequent
>> use) to titlecontents or similar does the job.
>
> Well, even if the workaround works, I think we should prevent Org from
> crashing here.

I can reproduce the freeze on master. I will have a look at it whenever
I get some spare time, i.e., hopefully this night.

Regards,

-- 
Nicolas Goaziou

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22 12:23             ` Kaushal Modi
@ 2018-03-22 15:34               ` Eric S Fraga
  0 siblings, 0 replies; 15+ messages in thread
From: Eric S Fraga @ 2018-03-22 15:34 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Bastien, emacs-orgmode

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

On Thursday, 22 Mar 2018 at 12:23, Kaushal Modi wrote:
>
> Org is probably getting loaded before you tweak the load paths. e.g. emacs
> -Q foo.org would do that. That version looks like the one that's on
> emacs-26/master branch of Emacs.

Thank you.  What is the number after the 9.1.6- in the org version for
yours?  I do not load the file immediately.  My means of testing is:

    emacs -Q

evaluate

#+begin_src emacs-lisp
  (add-to-list 'load-path "~/git/org-mode/lisp")
  (require 'org)
#+end_src 

and then visit foo.org to test.

I get a different version of org (differing in the number of 9.1.6-) if
I evaluate that lisp code when compared to not evaluating it.

Thanks again,
eric

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22 13:28           ` Nicolas Goaziou
@ 2018-03-22 16:39             ` Eric S Fraga
  2018-03-23 22:42               ` Nicolas Goaziou
  0 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2018-03-22 16:39 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode

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

On Thursday, 22 Mar 2018 at 14:28, Nicolas Goaziou wrote:
> I can reproduce the freeze on master. I will have a look at it whenever
> I get some spare time, i.e., hopefully this night.

Thank you!  Great to know I am not going completely mad ;-)

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-22 16:39             ` Eric S Fraga
@ 2018-03-23 22:42               ` Nicolas Goaziou
  2018-03-24 17:54                 ` Eric S Fraga
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Goaziou @ 2018-03-23 22:42 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hello,

Eric S Fraga <esflists@gmail.com> writes:

> On Thursday, 22 Mar 2018 at 14:28, Nicolas Goaziou wrote:
>> I can reproduce the freeze on master. I will have a look at it whenever
>> I get some spare time, i.e., hopefully this night.
>
> Thank you!  Great to know I am not going completely mad ;-)

A bit late, yet fixed. Thank you.

Regards,

-- 
Nicolas Goaziou

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-23 22:42               ` Nicolas Goaziou
@ 2018-03-24 17:54                 ` Eric S Fraga
  2018-04-26 23:34                   ` Bastien
  0 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2018-03-24 17:54 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode

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

On Friday, 23 Mar 2018 at 23:42, Nicolas Goaziou wrote:
> A bit late, yet fixed. Thank you.

Thank you!  Works fine now.  And I have increased confidence in my
sanity. ;-)

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-341-g3a4fd3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: cautionary tale: avoid creating/using a macro called "title"
  2018-03-24 17:54                 ` Eric S Fraga
@ 2018-04-26 23:34                   ` Bastien
  0 siblings, 0 replies; 15+ messages in thread
From: Bastien @ 2018-04-26 23:34 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode, Nicolas Goaziou

Hi Nicolas and Eric,

Eric S Fraga <esflists@gmail.com> writes:

> On Friday, 23 Mar 2018 at 23:42, Nicolas Goaziou wrote:
>> A bit late, yet fixed. Thank you.
>
> Thank you!  Works fine now.  And I have increased confidence in my
> sanity. ;-)

Indeed, thanks for fixing this!  Let's all increase our confidence in
our sanity, that something we strongly need when debugging Emacs :)

-- 
 Bastien

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

end of thread, other threads:[~2018-04-26 23:34 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-14 17:37 cautionary tale: avoid creating/using a macro called "title" Eric S Fraga
2018-03-21  1:06 ` Bastien
2018-03-21 11:01   ` Eric S Fraga
2018-03-22  8:34     ` Bastien
2018-03-22  8:55       ` Eric S Fraga
2018-03-22  9:22       ` Eric S Fraga
2018-03-22  9:43         ` Bastien
2018-03-22 12:12           ` Eric S Fraga
2018-03-22 12:23             ` Kaushal Modi
2018-03-22 15:34               ` Eric S Fraga
2018-03-22 13:28           ` Nicolas Goaziou
2018-03-22 16:39             ` Eric S Fraga
2018-03-23 22:42               ` Nicolas Goaziou
2018-03-24 17:54                 ` Eric S Fraga
2018-04-26 23:34                   ` Bastien

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