emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Bastien <bzg@gnu.org>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Remove unecesssary invocations of org-mode in ox-publish
Date: Tue, 29 Jul 2014 10:45:22 -0500	[thread overview]
Message-ID: <87k36wnp7x.fsf@fastmail.fm> (raw)
In-Reply-To: <87fvhk9p0m.fsf@bzg.ath.cx> (Bastien's message of "Tue, 29 Jul 2014 17:13:29 +0200")

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

Bastien <bzg@gnu.org> writes:

> Hi Matt,
>
> Matt Lundin <mdl@imapmail.org> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Call-org-export-get-environment-in-buffer-copy.patch --]
[-- Type: text/x-diff, Size: 1597 bytes --]

From 72217e53103a82e0397d1435331e3eed10f0fbd5 Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
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


  reply	other threads:[~2014-07-29 15:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29  5:10 [PATCH] Remove unecesssary invocations of org-mode in ox-publish Matt Lundin
2014-07-29 13:21 ` Bastien
2014-07-29 15:03   ` Matt Lundin
2014-07-29 15:10     ` Matt Lundin
2014-07-29 15:13       ` Bastien
2014-07-29 16:04         ` Matt Lundin
2014-07-29 21:33           ` Bastien
2014-07-29 15:12     ` Matt Lundin
2014-07-29 15:13     ` Bastien
2014-07-29 15:45       ` Matt Lundin [this message]
2014-07-29 18:55         ` Matt Lundin
2014-07-29 21:33           ` Bastien
2014-07-30 16:55           ` Nicolas Goaziou
2014-07-30 19:33             ` Matt Lundin
2014-07-30 20:59               ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k36wnp7x.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).