Browse Source

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 <jorge+list@disroot.org>
<87v9nhit6c.fsf@disroot.org>
Kyle Meyer 5 years ago
parent
commit
561e9efd06
1 changed files with 4 additions and 2 deletions
  1. 4 2
      lisp/org-agenda.el

+ 4 - 2
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