summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-11-01 22:43:43 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-11-01 22:43:43 +0100
commit85a675b939b469984fa701b42fa11eae262ec732 (patch)
treeb5b6db692c9d4bcf56046b20e31d568c6bc744b5
parent42eebb37555a3c4d3eabee29382c5d19ea9aa06f (diff)
downloadorg-mode-85a675b939b469984fa701b42fa11eae262ec732.tar.gz
org-archive: Fix `org-all-archive-files'
* lisp/org-archive.el (org-all-archive-files): Fix comparison function. Reported-by: Nils Gustafsson <nils.gustafsson@bredband2.com> <http://lists.gnu.org/r/emacs-orgmode/2018-10/msg00395.html>
-rw-r--r--lisp/org-archive.el26
1 files changed, 12 insertions, 14 deletions
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index 3214d09..8fc60c5 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -160,20 +160,18 @@ archive file is."
(defun org-all-archive-files ()
"Get a list of all archive files used in the current buffer."
- (let ((case-fold-search t)
- files)
- (org-with-wide-buffer
- (goto-char (point-min))
- (while (re-search-forward
- "^[ \t]*\\(#\\+\\|:\\)ARCHIVE:[ \t]+\\(.*\\)"
- nil t)
- (when (save-match-data
- (if (eq (match-string 1) ":") (org-at-property-p)
- (eq (org-element-type (org-element-at-point)) 'keyword)))
- (let ((file (org-extract-archive-file
- (match-string-no-properties 2))))
- (when (and (org-string-nw-p file) (file-exists-p file))
- (push file files))))))
+ (let (files)
+ (org-with-point-at 1
+ (let ((regexp "^[ \t]*\\(#\\+\\|:\\)ARCHIVE:[ \t]+\\(.*\\)")
+ (case-fold-search t))
+ (while (re-search-forward regexp nil t)
+ (when (save-match-data
+ (if (equal ":" (match-string 1)) (org-at-property-p)
+ (eq 'keyword (org-element-type (org-element-at-point)))))
+ (let ((file (org-extract-archive-file
+ (match-string-no-properties 2))))
+ (when (and (org-string-nw-p file) (file-exists-p file))
+ (push file files)))))))
(setq files (nreverse files))
(let ((file (org-extract-archive-file)))
(when (and (org-string-nw-p file) (file-exists-p file))