From c5d8495eb3e0cd02bce787b2126207057edb3e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Delafond?= Date: Sun, 18 Dec 2016 18:15:46 +0100 Subject: Imported Upstream version 9.0.2 --- lisp/ox-publish.el | 70 +++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'lisp/ox-publish.el') diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el index 102f460..e8271f6 100644 --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -1199,39 +1199,38 @@ the file including them will be republished as well." (unless org-publish-cache (error "`org-publish-cache-file-needs-publishing' called, but no cache present")) - (let* ((case-fold-search t) - (key (org-publish-timestamp-filename filename pub-dir pub-func)) + (let* ((key (org-publish-timestamp-filename filename pub-dir pub-func)) (pstamp (org-publish-cache-get key)) (org-inhibit-startup t) - (visiting (find-buffer-visiting filename)) - (buf (find-file-noselect (expand-file-name filename))) included-files-ctime) (when (equal (file-name-extension filename) "org") - (unwind-protect - (with-current-buffer buf - (goto-char (point-min)) - (while (re-search-forward "^[ \t]*#\\+INCLUDE:" nil t) - (let* ((element (org-element-at-point)) - (included-file - (and (eq (org-element-type element) 'keyword) - (let ((value (org-element-property :value element))) - (and value - (string-match - "\\`\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)" - value) - (let ((m (match-string 1 value))) - (org-unbracket-string - "\"" "\"" - ;; Ignore search suffix. - (if (string-match "\\(::\\(.*?\\)\\)\"?\\'" - m) - (substring m 0 (match-beginning 0)) - m)))))))) - (when included-file - (push (org-publish-cache-ctime-of-src - (expand-file-name included-file)) - included-files-ctime))))) - (unless visiting (kill-buffer buf)))) + (let ((visiting (find-buffer-visiting filename)) + (buf (find-file-noselect filename)) + (case-fold-search t)) + (unwind-protect + (with-current-buffer buf + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*#\\+INCLUDE:" nil t) + (let* ((element (org-element-at-point)) + (included-file + (and (eq (org-element-type element) 'keyword) + (let ((value (org-element-property :value element))) + (and value + (string-match + "\\`\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)" + value) + (let ((m (match-string 1 value))) + (org-unbracket-string + "\"" "\"" + ;; Ignore search suffix. + (if (string-match "::.*?\"?\\'" m) + (substring m 0 (match-beginning 0)) + m)))))))) + (when included-file + (push (org-publish-cache-ctime-of-src + (expand-file-name included-file)) + included-files-ctime))))) + (unless visiting (kill-buffer buf))))) (or (null pstamp) (let ((ctime (org-publish-cache-ctime-of-src filename))) (or (< pstamp ctime) @@ -1252,9 +1251,9 @@ will be created. Return VALUE." (defun org-publish-cache-get-file-property (filename property &optional default no-create project-name) "Return the value for a PROPERTY of file FILENAME in publishing cache. -Use cache file of PROJECT-NAME. Return the value of that -PROPERTY or DEFAULT, if the value does not yet exist. If the -entry will be created, unless NO-CREATE is not nil." +Use cache file of PROJECT-NAME. Return the value of that PROPERTY, +or DEFAULT, if the value does not yet exist. Create the entry, +if necessary, unless NO-CREATE is non-nil." ;; Evtl. load the requested cache file: (if project-name (org-publish-initialize-cache project-name)) (let ((pl (org-publish-cache-get filename)) retval) @@ -1270,15 +1269,16 @@ entry will be created, unless NO-CREATE is not nil." (defun org-publish-cache-get (key) "Return the value stored in `org-publish-cache' for key KEY. -Returns nil, if no value or nil is found, or the cache does not -exist." +Return nil, if no value or nil is found. Raise an error if the +cache does not exist." (unless org-publish-cache (error "`org-publish-cache-get' called, but no cache present")) (gethash key org-publish-cache)) (defun org-publish-cache-set (key value) "Store KEY VALUE pair in `org-publish-cache'. -Returns value on success, else nil." +Returns value on success, else nil. Raise an error if the cache +does not exist." (unless org-publish-cache (error "`org-publish-cache-set' called, but no cache present")) (puthash key value org-publish-cache)) -- cgit v1.2.3