From mboxrd@z Thu Jan  1 00:00:00 1970
From: Kaushal Modi <kaushal.modi@gmail.com>
Subject: Re: Agenda filter by any tag seems to be broken
Date: Tue, 17 May 2016 19:40:14 +0000
Message-ID: <CAFyQvY2N3nVk6Ab=mgJ9R=Ttdy2iM3osgHznL3nRkg17Qf0b6w@mail.gmail.com>
References: <87oa8a7hxp.fsf@ericabrahamsen.net>
	<CAFyQvY1ke7GhV4QLt-AvW53LnSji44+F-iQ+NvYWH8iTxcn6YQ@mail.gmail.com>
	<8760udh644.fsf@ericabrahamsen.net>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a113731409a6ae605330ee969
Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55028)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kaushal.modi@gmail.com>) id 1b2qTi-0000g1-Ew
	for emacs-orgmode@gnu.org; Tue, 17 May 2016 21:40:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <kaushal.modi@gmail.com>) id 1b2kqw-0001d7-7K
	for emacs-orgmode@gnu.org; Tue, 17 May 2016 15:40:27 -0400
Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:35317)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kaushal.modi@gmail.com>) id 1b2kqw-0001d3-0T
	for emacs-orgmode@gnu.org; Tue, 17 May 2016 15:40:26 -0400
Received: by mail-oi0-x22a.google.com with SMTP id x19so42207372oix.2
	for <emacs-orgmode@gnu.org>; Tue, 17 May 2016 12:40:25 -0700 (PDT)
In-Reply-To: <8760udh644.fsf@ericabrahamsen.net>
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-orgmode/>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
	<mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org
Sender: "Emacs-orgmode"
	<emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org>
To: Eric Abrahamsen <eric@ericabrahamsen.net>, emacs-orgmode@gnu.org

--001a113731409a6ae605330ee969
Content-Type: text/plain; charset=UTF-8

On Mon, May 16, 2016 at 8:38 PM Eric Abrahamsen <eric@ericabrahamsen.net>
wrote:

> Starting with emacs -Q, then adding the org-plus-contrib directory to
> load-path:
>

Are you installing both the git master version and org-plus-contrib? I do
not have org-plus-contrib in my load-path. The only org I have in the
load-path is the git master version. If you *are* installing both versions,
then that could probably explain the issue you are facing.


> M-x org-agenda
> t ;; all todos, an empty list of course
> /
> SPC
>
> And I get the error.
>

I tried that. But I don't get any error.

I took the original org-agenda-filter-make-matcher-tag-exp function from
the git master and added few debug statements as below:

(defun org-agenda-filter-make-matcher-tag-exp (tags op)
  "Return a form associated to tag-expression TAGS.
Build a form testing a line for agenda filter for
tag-expressions.  OP is an operator of type CHAR that allows the
function to set the right switches in the returned form."
  (message "arg tags: %S" tags)
  (message "arg op: %S" op)
  (let (form ret)
    ;; Any of the expressions can match if OP is +, all must match if
    ;; the operator is -.
    (dolist (x tags (cons (if (eq op ?-) 'and 'or) form))
      (let* ((tag (substring x 1))
             (f (cond
((string= "" tag) '(not tags))
((and (string-match-p "\\`{" tag) (string-match-p "}\\'" tag))
 ;; TAG is a regexp.
 (list 'org-match-any-p (substring tag 1 -1) 'tags))
(t (list 'member (downcase tag) 'tags)))))
        (message "in let, tag: %S" tag)
        (message "in let, f: %S" f)
(prog1
            (setq ret (push (if (eq op ?-) (list 'not f) f) form))
          (message "ret val: %S" ret))))))

Then when I do M-x org-agenda t / SPC, I get:

arg tags: ("+")
arg op: 43
in let, tag: ""
in let, f: (not tags)
ret val: ((not tags))

-- 

-- 
Kaushal Modi

--001a113731409a6ae605330ee969
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, Ma=
y 16, 2016 at 8:38 PM Eric Abrahamsen &lt;<a href=3D"mailto:eric@ericabraha=
msen.net">eric@ericabrahamsen.net</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">Starting with emacs -Q, then adding the org-plus-contrib dire=
ctory to<br>
load-path:<br></blockquote><div><br></div><div>Are you installing both the =
git master version and org-plus-contrib? I do not have org-plus-contrib in =
my load-path. The only org I have in the load-path is the git master versio=
n. If you *are* installing both versions, then that could probably explain =
the issue you are facing.</div><div>=C2=A0</div><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex">
M-x org-agenda<br>
t ;; all todos, an empty list of course<br>
/<br>
SPC<br>
<br>
And I get the error.<br></blockquote><div><br></div><div>I tried that. But =
I don&#39;t get any error.</div><div><br></div><div>I took the original org=
-agenda-filter-make-matcher-tag-exp function from the git master and added =
few debug statements as below:</div><div><br></div><div><div>(defun org-age=
nda-filter-make-matcher-tag-exp (tags op)</div><div>=C2=A0 &quot;Return a f=
orm associated to tag-expression TAGS.</div><div>Build a form testing a lin=
e for agenda filter for</div><div>tag-expressions.=C2=A0 OP is an operator =
of type CHAR that allows the</div><div>function to set the right switches i=
n the returned form.&quot;</div><div>=C2=A0 (message &quot;arg tags: %S&quo=
t; tags)</div><div>=C2=A0 (message &quot;arg op: %S&quot; op)</div><div>=C2=
=A0 (let (form ret)</div><div>=C2=A0 =C2=A0 ;; Any of the expressions can m=
atch if OP is +, all must match if</div><div>=C2=A0 =C2=A0 ;; the operator =
is -.</div><div>=C2=A0 =C2=A0 (dolist (x tags (cons (if (eq op ?-) &#39;and=
 &#39;or) form))=C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0 (let* ((tag (substrin=
g x 1))</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(f (cond<=
/div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre">		</span=
> ((string=3D &quot;&quot; tag) &#39;(not tags))</div><div><span class=3D"A=
pple-tab-span" style=3D"white-space:pre">		</span> ((and (string-match-p &q=
uot;\\`{&quot; tag) (string-match-p &quot;}\\&#39;&quot; tag))</div><div><s=
pan class=3D"Apple-tab-span" style=3D"white-space:pre">		</span> =C2=A0;; T=
AG is a regexp.</div><div><span class=3D"Apple-tab-span" style=3D"white-spa=
ce:pre">		</span> =C2=A0(list &#39;org-match-any-p (substring tag 1 -1) &#3=
9;tags))</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"=
>		</span> (t (list &#39;member (downcase tag) &#39;tags)))))</div><div>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 (message &quot;in let, tag: %S&quot; tag)</div><di=
v>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (message &quot;in let, f: %S&quot; f)</div><d=
iv><span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>(prog1<=
/div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq ret (push (if (eq=
 op ?-) (list &#39;not f) f) form))</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 (message &quot;ret val: %S&quot; ret))))))</div></div><div><br></div=
><div>Then when I do M-x org-agenda t / SPC, I get:</div><div><br></div><di=
v><div>arg tags: (&quot;+&quot;)</div><div>arg op: 43</div><div>in let, tag=
: &quot;&quot;</div><div>in let, f: (not tags)</div><div>ret val: ((not tag=
s))</div></div><div><br></div></div></div><div dir=3D"ltr">-- <br></div><di=
v><p dir=3D"ltr">-- <br>
Kaushal Modi</p>
</div>

--001a113731409a6ae605330ee969--