emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] cautionary tale: avoid creating/using a macro called "title"


From: Eric S Fraga
Subject: Re: [O] cautionary tale: avoid creating/using a macro called "title"
Date: Thu, 22 Mar 2018 09:22:03 +0000

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: signature.asc
Description: PGP signature


reply via email to

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