Improve removal of temporary buffers during publishing.

Report by Richard Riley.
This commit is contained in:
Carsten Dominik 2008-11-24 18:27:14 +01:00
parent eb48aaa7c1
commit 663960af62
3 changed files with 12 additions and 11 deletions

View File

@ -126,7 +126,7 @@
that the command =org-open-at-point-global= which follows
links not only in Org-mode, but in arbitrary files like
source code files etc, will work also with links created by
planner. The following customization es needed to make all of
planner. The following customization is needed to make all of
this work
#+begin_src emacs-lisp

View File

@ -1,5 +1,8 @@
2008-11-24 Carsten Dominik <carsten.dominik@gmail.com>
* org-publish.el (org-publish-org-index): Improve removal of
temporary buffers.
* org-agenda.el (org-get-closed): Re-apply changes
accidentially overwritten by last commit to Emacs.

View File

@ -619,13 +619,12 @@ Default for INDEX-FILENAME is 'index.org'."
(concat "Index for project " (car project))))
(index-style (or (plist-get project-plist :index-style)
'tree))
(index-buffer (find-buffer-visiting index-filename))
(visiting (find-buffer-visiting index-filename))
(ifn (file-name-nondirectory index-filename))
file)
;; if buffer is already open, kill it to prevent error message
(if index-buffer
(kill-buffer index-buffer))
(with-temp-buffer
file index-buffer)
(with-current-buffer (setq index-buffer
(or visiting (find-file index-filename)))
(erase-buffer)
(insert (concat "#+TITLE: " index-title "\n\n"))
(while (setq file (pop files))
(let ((fn (file-name-nondirectory file))
@ -662,10 +661,9 @@ Default for INDEX-FILENAME is 'index.org'."
;; This is common to 'flat and 'tree
(insert (concat indent-str " + [[file:" link "]["
(org-publish-find-title file)
"]]\n"))
)))
(write-file index-filename)
(kill-buffer (current-buffer)))))
"]]\n")))))
(save-buffer))
(or visiting (kill-buffer index-buffer))))
(defun org-publish-find-title (file)
"Find the title of file in project."