From 6062f9ea72732067036d9d959f1627ece0a9056e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 12 Mar 2014 19:54:24 +0100 Subject: [PATCH] ox-publish: Fix small bug * lisp/ox-publish.el (org-publish-cache-file-needs-publishing): Find included file even if keyword is indented. --- lisp/ox-publish.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 9669bf0fd..ad8eb329d 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -1161,22 +1161,26 @@ the file including them will be republished as well." (org-inhibit-startup t) (visiting (find-buffer-visiting filename)) included-files-ctime buf) - (when (equal (file-name-extension filename) "org") (setq buf (find-file (expand-file-name filename))) (with-current-buffer buf (goto-char (point-min)) - (while (re-search-forward - "^#\\+INCLUDE:[ \t]+\"\\([^\t\n\r\"]*\\)\"[ \t]*.*$" nil t) - (let* ((included-file (expand-file-name (match-string 1)))) - (add-to-list 'included-files-ctime - (org-publish-cache-ctime-of-src included-file) t)))) + (while (re-search-forward "^[ \t]*#\\+INCLUDE:" nil t) + (let* ((element (org-element-at-point)) + (included-file + (and (eq (org-element-type element) 'keyword) + (org-string-nw-p (org-element-property :value element))))) + (when included-file + (add-to-list 'included-files-ctime + (org-publish-cache-ctime-of-src + (expand-file-name included-file)) + t))))) (unless visiting (kill-buffer buf))) (if (null pstamp) t (let ((ctime (org-publish-cache-ctime-of-src filename))) (or (< pstamp ctime) (when included-files-ctime - (not (null (delq nil (mapcar (lambda(ct) (< ctime ct)) + (not (null (delq nil (mapcar (lambda (ct) (< ctime ct)) included-files-ctime)))))))))) (defun org-publish-cache-set-file-property