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: Mon, 11 Jul 2011 21:02:48 +0200

 > Sorry for my less experience of orgmode.
 > Can I get a sample task file which contains such complex schedules?

I can illustrate the point with a simple one :-):

* TODO Thank Sakurai for a great tool <2011-07-05 Tue>  :MH:
* TODO Write paper  <2011-07-05 Tue> :JF:

We share org files among different people (e.g., for software
projects) and use tags to determine whose task it is and in whose
agenda it should appear.  The first one should appear in MH's agenda
and the second one in JF's agenda. A lot of people use the same to
have, e.g., a home agenda and a work agenda:

* TODO Buy groceries <2011-07-05 Tue>  :home:
* TODO Ask boss for a raise  <2011-07-05 Tue> :work:

Currently, both tasks will appear in the calfw view. 

In the normal org agenda views the necessary filtering is done via the
"org-agenda-custom-commands" variable, defining a "custom agenda
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 "MH"))
             (org-agenda-overriding-header 
            "Agenda -- with (only) my tasks (those that have my tag and a 
date)")
         ))))))

(defun my-skip-by-tags (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 particular filter that I use (my-skip-by-tags) 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 (a back-end) that would feed
the data computed to calfw (the same could be used for all the other
agenda exports). Or perhaps org-agenda-get-day-entries can be made to
call a filter function like the one above?

Cheers,

Manuel


 > From: Manuel Hermenegildo <address@hidden>
 > To: Tassilo Horn <address@hidden>
 > Cc: Christopher Allan Webber <address@hidden>,
 >      SAKURAI Masashi <address@hidden>,
 >      address@hidden
 > Subject: Re: [O] Calendar-like view of the org-agenda
 > Date: Wed, 6 Jul 2011 11:39:47 +0200
 > 
 > 
 > First, thanks very much to Sakurai for a wonderful tool and having
 > integrated it so well with org!
 > 
 >  > For me, creating a custom org agenda with the next 21 days takes
 >  > not much less than building an calfw calendar buffer with 42 days.
 > 
 > Same here, the times are comparable. For me building the org calendar
 > is a little slower but it makes sense because it is running some
 > filters, while calfw is not.  Which brings me to my question, which is
 > related to:
 > 
 >  > One thing which I'm currently missing is that the calfw entries
 >  > gathered from org are missing the times (if that's specified using the
 >  > 'time text property) and are sorted in an order I can't understand.
 > 
 > 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 have not had time to look at the code, but perhaps calfw, instead of
 > reading directly the org files could instead use the org code that
 > generates the agenda and then present the agenda in its very nice and
 > graphical way. I.e., an idea would be to add a back end to the code
 > that generates the org agenda which, instead of rendering the agenda
 > creates the calfw objects.
 > 
 > Or, perhaps even simpler, calfw could simply read the org-agenda
 > buffer (colors and all) instead of reading the org files.  
 > 
 > This would have the enormous advantage that it would always generate
 > the tasks with the same order, priorities, filters, customizations,
 > etc. as the org agenda.
 > 
 > What do you think?
 > 
 > Manuel 
 > 
 > 
 > 
 > -- 
 > -------------------------------------------------------------------------------
 > Manuel Hermenegildo                       | Prof., C.S.Dept., T.U. Madrid 
 > (UPM)
 > Director, IMDEA SW Institute & CLIP Group | +34-91-336-7435 (W) -352-4819 
 > (Fax)
 > -------------------------------------------------------------------------------


 > From: Manuel Hermenegildo <address@hidden>
 > To: SAKURAI Masashi <address@hidden>
 > Cc: address@hidden, address@hidden
 > 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 
 > 
 > --


-- 
-------------------------------------------------------------------------------
Manuel Hermenegildo                       | Prof., C.S.Dept., T.U. Madrid (UPM)
Director, IMDEA SW Institute & CLIP Group | +34-91-336-7435 (W) -352-4819 (Fax)
-------------------------------------------------------------------------------




reply via email to

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