emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Gustav Wikström" <gustav@whil.se>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Cc: "sgeorgii ." <sgeorgii@gmail.com>,
	"mail@nicolasgoaziou.fr" <mail@nicolasgoaziou.fr>
Subject: Re: [RFC] [PATCH] Changes to Tag groups - allow nesting and regexps
Date: Wed, 25 Nov 2015 12:20:30 +0000	[thread overview]
Message-ID: <DB5PR02MB1191F810893AAA9F557A7644DA050@DB5PR02MB1191.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <CA+2xvWn5oQaYABacojYDvoD+1DhbpELXyCSSMrUCnKMvexTM=w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3721 bytes --]

Hi again,

Patch attached. 

If someone could apply it I'd be glad.

Best Regards
Gustav

> -----Original Message-----
> From: sgeorgii . [mailto:sgeorgii@gmail.com]
> Sent: Wednesday, November 25, 2015 12:05
> To: Gustav Wikström <gustav@whil.se>
> Cc: mail@nicolasgoaziou.fr; emacs-orgmode@gnu.org
> Subject: Re: [O] [RFC] [PATCH] Changes to Tag groups - allow nesting and
> regexps
> 
> Indeed, the {.*} works. Thank you!
> 
> If we could still use the empty parameter when filtering by "no tags"
> it would be really sweet :)
> 
> On 25 November 2015 at 13:26, Gustav Wikström <gustav@whil.se> wrote:
> > Hi!
> >
> > Indeed, I do get the same error as you. I'll look into it a bit. Not sure if the
> behavior is documented though.
> >
> > As a workaround for you sgeorgii (and for everyone else with this problem I
> suppose :-) ), you can exclude tags instead of filtering. The behavior is similar
> except instead of only showing the rows with the provided tag, it excludes all
> rows with the provided tag. If you provide a regular expression, eg. {.*}, then all
> rows with tags are hidden from the agenda-view.
> >
> > So, to recreate with commands, what I just tried to describe with words:
> > M-x org-agenda
> > \ (exclude) (alternatively use the combination of / (filter) -
> > (exclude) ) <TAB> (exclude by tag) {.*} <ENTER>
> >
> > Voila!
> >
> > Best regards
> > Gustav
> >
> >> -----Original Message-----
> >> From: sgeorgii . [mailto:sgeorgii@gmail.com]
> >> Sent: Wednesday, November 25, 2015 08:51
> >> To: gustav.erik@gmail.com; mail@nicolasgoaziou.fr; emacs-
> >> orgmode@gnu.org
> >> Subject: [O] [RFC] [PATCH] Changes to Tag groups - allow nesting and
> >> regexps
> >>
> >> Dear Gustav, Eric,
> >>
> >>
> >> I was referred to your subject discussion in respect to my problem:
> >>
> >> With new version of org-mode I am now unable to filter agenda to show
> >> only non-tagged items:
> >>
> >>
> >> > "sgeorgii ." <sgeorgii@gmail.com> writes:
> >> >
> >> >> Hello!
> >> >>
> >> >> Having installed latest org 8.3.2 I am now having the subject problem:
> >> >>
> >> >> M-x org-agenda
> >> >>
> >> >> When in agenda:
> >> >>
> >> >> / (filter)
> >> >>
> >> >> TAB (filter by tag)
> >> >>
> >> >> <Enter> (without entering any tags for "Tag:" question)
> >> >>
> >> >> Before this gave me agenda view filtered to show only non-tagged items.
> >> >> I believe this was right and just fine.
> >> >>
> >> >> Now I have error:
> >> >>
> >> >> Debugger entered--Lisp error: (args-out-of-range "" 0 1)
> >> >>   org-agenda-filter-make-matcher-tag-exp(("+") 43)
> >> >>   org-agenda-filter-make-matcher(("+") tag t)
> >> >>   org-agenda-filter-apply(("+") tag t)
> >> >>   org-agenda-filter-by-tag(nil)
> >> >>   call-interactively(org-agenda-filter-by-tag nil nil)
> >> >>   command-execute(org-agenda-filter-by-tag)
> >>
> >> >
> >> > I believe 6c6ae99 (org-agenda: Filtering in the agenda on
> >> > grouptags,
> >> > 2015-01-24) changed this behavior.  The discussion about these
> >> > changes is here (sorry, the gmane web interface is down for me):
> >> > https://lists.gnu.org/archive/html/emacs-orgmode/2015-01/msg00618.h
> >> > tml
> >> >
> >> > org-agenda-filter-by-tag should be fixed to handle the empty tag
> >> > case that causes the error above, either by behaving as before or
> >> > by giving a clear error.  I haven't looked closely enough at the
> >> > changes or the discussion to guess whether that commit intended to
> >> > preserve the empty tag behavior you were relying on.  Is that behavior
> documented anywhere?
> >> >
> >> > --
> >> > Kyle
> >>
> >>
> >> Any help?

