From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Emacs lisp code export difference between `org-export-region-as-html' and `org-export-as-html' Date: Tue, 25 Sep 2012 11:13:06 +0200 Message-ID: <87d31a5uu5.fsf@bzg.ath.cx> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGRCY-0005dO-Dg for emacs-orgmode@gnu.org; Tue, 25 Sep 2012 05:13:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGRCR-0001zX-OA for emacs-orgmode@gnu.org; Tue, 25 Sep 2012 05:13:10 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:36241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGRCR-0001zG-Hd for emacs-orgmode@gnu.org; Tue, 25 Sep 2012 05:13:03 -0400 Received: by wibhj13 with SMTP id hj13so213844wib.12 for ; Tue, 25 Sep 2012 02:13:02 -0700 (PDT) In-Reply-To: (thorne's message of "Tue, 25 Sep 2012 00:05:28 -0600") 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: thorne Cc: emacs-orgmode@gnu.org Hi, thorne writes: > On Mon, Sep 24, 2012 at 3:53 PM, thorne wrote: >> (defun render-one (file) >> (with-temp-buffer >> (insert-file file) >> (org-export-as-html nil nil nil 'string t))) > > Well, I still don't know why it behaves the way I've described, but it > works the way I want if instead of the above function, I use: > > (defun render-one (file) > (save-excursion > (let ((buffer (set-buffer (find-file file)))) > (setq rtn (org-export-as-html nil nil nil 'string t)) > (kill-buffer buffer) > rtn))) > > -- using find-file and messing with the buffer stuff by hand, instead > of using `with-temp-buffer' and `insert-file', which later strikes me > as neater, and possibly faster (I am using it in batch to process > multiple files) but the other way works, so that's fine. Thanks. Just out of curiosity, did it work for you the way I suggested? find-file will load the appropriate mode, hence no need for (org-mode) in your latest function. -- Bastien