Scot Becker wrote: >David, >Thanks for your response. What a cool and useful patch. This adds all kinds >of cool functionality to org-mode, and in a >single line! I've had several times I wished I could do this kind of thing.
>As it is, it doesn't automate my present case much, since I'd still have to
>put the macro expansion in after every
>headline. Not surprisingly it won't expand if you put the
>{{{property(myproperty}}} code as part of a headline in
>org-export-latex-classes. I reckon I'll have to try to do a hacked-up latex
>exporter.
Or maybe this could be achieved using a function in
`org-export-preprocess-hook':
,----
| Hook for preprocessing an export buffer.
| Pretty much the first thing when exporting is running this hook.
| Point will be in a temporary buffer that contains a copy of
| the original buffer, or of the section that is being export.
| All the other hooks in the org-export-preprocess... category
| also work in that temporary buffer, already modified by various
| stages of the processing.
`----
The function would be quite simple: Iterate over all headlines and
insert the desired reference. This would, by the way, even work
without the property macro.
Something like this:
(defun dmj:add-citekey ()
"Add citekey to all headlines in current buffer."
(save-excursion
(goto-char (point-min))
(while (re-search-forward "\\*+[ \t]+" nil t)
(let ((key (org-entry-get nil "mykey" 'selective)))
(org-end-of-subtree t)
(unless (string= key "")
(insert (format "\nReference: \\cite{%s}\n" key)))))))
>Also, the patch doesn't seem to work with inherited properties. With
>org-use-property-inheritance set to 't', and this input file:
Ah, Forgot about that. Attached patch goes on top of the last one and
allows property inheritance.
Best,
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... [email protected]
Email..... [email protected]
From 37abd340b23d37328c34bf524f4c80f7b1ce9b0e Mon Sep 17 00:00:00 2001 From: David Maus <[email protected]> Date: Thu, 9 Sep 2010 17:46:42 +0200 Subject: [PATCH] Allow selective property inheritance in property macro * org-exp.el (org-infile-export-plist): Allow selective property inheritance in property macro. --- lisp/org-exp.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 64ad454..28157a8 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -771,7 +771,7 @@ modified) list.") ;; Add macro definitions (setq p (plist-put p :macro-date "(eval (format-time-string \"$1\"))")) (setq p (plist-put p :macro-time "(eval (format-time-string \"$1\"))")) - (setq p (plist-put p :macro-property "(eval (org-entry-get nil \"$1\"))")) + (setq p (plist-put p :macro-property "(eval (org-entry-get nil \"$1\" 'selective))")) (setq p (plist-put p :macro-modification-time (and (buffer-file-name) -- 1.7.1
pgpxWJ8y3c700.pgp
Description: PGP signature
_______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. [email protected] http://lists.gnu.org/mailman/listinfo/emacs-orgmode
