summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-09-07 15:52:56 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-09-07 15:53:49 +0200
commit22e916fb369629606d919a0e4f33ec2954c87e04 (patch)
treeadae42606b6bf1fe403010a0c6408a2118f3af5e
parent706932bec3b59a47ff2736dc9b8f34d13738352a (diff)
downloadorg-mode-22e916fb369629606d919a0e4f33ec2954c87e04.tar.gz
org-agenda: Remove duplicate files when building a search view
* lisp/org-agenda.el (org-search-view): Remove duplicate files when building a search view. Reported-by: Samuel Wales <samologist@gmail.com> <http://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00112.html>
-rw-r--r--lisp/org-agenda.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 42c599a..76bfa90 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4486,7 +4486,14 @@ is active."
(when (eq (car org-agenda-text-search-extra-files) 'agenda-archives)
(pop org-agenda-text-search-extra-files)
(setq files (org-add-archive-files files))))
- (setq files (append files org-agenda-text-search-extra-files)
+ ;; Uniquify files. However, let `org-check-agenda-file' handle
+ ;; non-existent ones.
+ (setq files (cl-remove-duplicates
+ (append files org-agenda-text-search-extra-files)
+ (lambda (a b)
+ (and (file-exists-p a)
+ (file-exists-p b)
+ (file-equal-p a b))))
rtnall nil)
(while (setq file (pop files))
(setq ee nil)
@@ -4541,12 +4548,12 @@ is active."
(point-at-bol)
(if hdl-only (point-at-eol) end)))
(mapc (lambda (wr) (when (string-match wr str)
- (goto-char (1- end))
- (throw :skip t)))
+ (goto-char (1- end))
+ (throw :skip t)))
regexps-)
(mapc (lambda (wr) (unless (string-match wr str)
- (goto-char (1- end))
- (throw :skip t)))
+ (goto-char (1- end))
+ (throw :skip t)))
(if todo-only
(cons (concat "^\\*+[ \t]+"
org-not-done-regexp)