Browse Source

Kill buffers after publication.

Whether a buffer is created or not depends on publishing functions such
as `org-export-as-html' and the like.  But not all such functions create
a new buffer (e.g. `org-publish-attachment'), so we need to delete the
buffer if it differs from the last buffer we we're in before export.
Bastien Guerry 17 years ago
parent
commit
d9e7b39a7f
3 changed files with 16 additions and 4 deletions
  1. 8 0
      ChangeLog
  2. 3 3
      org-export-latex.el
  3. 5 1
      org-publish.el

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2008-03-07  Bastien Guerry  <bzg@altern.org>
+
+	* org-export-latex.el (org-export-as-latex): Revert the change
+	that killed the html buffer.
+
+	* org-publish.el (org-publish-file): If the publishing function
+	creates a new buffer, kill it after publishing.
+
 2008-03-07  Carsten Dominik  <dominik@science.uva.nl>
 
 	* org.el (org-export-as-html): Revert the change that killed the

+ 3 - 3
org-export-latex.el

@@ -42,7 +42,7 @@
 ;; M-x `org-export-as-latex-to-buffer'
 ;; M-x `org-export-region-as-latex'
 ;; M-x `org-replace-region-by-latex'
-;; 
+;;
 ;;; Code:
 
 (eval-when-compile
@@ -457,7 +457,7 @@ when PUB-DIR is set, use this as the publishing directory."
 
     ;; finalization
     (unless body-only (insert "\n\\end{document}"))
-    (or to-buffer (progn (save-buffer) (kill-buffer (current-buffer))))
+    (or to-buffer (save-buffer))
     (goto-char (point-min))
     (message "Exporting to LaTeX...done")
     (prog1
@@ -1143,7 +1143,7 @@ Regexps are those from `org-export-latex-special-string-regexps'."
 	      (let ((end (save-excursion
 			   (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
 			       (match-beginning 0) (point-max)))))
-		(setq footnote (concat (org-trim (buffer-substring (point) end)) 
+		(setq footnote (concat (org-trim (buffer-substring (point) end))
 				       " ")) ; prevent last } being part of a link
 		(delete-region (point) end))
 	      (goto-char foot-beg)

+ 5 - 1
org-publish.el

@@ -503,7 +503,11 @@ FILENAME is the filename of the file to be published."
 	  (mapc (lambda (f)
 		  (funcall f project-plist filename tmp-pub-dir))
 		publishing-function)
-	(funcall publishing-function project-plist filename tmp-pub-dir))
+	(let ((last-buffer (current-buffer)))
+	  (funcall publishing-function project-plist filename tmp-pub-dir)
+	  ;; kill export buffers when publishing
+	  (if (not (eq last-buffer (current-buffer)))
+	      (kill-buffer (current-buffer)))))
       (org-publish-update-timestamp filename))))
 
 (defun org-publish-projects (projects)