diff --git a/ChangeLog b/ChangeLog index ebb9620f6..377521046 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,10 @@ 2008-02-29 Bastien Guerry - * org-export-latex.el (org-export-as-latex): Kill buffer after - save when `to-buffer' is nil. + * org.el (org-export-as-html): Kill buffer after + export when `to-buffer' is nil. - * org.el (org-export-as-html): Kill buffer after save when - `to-buffer' is nil. + * org-export-latex.el (org-export-as-latex): Kill buffer after + export when `to-buffer' is nil. 2008-02-29 Carsten Dominik diff --git a/org-publish.el b/org-publish.el index 0791a977e..5702898ee 100644 --- a/org-publish.el +++ b/org-publish.el @@ -364,6 +364,8 @@ When argument is not given, return all property lists for all projects." (plists nil) (single nil) (components nil)) + + ;; ;; (while (setq project (pop alist)) ;; what kind of project is it? @@ -384,40 +386,32 @@ When argument is not given, return all property lists for all projects." plists)) + (defun org-publish-get-base-files (plist &optional exclude-regexp) "Return a list of all files in project defined by PLIST. - If EXCLUDE-REGEXP is set, this will be used to filter out - matching filenames." - (let* ((base-dir (file-name-as-directory (plist-get plist :base-directory))) - (include-list (plist-get plist :include)) - (recursive-p (plist-get plist :recursive)) - (extension (or (plist-get plist :base-extension) "org")) - (regexp (concat "^[^\\.].*\\.\\(" extension "\\)$")) - alldirs allfiles files dir) - ;; Get all files and directories in base-directory - (setq files (dired-files-attributes base-dir)) - ;; Get all subdirectories if recursive-p - (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) - files - (delq nil - (mapcar (lambda (x) - (if (string-match exclude-regexp x) nil x)) - files)))) - ;; Include extra files - (let ((inc nil)) - (while (setq inc (pop include-list)) - (setq files (cons (expand-file-name inc dir) files)))) - (setq allfiles (append allfiles files))) - allfiles)) +If EXCLUDE-REGEXP is set, this will be used to filter out +matching filenames." + (let* ((dir (file-name-as-directory (plist-get plist :base-directory))) + (include-list (plist-get plist :include)) + (extension (or (plist-get plist :base-extension) "org")) + (regexp (concat "^[^\\.].*\\.\\(" extension "\\)$")) + (allfiles (directory-files dir t regexp))) + ;; + ;; exclude files + (setq allfiles + (if (not exclude-regexp) + allfiles + (delq nil + (mapcar (lambda (x) + (if (string-match exclude-regexp x) nil x)) + allfiles)))) + ;; + ;; include extra files + (let ((inc nil)) + (while (setq inc (pop include-list)) + (setq allfiles (cons (expand-file-name inc dir) allfiles)))) + allfiles)) (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) (let* ((arg (plist-get plist :headline-levels))) (progn - (set-buffer (find-file-noselect filename)) + (find-file filename) (funcall (intern (concat "org-export-as-" format)) arg nil plist) (kill-buffer (current-buffer))))) @@ -482,17 +476,12 @@ FILENAME is the filename of the file to be published." (defun org-publish-file (filename) "Publish file FILENAME." - (let* ((base-dir (plist-get plist :publishing-directory)) - (project-name (org-publish-get-project-from-filename filename)) + (let* ((project-name (org-publish-get-project-from-filename filename)) (plist (org-publish-get-plist-from-filename filename)) - (publishing-function (or (plist-get plist :publishing-function) - 'org-publish-org-to-html))) + (publishing-function (or (plist-get plist :publishing-function) 'org-publish-org-to-html))) (if (not project-name) (error "File %s is not part of any known project" 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) ;; allow chain of publishing functions (mapc (lambda (f) diff --git a/org.el b/org.el index c206cb836..8a69a1884 100644 --- a/org.el +++ b/org.el @@ -25890,9 +25890,7 @@ lang=\"%s\" xml:lang=\"%s\"> (insert (format "%s" (make-string n ?x))))) - (or to-buffer - (progn (save-buffer) - (kill-buffer (current-buffer)))) + (or to-buffer (progn (save-buffer) (kill-buffer (current-buffer)))) (goto-char (point-min)) (message "Exporting... done") (if (eq to-buffer 'string)