emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: Scot Becker <scot.becker@gmail.com>
Cc: David Maus <dmaus@ictsoc.de>, Org-mode ml <emacs-orgmode@gnu.org>
Subject: Re: Exporting property values to LaTeX
Date: Thu, 09 Sep 2010 18:03:01 +0200	[thread overview]
Message-ID: <87d3sm7vm2.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <AANLkTi=foaBbF+9gdtMJMhVQoZ5VxBctRz4jQi=pofa4@mail.gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1969 bytes --]

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.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.1.2: 0001-Allow-selective-property-inheritance-in-property-mac.patch --]
[-- Type: text/plain, Size: 984 bytes --]

From 37abd340b23d37328c34bf524f4c80f7b1ce9b0e Mon Sep 17 00:00:00 2001
From: David Maus <dmaus@ictsoc.de>
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


[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

      reply	other threads:[~2010-09-09 16:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-09 11:42 Exporting property values to LaTeX Scot Becker
2010-09-09 13:44 ` David Maus
2010-09-09 15:40   ` Scot Becker
2010-09-09 16:03     ` David Maus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3sm7vm2.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=scot.becker@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).