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