From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Klein Subject: Re: org-mode command in a bash script? Date: Fri, 3 Jun 2016 08:25:44 +0200 Message-ID: <20160603082544.50c519b3@pckr186.mpip-mainz.mpg.de> References: <874m9abzqr.fsf@skimble.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8iYN-0001ry-GW for emacs-orgmode@gnu.org; Fri, 03 Jun 2016 02:26:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8iYI-00072P-Pj for emacs-orgmode@gnu.org; Fri, 03 Jun 2016 02:25:55 -0400 Received: from gate1.mpip-mainz.mpg.de ([194.95.63.248]:63268) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8iYI-000726-IG for emacs-orgmode@gnu.org; Fri, 03 Jun 2016 02:25:50 -0400 In-Reply-To: <874m9abzqr.fsf@skimble.plus.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Cc: Sharon Kimble Hi, On Fri, 03 Jun 2016 06:36:12 +0100 Sharon Kimble 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