From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Bach Subject: latex export subtree: org-latex-export-process Date: Wed, 25 Sep 2013 18:35:21 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOs3u-0005Zu-9I for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 12:35:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOs3o-0005ZM-Bh for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 12:35:38 -0400 Received: from plane.gmane.org ([80.91.229.3]:36653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOs3o-0005ZD-4r for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 12:35:32 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VOs3m-0004lU-Dp for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 18:35:30 +0200 Received: from 84-112-231-91.dynamic.surfer.at ([84.112.231.91]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Sep 2013 18:35:30 +0200 Received: from phaebz by 84-112-231-91.dynamic.surfer.at with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Sep 2013 18:35:30 +0200 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Dear org-mode Users and Developers, (org-mode v8.1) I use the following function for customizable latex export processes #+begin_src emacs-lisp (defun my-auto-tex-cmd (backend) "When exporting from .org with latex, automatically run latex, pdflatex, or xelatex as appropriate, using latexmk." (let ((texcmd)) (cond ((string-match "LATEX_CMD: pdflatex" (buffer-string)) (setq texcmd "latexmk -pdflatex=pdflatex -pdf %f")) ((string-match "LATEX_CMD: pdflatex-shell-escape" (buffer-string)) (setq texcmd "latexmk -pdflatex=pdflatex --shell-escape -pdf %f")) ((string-match "LATEX_CMD: xelatex" (buffer-string)) (setq texcmd "latexmk -pdflatex=xelatex -pdf %f")) (t (setq texcmd "latexmk -pdf %f")) ) (setq org-latex-pdf-process (list texcmd)))) (add-hook 'org-export-before-processing-hook 'my-auto-tex-cmd) #+end_src which essentially uses an earlier idea[1]. Now this works well if I export an .org buffer as a whole. If I export a subtree, the `buffer-string` only contains the subtree without the .org buffer header, so the `string-match` always fails. Any ideas on how to best integrate this function during a subtree export? Maybe inside a hook that is run before the subtree is narrowed down? Best Regards, Michael [1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00218.html