[-- Attachment #2: 0001-org-agenda-Filter-empty-tags.patch --]
[-- Type: application/octet-stream, Size: 1246 bytes --]

From 445995e1fad646b2b22c014e09e3e05a7aeeede1 Mon Sep 17 00:00:00 2001
From: Gustav Wikstrom <gustav.erik@gmail.com>
Date: Wed, 25 Nov 2015 13:06:31 +0100
Subject: [PATCH] org-agenda: Filter empty tags

* lisp/org-agenda.el (org-agenda-filter-make-matcher-tag-exp): Deal with
  the case when the user provided an empty string to filter or exclude
  rows from the agenda.
---
 lisp/org-agenda.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 27ca20c..9a6cf10 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7636,13 +7636,17 @@ switches in the returned form."
   (let (f f1) ;f = return expression. f1 = working-area
     (dolist (x tags)
       (let* ((tag (substring x 1))
-	     (isregexp (and (equal "{" (substring tag 0 1))
+	     (isemptystring (string= "" tag))
+	     (isregexp (and (not isemptystring)
+			    (equal "{" (substring tag 0 1))
 			    (equal "}" (substring tag -1))))
 	     regexp)
 	(cond
 	 (isregexp
 	  (setq regexp (substring tag 1 -1))
 	  (setq f1 (list 'org-match-any-p regexp 'tags)))
+	 (isemptystring
+	  (setq f1 '(not tags)))
 	 (t
 	  (setq f1 (list 'member (downcase tag) 'tags))))
 	(when (eq op ?-)
-- 
1.9.5.msysgit.1


  reply	other threads:[~2015-11-25 12:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25  7:50 [RFC] [PATCH] Changes to Tag groups - allow nesting and regexps sgeorgii .
2015-11-25 10:26 ` Gustav Wikström
2015-11-25 11:05   ` sgeorgii .
2015-11-25 12:20     ` Gustav Wikström [this message]
2015-11-25 12:58       ` Nicolas Goaziou
2015-11-25 14:44         ` Gustav Wikström
2015-11-25 14:52           ` Nicolas Goaziou
2015-11-25 15:39             ` Gustav Wikström
2015-11-26  7:30               ` sgeorgii .
2015-11-26  8:21               ` Nicolas Goaziou
2015-11-26 10:01                 ` Gustav Wikström
2015-11-26 10:21                   ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2015-01-25 11:07 Gustav Wikström
2015-01-31  8:41 ` Nicolas Goaziou
2015-02-19 20:00   ` Gustav Wikström
2015-02-24 16:43     ` Nicolas Goaziou
2015-03-05  1:08       ` Gustav Wikström
2015-03-07 21:51         ` Nicolas Goaziou
2015-03-15 10:17           ` Gustav Wikström
2015-03-16 20:38           ` Gustav Wikström
2015-03-16 21:30             ` Nicolas Goaziou
2015-03-19 21:07               ` Gustav Wikström
2015-03-19 22:43                 ` Nicolas Goaziou

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=DB5PR02MB1191F810893AAA9F557A7644DA050@DB5PR02MB1191.eurprd02.prod.outlook.com \
    --to=gustav@whil.se \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=sgeorgii@gmail.com \
    /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).