summaryrefslogtreecommitdiff
path: root/lisp/ox-publish.el
diff options
context:
space:
mode:
authorS├ębastien Delafond <sdelafond@gmail.com>2016-12-18 18:15:46 +0100
committerS├ębastien Delafond <sdelafond@gmail.com>2016-12-18 18:33:07 +0100
commitc5d8495eb3e0cd02bce787b2126207057edb3e61 (patch)
treeb722ae24e016d6fed6a667b18db2cbbf15e062ce /lisp/ox-publish.el
parent2cc0aeaf303018977e09a4cf565bb76fbfdf7817 (diff)
Imported Upstream version 9.0.2
Diffstat (limited to 'lisp/ox-publish.el')
-rw-r--r--lisp/ox-publish.el70
1 files changed, 35 insertions, 35 deletions
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))