From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: [PATCH] Remove unecesssary invocations of org-mode in ox-publish Date: Tue, 29 Jul 2014 10:45:22 -0500 Message-ID: <87k36wnp7x.fsf@fastmail.fm> References: <87mwbsn40z.fsf@fastmail.fm> <871tt4fggm.fsf@bzg.ath.cx> <87zjfsnsyf.fsf@fastmail.fm> <87fvhk9p0m.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC9as-0003es-Sw for emacs-orgmode@gnu.org; Tue, 29 Jul 2014 11:45:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC9al-0005C7-Ms for emacs-orgmode@gnu.org; Tue, 29 Jul 2014 11:45:38 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:58448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC9ak-0005Bl-W9 for emacs-orgmode@gnu.org; Tue, 29 Jul 2014 11:45:31 -0400 In-Reply-To: <87fvhk9p0m.fsf@bzg.ath.cx> (Bastien's message of "Tue, 29 Jul 2014 17:13:29 +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: Bastien Cc: Org Mode --=-=-= Content-Type: text/plain Bastien writes: > Hi Matt, > > Matt Lundin writes: > >> So to be safe, we could do the following in org-publish-find-date and >> org-publish-find-title... >> >> (org-export-with-buffer-copy (org-export-get-environment)) >> >> What do you think? > > Yes, this sounds right, please go ahead. > > I applied your fix in the maint branch, so if you need to revert it > please do the revert from there first. Here's the patch. There's no need to revert anything, as this builds upon my previous commit. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Call-org-export-get-environment-in-buffer-copy.patch >From 72217e53103a82e0397d1435331e3eed10f0fbd5 Mon Sep 17 00:00:00 2001 From: Matt Lundin Date: Tue, 29 Jul 2014 10:39:57 -0500 Subject: [PATCH 1/2] Call org-export-get-environment in buffer copy * lisp/ox-publish.el: (org-publish-find-title) (org-publish-find-date) Make sure to call org-export-get-environment in copy of buffer. Otherwise, #+bind variables meant for export can be set in live buffers. --- lisp/ox-publish.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 94f12e9..26d4be7 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -810,7 +810,10 @@ Default for SITEMAP-FILENAME is 'sitemap.org'." (buffer (or visiting (find-file-noselect file)))) (with-current-buffer buffer (let ((title - (let ((property (plist-get (org-export-get-environment) :title))) + (let ((property + (plist-get + (org-export-with-buffer-copy (org-export-get-environment)) + :title))) (if property (org-no-properties (org-element-interpret-data property)) (file-name-nondirectory (file-name-sans-extension file)))))) @@ -829,7 +832,7 @@ time in `current-time' format." (file-buf (or visiting (find-file-noselect file nil))) (date (plist-get (with-current-buffer file-buf - (org-export-get-environment)) + (org-export-with-buffer-copy (org-export-get-environment))) :date))) (unless visiting (kill-buffer file-buf)) ;; DATE is either a timestamp object or a secondary string. If it -- 2.0.3 --=-=-=--