emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: "Jorge P. de Morais Neto" <jorge+list@disroot.org>
Cc: Bastien <bzg@gnu.org>, emacs-orgmode@gnu.org
Subject: Re: Bug: org-agenda-tag-filter-preset not respected [9.3.6 (9.3.6-19-gf360f9-elpaplus @ /home/jorge/.config/emacs/elpa/27.0/develop/org-plus-contrib-20200302/)]
Date: Tue, 07 Apr 2020 03:33:33 +0000	[thread overview]
Message-ID: <87369g0y2a.fsf@kyleam.com> (raw)
In-Reply-To: <87r1x0a8mc.fsf@nicolasgoaziou.fr>

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Unfortunately, no one volunteered to fix the issue so far. You may want
> to have a look at it, you will certainly get help doing so. Otherwise,
> you are welcome to bump the report from time to time.

This bisects to 7e52b7661 (org-agenda: Fix logic of
`org-agenda-filter-make-matcher', 2020-02-19).  Jorge, I tested the
patch below against the test case you provided, though of course
confirmation that it resolves the issue on your end would be
appreciated.

I'll apply it tomorrow unless there are objections.

-- >8 --
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.
---

  * I'm tempted to drop the multi-pos-cats binding and move the
    expression in line.  I may do that before applying.

  * I'm not really sure what the behavior should be when there are
    multiple "+"s and at least one "-".  I doubt that there's much
    sensible to do here, or that it matters one way or the other.

 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 d89a3da7c..ffb892b0c 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7948,8 +7948,10 @@ (defun org-agenda-filter-make-matcher (filter type &optional expand)
 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
-- 
2.26.0



  reply	other threads:[~2020-04-07  3:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 12:06 Bug: org-agenda-tag-filter-preset not respected [9.3.6 (9.3.6-19-gf360f9-elpaplus @ /home/jorge/.config/emacs/elpa/27.0/develop/org-plus-contrib-20200302/)] Jorge P. de Morais Neto
2020-03-09 23:36 ` Jorge P. de Morais Neto
2020-04-06 13:53   ` Jorge P. de Morais Neto
2020-04-06 16:20     ` Nicolas Goaziou
2020-04-07  3:33       ` Kyle Meyer [this message]
2020-04-08  3:00         ` Kyle Meyer
2020-04-08 12:36         ` Jorge P. de Morais Neto
2020-05-23 15:55         ` Bastien
2020-04-08 12:41       ` Jorge P. de Morais Neto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87369g0y2a.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=jorge+list@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).