emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exclude tag from custom agenda
@ 2012-12-07 17:24 Karl Voit
  2012-12-07 20:56 ` Custom Agenda (was: Exclude tag from custom agenda) Karl Voit
  2012-12-09 15:59 ` Exclude tag from custom agenda Memnon Anon
  0 siblings, 2 replies; 6+ messages in thread
From: Karl Voit @ 2012-12-07 17:24 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I very much like the agenda customization from [1] and I would like
to adopt it for my needs.

What I want to achieve: on top, there should be my normal agenda
(events, tasks, habits, ...) but minus elements tagged with
"reward".

Below, there should be a "section" with all reward-tasks (excluded
are future ones) and so forth.

,----
| (setq org-agenda-custom-commands
|       (quote (
|           ;; http://doc.norang.ca/org-mode.html#CustomAgendaViews
|               ("o" "overview Agenda"
|                ((agenda "" nil)
|                 (tags-todo "+reward"
|                 (org-agenda-overriding-header "Rewards")
|                )
|                 (tags-todo "-CANCELLED/!"
|                            ((org-agenda-overriding-header "Stuck Projects")
|                             (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
|                 (tags-todo "-CANCELLED+WAITING/!"
|                            ((org-agenda-overriding-header "Waiting and Postponed Tasks")
|                             (org-agenda-skip-function 'bh/skip-stuck-projects)
|                             (org-tags-match-list-sublevels nil)
|                             (org-agenda-todo-ignore-scheduled 'future)
|                             (org-agenda-todo-ignore-deadlines 'future)
|                 ))
|         )
|                nil)
|
| )))
`----

Above snippet works but shows my usual agenda including items tagged
with "reward".

I think, that «(agenda "" nil)» has to be modified but I don't know
how.

Can you help me?

  1. http://doc.norang.ca/org-mode.html#CustomAgendaViews
-- 
Karl Voit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Custom Agenda  (was: Exclude tag from custom agenda)
  2012-12-07 17:24 Exclude tag from custom agenda Karl Voit
@ 2012-12-07 20:56 ` Karl Voit
  2012-12-09 15:59 ` Exclude tag from custom agenda Memnon Anon
  1 sibling, 0 replies; 6+ messages in thread
From: Karl Voit @ 2012-12-07 20:56 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

Playing around with Agenda today, I developed a perspective what I
want to achieve. Unfortunately, I am not able to come up with a
working configuration :-(

I'd like to have an agenda like that:

,----[ What I want to achieve ]
| Friday      7 December 2012
|                8:00...... ----------------
|               10:00...... ----------------
|   misc:       12:00-13:00 this event                              :@home:
|               12:00...... ----------------
|   phd:        13:45-19:00 that event                            :@office:
|               20:00...... ----------------
|               20:19...... now - - - - - - - - - - -
|   IST:        (2/2):  <2012-12-06 Thu>-<2012-12-07 Fri> foobar
|   tagstore:   In  -3 d.:  STARTED a started thing which is overdue :tag3:
|   misc:       In  -1 d.:  NEXT another overdue task
|   misc:       Deadline:   NEXT a task                              :tag1:
|   misc:       Deadline:   NEXT another task                        :tag2:
|   phd:        In   4 d.:  NEXT some pre-warning task
|   misc:       TODO an habit task       IIOIIIIIOOO!!!__
| Extra tasks
|   misc:       In  -1 d.:  NEXT overdue reward task           :tag1:extra:
|   misc:       Deadline:   NEXT another extra task          :foobar:extra:
|   phd:        In   4 d.:  NEXT extra-task with pre-warning        :extra:
| DONE today
|   tagstore:   DONE glad I did this                                 :tag1:
|   misc:       DONE this other task I finished                     :extra:
|   misc:       DONE this task was hard to do as well          :extra:tag2:
| Waiting or Postponed
|   <as shown on [1]>
| Stuck Projects
|   <as shown on [1]>
`----

I guess, I need to look at following things:

- [ ] org-agenda-custom-commands (see below)
  - I got the agenda, but not with filtered out :extra: tags,
    :extra: section below, and the «DONE today» section
  - Bonus: «DONE today» matches the current agenda-day being 
    displayed (and not only the current day)

- [?] (setq org-agenda-skip-deadline-if-done t)
  - I am not sure, whether or not this is a contradiction to my
    desire to list them only in the «DONE today» section above

- [X] org-agenda-sorting-strategy (see below) and [2]
  - I could manage to get the overdue events (like «STARTED a started
    thing...») on the top of the list yet by using a modified version
    of «bh/agenda-sort» from [2]
  - So this thing is solved for me


,----[ current snippet of org-agenda-custom-commands ]
| (setq org-agenda-custom-commands
|       (quote (
|               ("o" "overview Agenda"
|                ((agenda "" nil)     ;; still contains tasks tagged with "extra"
|                 (tags "+extra"
|                            ( (org-agenda-overriding-header "Extra") )))
|                 (tags "+CLOSED=\"<today>\""  ;; does not work yet
|                  ( (org-agenda-overriding-header "DONE today") ))
|                nil)
|
| )))
`----

,----[ current org-agenda-sorting-strategy ]
| (setq org-agenda-sorting-strategy
|       (quote ((agenda habit-down time-up user-defined-up priority-down category-keep)
|               (todo priority-down category-keep)
|               (tags priority-down category-keep)
|               (search category-keep))))
`----

Are you able to help here?

My current workaround is excluding tags using [3] and «/ RET» in
agenda. But I want to get rid of this separate step.

  1. http://doc.norang.ca/org-mode.html#CustomAgendaViews
  2. http://doc.norang.ca/org-mode.html#AgendaViewTweaks
  3. http://doc.norang.ca/org-mode.html#CustomAgendaViewFilteringContext
-- 
Karl Voit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exclude tag from custom agenda
  2012-12-07 17:24 Exclude tag from custom agenda Karl Voit
  2012-12-07 20:56 ` Custom Agenda (was: Exclude tag from custom agenda) Karl Voit
@ 2012-12-09 15:59 ` Memnon Anon
  2012-12-09 21:02   ` Karl Voit
  2012-12-09 21:31   ` Karl Voit
  1 sibling, 2 replies; 6+ messages in thread
From: Memnon Anon @ 2012-12-09 15:59 UTC (permalink / raw)
  To: emacs-orgmode

Karl Voit <devnull@Karl-Voit.at> writes:

> What I want to achieve: on top, there should be my normal agenda
> (events, tasks, habits, ...) but minus elements tagged with
> "reward".
[...]
> I think, that «(agenda "" nil)» has to be modified but I don't know
> how.

I'm in a hurry, but lets see if I can give you something in 5 minutes.
We need a skip-by-tag function. gmane should help here
<<search...search>>

Mike McLean posted one in 2011, which still seems to work.
Lets make that a little more general:

#+begin_src emacs-lisp
;;; Based on http://article.gmane.org/gmane.emacs.orgmode/41427
  (defun my-skip-tag(tag)
    "Skip entries that are tagged TAG"
    (let* ((entry-tags (org-get-tags-at (point))))
      (if (member tag entry-tags)
          (progn (outline-next-heading) (point))
        nil)))
#+end_src

Now, (agenda "" nil) should be:

#+begin_src emacs-lisp
(agenda "" 
 ((org-agenda-skip-function '(my-skip-tag"reward"))
  (org-agenda-overriding-header "Agenda (without rewards: ")))))
#+end_src

That should do it.
Please give it a try :)

Memnon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exclude tag from custom agenda
  2012-12-09 15:59 ` Exclude tag from custom agenda Memnon Anon
@ 2012-12-09 21:02   ` Karl Voit
  2012-12-09 21:04     ` Karl Voit
  2012-12-09 21:31   ` Karl Voit
  1 sibling, 1 reply; 6+ messages in thread
From: Karl Voit @ 2012-12-09 21:02 UTC (permalink / raw)
  To: emacs-orgmode

* Memnon Anon <gegendosenfleisch@googlemail.com> wrote:
>
> I'm in a hurry, but lets see if I can give you something in 5 minutes.

:-)

Following works:

,----[ section within org-agenda-custom-commands ]
| ("b" "borrowed stuff" tags "+borrowed" (
|  (org-agenda-overriding-header "stuff that I borrowed")
|  (org-agenda-skip-function 'tag-without-done-or-canceled)
|  ))
`----

,----[ you function ]
| (defun tag-without-done-or-canceled ()
|   "Show items with tag \"borrowed\" that are neither in \"DONE\" or \"CANCELED \" state."
|   (let ((state (org-entry-get (point) "TODO")))
|     (if (and (member "borrowed" (org-get-tags-at (point)))
|              (not (string= state "DONE"))
|              (not (string= state "CANCELED")))
|         nil ; do not skip
|       (line-end-position)))) ; skip
`----

Thanks very much! Very handy to me!

One little thing: there are not items listed that inherit the
«borrowed» tag from any higher level heading.  But I guess this is
something that could not be done easily in this case. Right?

-- 
Karl Voit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exclude tag from custom agenda
  2012-12-09 21:02   ` Karl Voit
@ 2012-12-09 21:04     ` Karl Voit
  0 siblings, 0 replies; 6+ messages in thread
From: Karl Voit @ 2012-12-09 21:04 UTC (permalink / raw)
  To: emacs-orgmode

* Karl Voit <devnull@Karl-Voit.at> wrote:
> * Memnon Anon <gegendosenfleisch@googlemail.com> wrote:
>>
>> I'm in a hurry, but lets see if I can give you something in 5 minutes.
>
> :-)
>
> Following works:

Sorry! I answered the wrong email :-(

My email was referring to another thread here.

-- 
Karl Voit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Exclude tag from custom agenda
  2012-12-09 15:59 ` Exclude tag from custom agenda Memnon Anon
  2012-12-09 21:02   ` Karl Voit
@ 2012-12-09 21:31   ` Karl Voit
  1 sibling, 0 replies; 6+ messages in thread
From: Karl Voit @ 2012-12-09 21:31 UTC (permalink / raw)
  To: emacs-orgmode

* Memnon Anon <gegendosenfleisch@googlemail.com> wrote:
> Karl Voit <devnull@Karl-Voit.at> writes:
>
>> What I want to achieve: on top, there should be my normal agenda
>> (events, tasks, habits, ...) but minus elements tagged with
>> "reward".
>
> #+begin_src emacs-lisp
> ;;; Based on http://article.gmane.org/gmane.emacs.orgmode/41427
>   (defun my-skip-tag(tag)
>     "Skip entries that are tagged TAG"
>     (let* ((entry-tags (org-get-tags-at (point))))
>       (if (member tag entry-tags)
>           (progn (outline-next-heading) (point))
>         nil)))
> #+end_src
>
> #+begin_src emacs-lisp
> (agenda "" 
>  ((org-agenda-skip-function '(my-skip-tag"reward"))
>   (org-agenda-overriding-header "Agenda (without rewards: ")))))
> #+end_src
>
> That should do it.
> Please give it a try :)

Awesome! Works great!

Now I only need the "DONE today" section and a much faster CPU core
to generate my uber-agenda :-)

Thanks for your help!

-- 
Karl Voit

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-09 21:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-07 17:24 Exclude tag from custom agenda Karl Voit
2012-12-07 20:56 ` Custom Agenda (was: Exclude tag from custom agenda) Karl Voit
2012-12-09 15:59 ` Exclude tag from custom agenda Memnon Anon
2012-12-09 21:02   ` Karl Voit
2012-12-09 21:04     ` Karl Voit
2012-12-09 21:31   ` Karl Voit

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