emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Robert Klein <roklein@roklein.de>
To: emacs-orgmode@gnu.org
Cc: Sharon Kimble <boudiccas@skimble.plus.com>
Subject: Re: org-mode command in a bash script?
Date: Fri, 3 Jun 2016 08:25:44 +0200	[thread overview]
Message-ID: <20160603082544.50c519b3@pckr186.mpip-mainz.mpg.de> (raw)
In-Reply-To: <874m9abzqr.fsf@skimble.plus.com>

Hi,

On Fri, 03 Jun 2016 06:36:12 +0100
Sharon Kimble <boudiccas@skimble.plus.com> wrote:

> 
> How can I run an org-mode command in a bash script please?
> 
> Specifically 'org-latex-export-to-latex'?
> 
> I'm developing my own modular script to choose between, at present, 3
> tex files which have been pre-exported from org-mode. I'm now
> wondering if its possible to export from the org-mode file as part of
> another module in the script.
> 
> Can it be done, and if so, how please?


I'm using this shell function for exporting certain documents to pdf:


orgexp()
{
    emacs  --batch -l ~/.emacs --eval \
           "(progn
             (setq org-latex-image-default-width \".4cm\"
                   org-export-allow-bind-keywords t
                   org-confirm-babel-evaluate nil)
             (find-file \"$1\")
             (org-latex-export-to-pdf))"
}


You probably don't want to set the variables, so for export to latex
this might work (i.e. I didn't test it):


org2latex()
{
    emacs  --batch -l ~/.emacs --eval \
           "(progn
             (find-file \"$1\")
             (org-latex-export-to-latex))"
}


If you put this in your .bashrc you can just use
    org2latex myfile.org
to export myfile.org to latex.

Best regards
Robert

      reply	other threads:[~2016-06-03  6:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03  5:36 org-mode command in a bash script? Sharon Kimble
2016-06-03  6:25 ` Robert Klein [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=20160603082544.50c519b3@pckr186.mpip-mainz.mpg.de \
    --to=roklein@roklein.de \
    --cc=boudiccas@skimble.plus.com \
    --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).