emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Calendar-like view of the org-agenda


From: Manuel Hermenegildo
Subject: Re: [O] Calendar-like view of the org-agenda
Date: Fri, 8 Jul 2011 05:11:23 +0200

 > > Seems like calfw is ignoring the org priorities and order.  In my case
 > > the problem is that calfw is gathering all the tasks ignoring my per
 > > tag filters. I explain: in my case I only want to see in my agenda
 > > entries that have a certain tag (my tag): I share org files with other
 > > people and we assign tasks by marking E.g., I am MH and my tasks are
 > > like:
 > > 
 > > * TODO Thank Sakurai for a great tool <2011-07-05 Tue>  :MH:
 > > 
 > > which should appear in my agenda and there are other tasks like:
 > > 
 > > * TODO Write paper  <2011-07-05 Tue> :JF:
 > > 
 > > which should only appear in JF's agenda. This is done using a custom
 > > agenda command that filters by tag.
 > > 
 > > It seems to me too complicated to try to reproduce all the nuances and
 > > capabilities of org agenda generation (priorities, filtering, custom
 > > views, etc.) and do it all again in calfw --it would always be very
 > > hard to keep them in sync.
 > 
 > I read the code of org-agenda-list and subsequent callee functions.
 > Indeed it was very hard way and I didn't understand all codes because
 > I was not a orgmode user.
 > 
 > Then, I use the function org-agenda-get-day-entries to get schedule
 > items of the org-agenda-files. The function can receive some arguments
 > to limit the tasks, but I didn't understand exactly.  Do you use this
 > function? If so, it may be easy to implement a simple filter.
 ...
 > org-agenda-get-day-entries can take more
 > arguments like :scheduled :deadline to help reduce the size of listed
 > entries.  See the docstring of org-diary, which understands the same
 > list of arguments.

I use the "org-agenda-custom-commands" variable and define a command
with a filter (this is the recommended way of creating different
agendas and todo lists in org). For example, to get an agenda view
with only my tasks, which I identfy with the tag "MH" I use (this is
my normal agenda view):

(setq org-agenda-custom-commands
      (list
        (list 
         "a" "Agenda with (only) my tasks (those that have my tag and a date)"
         '((agenda 
            ""
            ((org-agenda-skip-function '(my-skip-by-tags-mytag "MH"))
             (org-agenda-overriding-header 
            "Agenda -- with (only) my tasks (those that have my tag and a 
date)")
         ))))))

(defun my-skip-by-tags-mytag (tag)
  "Skip tasks except those that contain tag (with inheritance!)." 
  (let ((line-end (save-excursion (progn (end-of-line) (point))))) ;; return pos
    (if (or 
         (member tag (org-get-local-tags)) ;; check first if only local (speed)
         (member tag (org-get-tags-at (point))) ;; rest include inherited tags
         ) 
        nil ; do not skip
      line-end))) ; skip, continue after that

The issue here is that the filter is a function that checks for
inherited tags. I am not sure this can be done with
org-agenda-get-day-entries.  This is why I was suggesting perhaps
using a modified version of org-agenda that would feed data to calfw
instead of (or, perhaps even better, in addition to) generating the
org agenda views. Or perhaps org-agenda-get-day-entries can be made to
call a filter function like the one above?

Manuel 

--




reply via email to

[Prev in Thread] Current Thread [Next in Thread]