From 22e916fb369629606d919a0e4f33ec2954c87e04 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 7 Sep 2017 15:52:56 +0200 Subject: [PATCH] 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 --- lisp/org-agenda.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 42c599a03..76bfa90d1 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) -- 2.11.4.GIT