summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-11-02 09:28:24 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-11-02 09:28:24 +0100
commitc61ee8b82af52f09792a554029addcb48c5b2c5b (patch)
treefabb0ac852cd98115edb3ea7fdbb490513ce7f71
parent1dc78402dcc2910bd0d53f76d96470035c34616e (diff)
downloadorg-mode-c61ee8b82af52f09792a554029addcb48c5b2c5b.tar.gz
ox-publish: Fix unwanted buffer pop-uprelease_9.0
* lisp/ox-publish.el (org-publish-cache-file-needs-publishing): Use `find-file-noselect' instead of `find-file'.
-rw-r--r--lisp/ox-publish.el52
1 files changed, 27 insertions, 25 deletions
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index c8edc2c..102f460 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -1204,32 +1204,34 @@ the file including them will be republished as well."
(pstamp (org-publish-cache-get key))
(org-inhibit-startup t)
(visiting (find-buffer-visiting filename))
- included-files-ctime buf)
+ (buf (find-file-noselect (expand-file-name filename)))
+ included-files-ctime)
(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 "^[ \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)))
+ (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)