all messages for Emacs-related lists mirrored at yhetil.org
 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:03:21 -0500	[thread overview]
Message-ID: <87zjfsnsyf.fsf@fastmail.fm> (raw)
In-Reply-To: <871tt4fggm.fsf@bzg.ath.cx> (Bastien's message of "Tue, 29 Jul 2014 15:21:45 +0200")

Bastien <bzg@gnu.org> writes:

> Hi Matt,
>
> Matt Lundin <mdl@imapmail.org> writes:
>
>> This patch fixes a bug in which org-publish makes the following call...
>> (let ((org-inhibit-startup t) (org-mode)))
>
> Applied, thanks!

Oops... I see now that org-publish-find-date and org-publish-find-title
call org-export-get-environment. This in turn relies on org-set-local to
set #+BIND: variables, which requires the buffer to be writable. I have
an org-mode-hook that sets some of my web publishing files read-only (so
as to prevent accidental editing). Without org-inhibit-startup, these
buffers remain read-only, causing the following error message:

--8<---------------cut here---------------start------------->8---
org-export--get-global-options: Buffer is read-only: #<killed buffer>
--8<---------------cut here---------------end--------------->8---

This could be solved by wrapping org-export-get-environment withing
those functions with (let ((buffer-read-only nil)) ...).

However, I think the fundamental problem is that
org-export-get-environment should be called on a copy of the buffer.
That, at least, is how it is used in org-export-as (see lines 3084 -
3107 of ox.el). When org-publish-find-title and org-publish-call-date
calls it in a buffer that is already open, it does so on the original
copy of the buffer. This has the effect of setting the #+BIND variables
within the live buffer, which could (theoretically) be dangerous, since,
AFAICT, they should only be set in a temporary copy of the buffer.

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?

Best,
Matt

  reply	other threads:[~2014-07-29 15:03 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 [this message]
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
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

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

  git send-email \
    --in-reply-to=87zjfsnsyf.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.