emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Carsten Dominik <dominik@uva.nl>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>,
	Bernt Hansen <bernt@norang.ca>
Subject: Re: Re: Switching between many contexts
Date: Wed, 4 Mar 2009 07:17:36 +0100	[thread overview]
Message-ID: <5427E7F4-7AAD-4B82-B2E7-4FF7D1D0C1EB@uva.nl> (raw)
In-Reply-To: <CE3E11C1-D2C2-4E63-BE9A-853C4200C5C0@uva.nl>


On Mar 3, 2009, at 2:31 PM, Carsten Dominik wrote:

>
> On Mar 3, 2009, at 2:05 PM, Matthew Lundin wrote:
>
>>
>> Daniel Clemente <n142857@gmail.com> writes:
>>
>>> In fact I would like to use often the agenda view with several  
>>> tags excluded, so the ideal setup would be an agenda custom search.
>>> But I don't know which command to use in org-agenda-custom- 
>>> commands: I don't want tags-todo (that's a heading list), but the  
>>> real agenda (with its colors, dates, deadlines, etc.). However,  
>>> the search type called „agenda“ seems not to accept tags to search.
>>> Maybe „agenda“ could accept tags to search?
>>> Or else I can try to do a custom command which emulates the agenda
>>> but adds this filter; maybe with a local variable or with „skip
>>> conditions“ (org-agenda-skip-function).
>>
>> For this you would indeed you a skip function.
>>
>> E.g.,
>>
>> --8<---------------cut here---------------start------------->8---
>> (setq org-agenda-custom-commands
>>     '(("A" agenda ""
>> 	 ((org-agenda-skip-function '(org-agenda-skip-entry-if 'regexp  
>> ":TAG:"))))))
>> --8<---------------cut here---------------end--------------->8---
>
> This is very good, and it will work if you are talking about
> entries that all do have that tag explicitly.  But will fail
> if you have subtrees that inherit the tag:  If the agenda
> scanner stops at a time stamp that is in an entry that inherits
> the tag, then the skipper will not see the tag.
>
> The reason why the agenda view does not have an option to
> exclude some tags is also because of inheritance.  The tags
> scanner that is used by `C-c a m' is designed to treat tag
> inheritance fast, but the agenda directly jumps to relevant
> time stamps and then must work its way up the hierarchy, for
> each matching time stamp, to get all relevant tags.
>
> A work-around with some speed penalty will therefore be
>
> ((org-agenda-skip-function '(member "TAG" (org-get-tags-at)))
>
> Another possibility that might be useful would be to
> use permanent restrictions.
>
> For example, you can go to a subtree that you want to work with
> and press `C-c C-x <'  on the headline.  All future agenda
> commands then will only look at that subtree, until you
> select a new restriction or until you remove the restriction with
> `C-c C-x >'.  You may also restrict to a file by calling `C-c C-x <'
> before the first headline of a file.
>
> Maybe the best solutions would be if I allowed for a default
> secondary filter to be applied to an agenda view....  I will look
> into this possibility.

You can now, in a custom agenda command, bind the variable
org-agenda-filter-preset to a list of filter specifications.
This filter will then be applied when the agenda view is first shown,
and also after each refresh.  Secondary filtering with "/" will
always add to this preset.  In order to get rid of the preset, you
need to run a new agenda command.

For example

    ("A" "" agenda ""
     ((org-agenda-filter-preset '("-FLUFF" "-BLUFF"))))

will hide tags FLUFF and BLUFF.

An interesting possibility opens by realizing that the setting
of options for agenda commands is evaluated.  This is something
I had forgotten, but Matt reminded me with his tutorial that this
is a possibility.  So you could have a command

    ("A" "" agenda ""
     ((org-agenda-filter-preset my-filter-preset))))

and then only change that variable with your home-made code
to switch the scope of this single agenda command.

- Carsten

  parent reply	other threads:[~2009-03-04  6:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-02 18:03 Switching between many contexts Daniel Clemente
2009-03-02 18:21 ` Samuel Wales
2009-03-02 18:34   ` Bernt Hansen
2009-03-03 11:27     ` Daniel Clemente
2009-03-03 13:05       ` Matthew Lundin
2009-03-03 13:31         ` Carsten Dominik
2009-03-03  6:20           ` Manuel Hermenegildo
2009-03-04  6:17           ` Carsten Dominik [this message]
2009-03-04 10:01             ` Daniel Clemente
2009-03-05 18:41           ` Auto-saving/loading files (without prompts) David Thole
2009-03-06 15:21             ` Jason F. McBrayer
2009-03-02 18:31 ` Switching between many contexts Bernt Hansen
2009-03-02 21:47 ` Matthew Lundin

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=5427E7F4-7AAD-4B82-B2E7-4FF7D1D0C1EB@uva.nl \
    --to=dominik@science.uva.nl \
    --cc=bernt@norang.ca \
    --cc=dominik@uva.nl \
    --cc=emacs-orgmode@gnu.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).