emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Martin Pohlack <mp26@os.inf.tu-dresden.de>
To: Matt Lundin <mdl@imapmail.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: skip entry with inherited tags
Date: Thu, 03 Jun 2010 23:44:05 +0200	[thread overview]
Message-ID: <4C082225.6020007@os.inf.tu-dresden.de> (raw)
In-Reply-To: <87mxvxdsv7.fsf@fastmail.fm>

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

Hi All,

I finally found some hours to walk through the code.

On 18.05.2010 19:25, Matt Lundin wrote:
> Martin Pohlack <mp26@os.inf.tu-dresden.de> writes:
> 
>> Hi,
>>
>> On 18.05.2010 09:42, Matthias Teege wrote:
>>> Moin,
>>>
>>> I'm using a simple skip-function to exclude todos from a list.
>>>
>>> (defun my-skip-someday-and-scheduled ()
>>>    ""
>>>       (org-agenda-skip-entry-if 'scheduled 'regexp ":SOMEDAY:"))
>>>
>>> That works when the tag was assigned to an entry but not when it was
>>> inherited from a parent. How do I get all tags for an entry?
>>
>> I have been using the same approach with the same limitations.  I
>> stumbled upon the "tags filter preset", which supposedly should filter
>> out headlines with a specific tag set.
>>
>> I tried to set it to "-maybe" but it did not seem to have an effect
>> with the default "Agenda" type.  Is this supposed to work?
> 
> Did you set the variable as a list? 
> 
> --8<---------------cut here---------------start------------->8---
> (setq org-agenda-custom-commands
>       '(("x" "No maybe" todo ""
> 	 ((org-agenda-filter-preset '("-maybe"))))))
> --8<---------------cut here---------------end--------------->8---
> 
> BTW, I believe one solution to the original question is:
> 
> --8<---------------cut here---------------start------------->8---
> (setq org-agenda-custom-commands
>       '(("x" "No scheduled or someday" todo ""
> 	 ((org-agenda-todo-ignore-scheduled t)
> 	  (org-agenda-filter-preset '("-SOMEDAY"))))))
> --8<---------------cut here---------------end--------------->8---

Thanks for your suggestion Matt.

I now think the problem is that I have a multi-agenda.

org-finalize-agenda is called for each subagenda here but the branch
where org-agenda-filter-apply would be called is never taken as it is
scoped with "unless org-agenda-multi".  I have also found no other
non-interactive trigger for org-agenda-filter-apply.

I see two possible solutions here:
* Run org-agenda-filter-apply on a narrowed agenda buffer (only for
  the sub-agenda).  In fact, the agenda buffer seems to be narrowed
  down at this point already.  This would be the perfect solution as
  each sub-agenda could install its own org-agenda-filter-preset.

  Find attached a patch which achieves this.  It seems to work well for
  my short tests.

* Run org-agenda-filter-apply once for the whole buffer with a global
  org-agenda-filter-preset.  This would be mostly ok for some use cases
  (I only want to globally remove all "maybe" entries, including the
  inherited ones).

Cheers,
Martin

[-- Attachment #2: org-agenda-filter-apply_multi.diff --]
[-- Type: text/plain, Size: 542 bytes --]

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 19ea87c..033c981 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2760,7 +2760,9 @@ bind it in the options section.")
 
 (defun org-finalize-agenda ()
   "Finishing touch for the agenda buffer, called just before displaying it."
-  (unless org-agenda-multi
+  (if org-agenda-multi
+      (when (get 'org-agenda-filter :preset-filter)
+        (org-agenda-filter-apply org-agenda-filter))
     (save-excursion
       (let ((inhibit-read-only t))
 	(goto-char (point-min))

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-06-03 21:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18  7:42 skip entry with inherited tags Matthias Teege
2010-05-18 11:18 ` Martin Pohlack
2010-05-18 17:25   ` Matt Lundin
2010-06-03 21:44     ` Martin Pohlack [this message]
2010-06-04 11:27       ` Carsten Dominik
2010-06-04 12:11         ` Martin Pohlack
2010-07-07  8:49           ` Martin Pohlack
2010-07-13 11:49             ` Carsten Dominik
2010-07-13 17:41               ` Martin Pohlack
2010-07-13 18:48                 ` Carsten Dominik
2010-07-13 20:34                   ` Martin Pohlack
2010-07-21 14:32                     ` Carsten Dominik
2010-07-22  7:38                       ` Carsten Dominik
2010-08-04 21:38                         ` Martin Pohlack
2010-08-16 12:50                           ` Carsten Dominik
2010-08-16 12:56                             ` Martin Pohlack
2010-08-16 13:10                               ` Carsten Dominik

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=4C082225.6020007@os.inf.tu-dresden.de \
    --to=mp26@os.inf.tu-dresden.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=mdl@imapmail.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).