* how to get calendar- for an offset day
@ 2008-12-18 14:03 Mirko
2008-12-18 15:49 ` Edward M. Reingold
0 siblings, 1 reply; 3+ messages in thread
From: Mirko @ 2008-12-18 14:03 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
For a personal log, I use the `calendar-current-date' function
together with calendar-date-display-form to insert the current date
into the diary. But sometimes I am lazy, or I forget, and I need to
insert yesterday's date into the calendar.
I did not find anything in calendar.el (but I might have missed it).
Any other options?
Thanks,
Mirko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to get calendar- for an offset day
2008-12-18 14:03 how to get calendar- for an offset day Mirko
@ 2008-12-18 15:49 ` Edward M. Reingold
2008-12-23 4:24 ` Mirko
0 siblings, 1 reply; 3+ messages in thread
From: Edward M. Reingold @ 2008-12-18 15:49 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: Glenn Morris, mvukovic
>>>>> "M" == Mirko <mvukovic@nycap.rr.com> writes:
M> Hi, For a personal log, I use the `calendar-current-date' function
M> together with calendar-date-display-form to insert the current date
M> into the diary. But sometimes I am lazy, or I forget, and I need to
M> insert yesterday's date into the calendar.
M> I did not find anything in calendar.el (but I might have missed it).
M> Any other options?
This suggests an improvement to calendar.el. Change the function
calendar-current-date to have an optional OFFSET:
(defun calendar-current-date (&optional offset)
"Return the current date in a list (month day year).
Optional OFFSET is number of days from current date."
(let* ((now (decode-time)))
(calendar-gregorian-from-absolute
(+ (calendar-absolute-from-gregorian
(list (nth 4 now) (nth 3 now) (nth 5 now)))
(if offset offset 0)))))
--
Professor Edward M. Reingold Email: reingold@iit.edu
Department of Computer Science Voice: (312) 567-3309
Illinois Institute of Technology Fax: (312) 567-5067
Stuart Building, 228F
10 West 31st Street
Chicago, IL 60616-3729 U.S.A.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to get calendar- for an offset day
2008-12-18 15:49 ` Edward M. Reingold
@ 2008-12-23 4:24 ` Mirko
0 siblings, 0 replies; 3+ messages in thread
From: Mirko @ 2008-12-23 4:24 UTC (permalink / raw)
To: help-gnu-emacs
On Dec 18, 10:49 am, reing...@emr.cs.iit.edu (Edward M. Reingold)
wrote:
> >>>>> "M" == Mirko <mvuko...@nycap.rr.com> writes:
>
> M> Hi, For a personal log, I use the `calendar-current-date' function
> M> together with calendar-date-display-form to insert the current date
> M> into the diary. But sometimes I am lazy, or I forget, and I need to
> M> insert yesterday's date into the calendar.
>
> M> I did not find anything in calendar.el (but I might have missed it).
> M> Any other options?
>
> This suggests an improvement to calendar.el. Change the function
> calendar-current-date to have an optional OFFSET:
>
> (defun calendar-current-date (&optional offset)
> "Return the current date in a list (month day year).
> Optional OFFSET is number of days from current date."
> (let* ((now (decode-time)))
> (calendar-gregorian-from-absolute
> (+ (calendar-absolute-from-gregorian
> (list (nth 4 now) (nth 3 now) (nth 5 now)))
> (if offset offset 0)))))
>
> --
>
> Professor Edward M. Reingold Email: reing...@iit.edu
> Department of Computer Science Voice: (312) 567-3309
> Illinois Institute of Technology Fax: (312) 567-5067
> Stuart Building, 228F
> 10 West 31st Street
> Chicago, IL 60616-3729 U.S.A.
Thanks. I'll give it a shot.
Mirko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-23 4:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-18 14:03 how to get calendar- for an offset day Mirko
2008-12-18 15:49 ` Edward M. Reingold
2008-12-23 4:24 ` Mirko
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).