From e14cb99936da00e1b337111c8c751dcf623e3d6d Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 11 Mar 2008 11:48:17 +0000 Subject: [PATCH] Bugfixes: really kill org and export buffers. Also add a new variable `org-publish-initial-buffer' to prevent the initial buffer from being deleted when it is exporter. --- ChangeLog | 5 +++++ org-publish.el | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 30d76e7a9..688dde13a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-11 Bastien Guerry + + * org-publish.el (org-publish-initial-buffer): New variable. + (org-publish-org-to, org-publish): Use it. + 2008-03-10 Bastien Guerry * org-publish.el (org-publish-expand-components): Remove null diff --git a/org-publish.el b/org-publish.el index aa75a60d3..ed9ebd19c 100644 --- a/org-publish.el +++ b/org-publish.el @@ -340,6 +340,9 @@ Each element of this alist is of the form: (file-name . project-name)") +(defvar org-publish-initial-buffer nil + "The buffer `org-publish' has been called from.") + (defun org-publish-initialize-files-alist (&optional refresh) "Set `org-publish-files-alist' if it is not set. Also set it if the optional argument REFRESH is non-nil." @@ -476,13 +479,16 @@ PUB-DIR is the publishing directory." ;; run hooks after export and save export (and (run-hooks 'org-publish-after-export-hook) (if (buffer-modified-p) (save-buffer))) + (kill-buffer export-buf) ;; maybe restore buffer's content (set-buffer init-buf) (when (buffer-modified-p init-buf) (erase-buffer) (insert init-buf-string) (save-buffer) - (goto-char init-point)))) + (goto-char init-point)) + (unless (eq init-buf org-publish-initial-buffer) + (kill-buffer init-buf)))) (defun org-publish-org-to-latex (plist filename pub-dir) "Publish an org file to LaTeX. @@ -600,6 +606,7 @@ Default for INDEX-FILENAME is 'index.org'." (defun org-publish (project &optional force) "Publish PROJECT." (interactive "P") + (setq org-publish-initial-buffer (current-buffer)) (save-window-excursion (let* ((force current-prefix-arg) (org-publish-use-timestamps-flag