From mboxrd@z Thu Jan 1 00:00:00 1970 From: gregory@dynapse.com (Gregory J. Grubbs) Subject: Re: org batch job using emacsclient? Date: Mon, 16 Nov 2009 08:41:58 -0700 Message-ID: <873a4e329l.fsf@dynapse.com> References: <4A2B8DB1-1A56-40CA-B972-E44C16F9DD1E@nf.mpg.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NA3j2-0002IL-BH for emacs-orgmode@gnu.org; Mon, 16 Nov 2009 10:42:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NA3ix-0002G8-6C for emacs-orgmode@gnu.org; Mon, 16 Nov 2009 10:42:43 -0500 Received: from [199.232.76.173] (port=56578 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NA3iw-0002G3-UA for emacs-orgmode@gnu.org; Mon, 16 Nov 2009 10:42:38 -0500 Received: from lo.gmane.org ([80.91.229.12]:53438) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NA3iw-0000il-Gl for emacs-orgmode@gnu.org; Mon, 16 Nov 2009 10:42:38 -0500 Received: from list by lo.gmane.org with local (Exim 4.50) id 1NA3ip-0006M1-J6 for emacs-orgmode@gnu.org; Mon, 16 Nov 2009 16:42:31 +0100 Received: from 72.42.83.192 ([72.42.83.192]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Nov 2009 16:42:31 +0100 Received: from gregory by 72.42.83.192 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Nov 2009 16:42:31 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Stefan Vollmar writes: > Hello, > > we are currently setting up some org-templates for simple web pages (e.g. CV information for members of our institute). So far this seems to work surprisingly well - even for users who use editors other than Emacs (yes, we need to try harder...). We have created a web service so users can upload an org-file and get a preview of the generated HTML page. > > In a python script we use (a recipe from this very useful list): > > [...] > cmd = emacs \ > + " -Q --batch" > + " --eval \"(add-to-list 'load-path \\\"" + ORGLIB + "\\\")\"" \ > + " --eval \"(require 'org)\"" \ > + " --eval \"(require 'org-exp)\"" \ > + " --eval \"(setq org-export-headline-levels 2)\"" \ > + " --visit=\"" + orgfile + "\"" \ > + " --funcall org-export-as-html" > > However, even on a modern system (SunFire T5140, Solaris 10) generating the HTML output with Emacs 23.1 and the latest org-version takes several seconds (which is disappointing). To improve performance, we want to switch to emacsclient but we are not sure how to adapt the above code to do this. Our first attempt: > > cmd = emacsclient + " --eval " \ > + " \"(add-to-list 'load-path \\\"" + ORGLIB + "\\\")\"" \ > + " \"(require 'org)\"" \ > + " \"(require 'org-exp)\"" \ > + " \"(setq org-export-headline-levels 2)\"" \ > + " \"(load-file \\\"" + orgfile + "\\\")\"" \ > + " \"(org-export-as-html)\"" > > did not work. > Any help is appreciated. You are trying to load an Org file as an elisp file. Use find-file or something like it instead. The following worked for me from the shell: --8<---------------cut here---------------start------------->8--- emacsclient --eval "(progn (add-to-list 'load-path \"/home/gregj/emacs/org-mode/lisp\") (require 'org) (require 'org-exp) (find-file \"/home/gregj/projects/blogs.org\") (org-export-as-html 2 nil nil nil nil \"/tmp\"))" --8<---------------cut here---------------end--------------->8---