From 67d2a22fb9417746fc7b4ddf6f0f9e223013ba85 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 7 Jul 2009 15:04:15 +0200 Subject: [PATCH] Publishing: Clean out timestamp directory with `C-u C-c C-e E' When changing the publishing setup, old timestamp files can be left behind. Forcing publishing of all projects with `C-u C-c C-e E' will remove all existing timestamp files. --- doc/org.texi | 8 ++++---- lisp/ChangeLog | 4 ++++ lisp/org-publish.el | 14 +++++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 452155612..a83cf4c21 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -9881,10 +9881,10 @@ Publish every project. @vindex org-publish-use-timestamps-flag Org uses timestamps to track when a file has changed. The above functions normally only publish changed files. You can override this and force -publishing of all files by giving a prefix argument, or by customizing the -variable @code{org-publish-use-timestamps-flag}. This may be necessary in -particular if files include other files via @code{#+SETUPFILE:} or -@code{#+INCLUDE:}. +publishing of all files by giving a prefix argument to any of the commands +above, or by customizing the variable @code{org-publish-use-timestamps-flag}. +This may be necessary in particular if files include other files via +@code{#+SETUPFILE:} or @code{#+INCLUDE:}. @node Miscellaneous, Hacking, Publishing, Top @chapter Miscellaneous diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 320a20a3c..dfc82c8d9 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2009-07-07 Carsten Dominik + * org-publish.el (org-publish-remove-all-timestamps): New function. + (org-publish-all): Remove all timestamp files if `org-publish-all' + is called with a prefix argument. + * org-list.el (org-indent-item): Fix typo. (org-item-indent-positions): Normalize ordered bullet. diff --git a/lisp/org-publish.el b/lisp/org-publish.el index 05ce9804a..b9e9820dc 100644 --- a/lisp/org-publish.el +++ b/lisp/org-publish.el @@ -244,6 +244,15 @@ If there is no timestamp, create one." (set-file-times timestamp-file) (call-process "touch" nil 0 nil (expand-file-name timestamp-file))))) +(defun org-publish-remove-all-timestamps () + "Remove all files in the timstamp directory." + (let ((dir org-publish-timestamp-directory) + files) + (when (and (file-exists-p dir) + (file-directory-p dir)) + (mapc 'delete-file (directory-files dir 'full "[^.]\\'"))))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Mapping files to project names @@ -631,8 +640,11 @@ Default for INDEX-FILENAME is 'sitemap.org'." ;;;###autoload (defun org-publish-all (&optional force) "Publish all projects. -With prefix argument, force publish all files." +With prefix argument, remove all files in the timestamp +directory and force publishing all files." (interactive "P") + (when force + (org-publish-remove-all-timestamps)) (org-publish-initialize-files-alist) (save-window-excursion (let ((org-publish-use-timestamps-flag -- 2.11.4.GIT