emacs-wiki-discuss
[Top][All Lists]
Advanced

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

Re: [emacs-wiki-discuss] Re: weekly-view, cyclic tasks and planner-appts


From: Jim Ottaway
Subject: Re: [emacs-wiki-discuss] Re: weekly-view, cyclic tasks and planner-appts
Date: Mon, 13 Mar 2006 10:10:31 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>>>> Edgar Gonçalves <address@hidden> writes:

> On Saturday, Jim Ottaway wrote:
>>>>>>> Edgar Gonçalves <address@hidden> writes:
> (snip)
>> I think that if you want to do this, then others probably want to too,
>> so it would be good to include your changes to
>> planner-appt-forthcoming-get-appts.
>> 
>> I imagine that you have changed it so that the start date can be
>> specified as well as the number of days?


> I don't have my repository online, for now. I hope to have it soon. Despite
> that, I'll post the new function here, along with both affected functions with
> the proper changes:

[snip code]

I'll have a look at those, later today probably.

> I still have one problem, that is related to the weekly-view production. Right
> now I have a function that collects the appts for 6 days, starting from the
> beginning of the week. My problem is how to get the right Monday date from
> (planner-today). There's a function that works with the calendar cursor, but
> that's no good, because it messes the weekly-view code. I'd like to calculate
> it, but didn't put much thought into it - I was hoping there was already a 
> nice
> elisp function to do it for me! (Btw, if you want to test this, it already
> works, but only if calendar cursor is under a Monday!)

Does this work?:

(defun planner-beginning-of-week (planner-date)
  (let ((date (planner-filename-to-calendar-date planner-date)))
    (planner-date-to-filename
     (calendar-gregorian-from-absolute
      (+ (calendar-absolute-from-gregorian date)
         (- calendar-week-start-day
            (calendar-day-of-week date)))))))

It uses calendar-week-start-day for consistency with calendar [0 for
Sunday, 1 for Monday, etc.].


-- 
Jim Ottaway




reply via email to

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