Kill buffers after HTML and LaTeX exports.

This commit is contained in:
Bastien Guerry 2008-02-29 21:30:04 +00:00
parent 28c27dbf56
commit 7d899b888a
3 changed files with 33 additions and 46 deletions

View File

@ -1,10 +1,10 @@
2008-02-29 Bastien Guerry <bzg@altern.org> 2008-02-29 Bastien Guerry <bzg@altern.org>
* org-export-latex.el (org-export-as-latex): Kill buffer after * org.el (org-export-as-html): Kill buffer after
save when `to-buffer' is nil. export when `to-buffer' is nil.
* org.el (org-export-as-html): Kill buffer after save when * org-export-latex.el (org-export-as-latex): Kill buffer after
`to-buffer' is nil. export when `to-buffer' is nil.
2008-02-29 Carsten Dominik <dominik@science.uva.nl> 2008-02-29 Carsten Dominik <dominik@science.uva.nl>

View File

@ -364,6 +364,8 @@ When argument is not given, return all property lists for all projects."
(plists nil) (plists nil)
(single nil) (single nil)
(components nil)) (components nil))
;;
;; ;;
(while (setq project (pop alist)) (while (setq project (pop alist))
;; what kind of project is it? ;; what kind of project is it?
@ -384,40 +386,32 @@ When argument is not given, return all property lists for all projects."
plists)) plists))
(defun org-publish-get-base-files (plist &optional exclude-regexp) (defun org-publish-get-base-files (plist &optional exclude-regexp)
"Return a list of all files in project defined by PLIST. "Return a list of all files in project defined by PLIST.
If EXCLUDE-REGEXP is set, this will be used to filter out If EXCLUDE-REGEXP is set, this will be used to filter out
matching filenames." matching filenames."
(let* ((base-dir (file-name-as-directory (plist-get plist :base-directory))) (let* ((dir (file-name-as-directory (plist-get plist :base-directory)))
(include-list (plist-get plist :include)) (include-list (plist-get plist :include))
(recursive-p (plist-get plist :recursive))
(extension (or (plist-get plist :base-extension) "org")) (extension (or (plist-get plist :base-extension) "org"))
(regexp (concat "^[^\\.].*\\.\\(" extension "\\)$")) (regexp (concat "^[^\\.].*\\.\\(" extension "\\)$"))
alldirs allfiles files dir) (allfiles (directory-files dir t regexp)))
;; Get all files and directories in base-directory ;;
(setq files (dired-files-attributes base-dir)) ;; exclude files
;; Get all subdirectories if recursive-p (setq allfiles
(setq alldirs
(if recursive-p
(delete nil (mapcar (lambda(f) (if (caaddr f) (cadr f))) files))
(list base-dir)))
(while (setq dir (pop alldirs))
(setq files (directory-files dir t regexp))
;; Exclude files
(setq files
(if (not exclude-regexp) (if (not exclude-regexp)
files allfiles
(delq nil (delq nil
(mapcar (lambda (x) (mapcar (lambda (x)
(if (string-match exclude-regexp x) nil x)) (if (string-match exclude-regexp x) nil x))
files)))) allfiles))))
;; Include extra files ;;
;; include extra files
(let ((inc nil)) (let ((inc nil))
(while (setq inc (pop include-list)) (while (setq inc (pop include-list))
(setq files (cons (expand-file-name inc dir) files)))) (setq allfiles (cons (expand-file-name inc dir) allfiles))))
(setq allfiles (append allfiles files)))
allfiles))
allfiles))
(defun org-publish-get-project-from-filename (filename) (defun org-publish-get-project-from-filename (filename)
@ -458,7 +452,7 @@ FILENAME is the filename of the org file to be published."
(require 'org) (require 'org)
(let* ((arg (plist-get plist :headline-levels))) (let* ((arg (plist-get plist :headline-levels)))
(progn (progn
(set-buffer (find-file-noselect filename)) (find-file filename)
(funcall (intern (concat "org-export-as-" format)) (funcall (intern (concat "org-export-as-" format))
arg nil plist) arg nil plist)
(kill-buffer (current-buffer))))) (kill-buffer (current-buffer)))))
@ -482,17 +476,12 @@ FILENAME is the filename of the file to be published."
(defun org-publish-file (filename) (defun org-publish-file (filename)
"Publish file FILENAME." "Publish file FILENAME."
(let* ((base-dir (plist-get plist :publishing-directory)) (let* ((project-name (org-publish-get-project-from-filename filename))
(project-name (org-publish-get-project-from-filename filename))
(plist (org-publish-get-plist-from-filename filename)) (plist (org-publish-get-plist-from-filename filename))
(publishing-function (or (plist-get plist :publishing-function) (publishing-function (or (plist-get plist :publishing-function) 'org-publish-org-to-html)))
'org-publish-org-to-html)))
(if (not project-name) (if (not project-name)
(error "File %s is not part of any known project" filename)) (error "File %s is not part of any known project" filename))
(when (org-publish-needed-p filename) (when (org-publish-needed-p filename)
;; take care of non-existents directories
(if (not (file-exists-p (file-name-as-directory filename)))
(make-directory (file-name-directory filename) t))
(if (listp publishing-function) (if (listp publishing-function)
;; allow chain of publishing functions ;; allow chain of publishing functions
(mapc (lambda (f) (mapc (lambda (f)

4
org.el
View File

@ -25890,9 +25890,7 @@ lang=\"%s\" xml:lang=\"%s\">
(insert (format "<span style=\"visibility:hidden;\">%s</span>" (insert (format "<span style=\"visibility:hidden;\">%s</span>"
(make-string n ?x))))) (make-string n ?x)))))
(or to-buffer (or to-buffer (progn (save-buffer) (kill-buffer (current-buffer))))
(progn (save-buffer)
(kill-buffer (current-buffer))))
(goto-char (point-min)) (goto-char (point-min))
(message "Exporting... done") (message "Exporting... done")
(if (eq to-buffer 'string) (if (eq to-buffer 'string)