Browse Source

Export: Kill product buffer if it has been displayed directly

Request by Livin Stephen Sharma
Carsten Dominik 15 years ago
parent
commit
d0b0f776d2
4 changed files with 25 additions and 2 deletions
  1. 9 0
      lisp/ChangeLog
  2. 7 0
      lisp/org-exp.el
  3. 3 1
      lisp/org-html.el
  4. 6 1
      lisp/org-latex.el

+ 9 - 0
lisp/ChangeLog

@@ -1,5 +1,14 @@
 2010-02-21  Carsten Dominik  <carsten.dominik@gmail.com>
 2010-02-21  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
+	* org-html.el (org-export-as-html-and-open): Kill product buffer
+	if the user wants that.
+
+	* org-latex.el (org-export-as-pdf-and-open): Kill product buffer
+	if the user wants that.
+
+	* org-exp.el (org-export-kill-product-buffer-when-displayed): New
+	option.
+
 	* org-agenda.el (org-batch-agenda-csv): Use the time property
 	* org-agenda.el (org-batch-agenda-csv): Use the time property
 	instead of the `time-of-day' property.
 	instead of the `time-of-day' property.
 
 

+ 7 - 0
lisp/org-exp.el

@@ -80,6 +80,13 @@ is nil, the buffer remains buried also in these cases."
   :group 'org-export-general
   :group 'org-export-general
   :type 'boolean)
   :type 'boolean)
 
 
+(defcustom org-export-kill-product-buffer-when-displayed nil
+  "Non-nil means kill the product buffer if it is displayed immediately.
+This applied to the commands `org-export-html-and-open' and
+`org-export-as-pdf-and-open'."
+  :group 'org-export-general
+  :type 'boolean)
+
 (defcustom org-export-run-in-background nil
 (defcustom org-export-run-in-background nil
   "Non-nil means export and publishing commands will run in background.
   "Non-nil means export and publishing commands will run in background.
 This works by starting up a separate Emacs process visiting the same file
 This works by starting up a separate Emacs process visiting the same file

+ 3 - 1
lisp/org-html.el

@@ -443,7 +443,9 @@ The prefix ARG specifies how many levels of the outline should become
 headlines.  The default is 3.  Lower levels will become bulleted lists."
 headlines.  The default is 3.  Lower levels will become bulleted lists."
   (interactive "P")
   (interactive "P")
   (org-export-as-html arg 'hidden)
   (org-export-as-html arg 'hidden)
-  (org-open-file buffer-file-name))
+  (org-open-file buffer-file-name)
+  (when org-export-kill-product-buffer-when-displayed
+    (kill-buffer)))
 
 
 ;;;###autoload
 ;;;###autoload
 (defun org-export-as-html-batch ()
 (defun org-export-as-html-batch ()

+ 6 - 1
lisp/org-latex.el

@@ -861,7 +861,12 @@ when PUB-DIR is set, use this as the publishing directory."
   (interactive "P")
   (interactive "P")
   (let ((pdffile (org-export-as-pdf arg)))
   (let ((pdffile (org-export-as-pdf arg)))
     (if pdffile
     (if pdffile
-	(org-open-file pdffile)
+	(progn
+	  (org-open-file pdffile)
+	  (when org-export-kill-product-buffer-when-displayed
+	    (kill-buffer (find-buffer-visiting
+			  (concat (file-name-sans-extension (buffer-file-name))
+				  ".tex")))))
       (error "PDF file was not produced"))))
       (error "PDF file was not produced"))))
 
 
 ;;; Parsing functions:
 ;;; Parsing functions: