emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brett Viren <bv@bnl.gov>
To: Christophe Rhodes <csr21@cantab.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-export-current-backend variable and org-mode 8
Date: Wed, 31 Jul 2013 14:41:35 -0400	[thread overview]
Message-ID: <ir4bo5izi5c.fsf@lycastus.phy.bnl.gov> (raw)
In-Reply-To: <874nbavgmw.fsf@cantab.net> (Christophe Rhodes's message of "Wed, 31 Jul 2013 17:27:51 +0100")

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

Hi Christophe,

Christophe Rhodes <csr21@cantab.net> writes:

> In org-mode 7, I was able to use the (documented) variable
> org-export-current-backend to test what the current backend is, allowing
> me to dynamically produce and include images of different formats
> depending on whether I was exporting to latex (tikz) or html (png).
>
> In org-mode 8, I cannot find this variable, or any documented variable
> of a similar nature.  What is the recommended way for dispatching at the
> emacs-lisp level when exporting a document on the export backend?

I don't know if this is exactly what you are asking for but I hit on the
following a few weeks ago.  It defines an elisp macro inside the org
file and then calls it later in the header of a code block to switch the
output file names based on which backend (if any) is in effect.  I hope
it helps.

If you have a better way to do these kind of output switches, I'd like
to know.


* COMMENT setup

#+begin_src emacs-lisp :results silent
  (defmacro by-backend (&rest body)
    `(case (if (boundp 'backend) backend nil) ,@body))
#+end_src
  
* A graph

#+header: :file (by-backend (html "graph.png") (latex "graph.pdf") (t "graph.svg"))
#+header: :export results
#+begin_src dot
digraph Name {
        tail -> head;
}
#+end_src


-Brett.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2013-07-31 18:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 16:27 org-export-current-backend variable and org-mode 8 Christophe Rhodes
2013-07-31 18:41 ` Brett Viren [this message]
2013-07-31 19:09   ` Christophe Rhodes
2013-07-31 20:40     ` Nicolas Goaziou
2013-07-31 21:21       ` Christophe Rhodes
2013-08-02 10:01         ` Christophe Rhodes
2013-08-03  7:50           ` Nicolas Goaziou
2013-08-03 17:55             ` Achim Gratz
2013-08-03 19:08               ` Nicolas Goaziou

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=ir4bo5izi5c.fsf@lycastus.phy.bnl.gov \
    --to=bv@bnl.gov \
    --cc=csr21@cantab.net \
    --cc=emacs-orgmode@gnu.org \
    /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).