From 561e9efd062e23321f3b56b2e3482ef3afc7416f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 6 Apr 2020 23:07:51 -0400 Subject: [PATCH] agenda: Fix regression in handling of non-caterory filters * lisp/org-agenda.el (org-agenda-filter-make-matcher): Combine filter forms with `and' unless multiple positive categories are given. 06cf532f4 (org-agenda.el: Fix bug when using category filters, 2020-01-20) modified org-agenda-filter-make-matcher to group the form with `or' rather than `and' for category filters. This logic was tweaked again in a follow-up commit, 7e52b7661 (org-agenda: Fix logic of `org-agenda-filter-make-matcher', 2020-02-19), which was supposed to restrict the use of `or' to _multiple_ positive categories. However, the follow-up commit incorrectly affected all filter types. Avoid the check for non-category types. Also, fix the regexp so that it matches whenever there are multiple positive categories, not just a single one. Reported-by: Jorge P. de Morais Neto <87v9nhit6c.fsf@disroot.org> --- lisp/org-agenda.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index a8fc36ffd..03a3a0027 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7928,8 +7928,10 @@ These will be lower-case, for filtering." argument EXPAND can be used for the TYPE tag and will expand the tags in the FILTER if any of the tags in FILTER are grouptags." (let ((multi-pos-cats - (string-match-p "\++" - (mapconcat (lambda (cat) (substring cat 0 1)) filter ""))) + (and (eq type 'category) + (string-match-p "\\+.*\\+" + (mapconcat (lambda (cat) (substring cat 0 1)) + filter "")))) f f1) (cond ;; Tag filter