diff options
Diffstat (limited to 'lisp/org/org-publish.el')
-rw-r--r-- | lisp/org/org-publish.el | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el index c34d97f8598..a8279e3e1e2 100644 --- a/lisp/org/org-publish.el +++ b/lisp/org/org-publish.el @@ -4,7 +4,7 @@ ;; Author: David O'Toole <dto@gnu.org> ;; Maintainer: Bastien Guerry <bzg AT altern DOT org> ;; Keywords: hypermedia, outlines, wp -;; Version: 6.06b +;; Version: 6.09a ;; This file is part of GNU Emacs. ;; @@ -23,8 +23,6 @@ ;;; Commentary: -;; Requires at least version 4.27 of org.el - ;; This program allow configurable publishing of related sets of ;; Org-mode files as a complete website. ;; @@ -408,25 +406,18 @@ If NO-EXCLUSION is non-nil, don't exclude files." all-files)) (defun org-publish-expand-projects (projects-alist) - "Expand projects contained in PROJECTS-ALIST." - (let (without-component with-component) - (mapc (lambda(p) - (add-to-list - (if (plist-get (cdr p) :components) - 'with-component 'without-component) p)) - projects-alist) - (org-publish-delete-dups - (append without-component - (car (mapcar (lambda(p) (org-publish-expand-components p)) - with-component)))))) - -(defun org-publish-expand-components (project) - "Expand PROJECT into an alist of its components." - (let* ((components (plist-get (cdr project) :components))) - (org-publish-delete-dups - (delq nil (mapcar (lambda(c) (assoc c org-publish-project-alist)) - components))))) - + "Expand projects in PROJECTS-ALIST. +This splices all the components into the list." + (let ((rest projects-alist) rtn p components) + (while (setq p (pop rest)) + (if (setq components (plist-get (cdr p) :components)) + (setq rest (append + (mapcar (lambda (x) (assoc x org-publish-project-alist)) + components) + rest)) + (push p rtn))) + (nreverse (org-publish-delete-dups (delq nil rtn))))) + (defun org-publish-get-base-files-1 (base-dir &optional recurse match skip-file skip-dir) "Set `org-publish-temp-files' with files from BASE-DIR directory. If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is @@ -487,10 +478,11 @@ PUB-DIR is the publishing directory." (require 'org) (unless (file-exists-p pub-dir) (make-directory pub-dir t)) - (find-file filename) - (let ((init-buf (current-buffer)) - (init-point (point)) - (init-buf-string (buffer-string)) export-buf) + (let* ((visiting (find-buffer-visiting filename)) + (plist (cons :buffer-will-be-killed (cons t plist))) + (init-buf (or visiting (find-file filename))) + (init-point (point)) + (init-buf-string (buffer-string)) export-buf) ;; run hooks before exporting (run-hooks 'org-publish-before-export-hook) ;; export the possibly modified buffer @@ -510,7 +502,7 @@ PUB-DIR is the publishing directory." (insert init-buf-string) (save-buffer) (goto-char init-point)) - (unless (eq init-buf org-publish-initial-buffer) + (unless visiting (kill-buffer init-buf)))) (defun org-publish-org-to-latex (plist filename pub-dir) |