1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-05 11:45:52 +00:00

Don't keep buffers visited during index publishing.

The index generation of org-publish does briefly visit all files in
order to extract the correct page title.  Visiting is necessary,
because the title may be set by the first line in the buffer, by a
Before this patch, this would cause the generation of a large number
of buffers, one for each file mentioned in the index.  This patch
arranges for these buffers to be removed again.  However, buffers
which were already present will not be removed.

There is still one open problem:  The files to be published are
visited twice, one for publishing them, a second time for creating the
index.  Visiting causes some overhead, and we would like to limit this
overhead.  For now, however, this is not done.
This commit is contained in:
Carsten Dominik 2008-11-02 17:13:25 +01:00
parent bdc93a9cd2
commit cb1bbaf244
2 changed files with 16 additions and 10 deletions

View File

@ -1,5 +1,8 @@
2008-11-02 Carsten Dominik <dominik@science.uva.nl>
* org-publish.el (org-publish-find-title): Remove buffers visited
only for extracting the title.
* org-exp.el (org-export-html-style)
(org-export-html-style-default): Mark style definitions as
unparsed CDATA.

View File

@ -673,16 +673,19 @@ Default for INDEX-FILENAME is 'index.org'."
(defun org-publish-find-title (file)
"Find the title of file in project."
(save-excursion
(set-buffer (find-file-noselect file))
(let* ((opt-plist (org-combine-plists (org-default-export-plist)
(org-infile-export-plist))))
(or (plist-get opt-plist :title)
(and (not
(plist-get opt-plist :skip-before-1st-heading))
(org-export-grab-title-from-buffer))
(file-name-nondirectory (file-name-sans-extension file))))))
(let* ((visiting (find-buffer-visiting file))
(buffer (or visiting (find-file-noselect file))))
(save-excursion
(set-buffer buffer)
(let* ((opt-plist (org-combine-plists (org-default-export-plist)
(org-infile-export-plist))))
(or (plist-get opt-plist :title)
(and (not
(plist-get opt-plist :skip-before-1st-heading))
(org-export-grab-title-from-buffer))
(file-name-nondirectory (file-name-sans-extension file)))))
(unless visiting
(kill-buffer buffer))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Interactive publishing functions