all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mirko <mvukovic@nycap.rr.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to get calendar- for an offset day
Date: Mon, 22 Dec 2008 20:24:34 -0800 (PST)	[thread overview]
Message-ID: <755b860d-d1c3-4bca-9565-5886bb61e458@e6g2000vbe.googlegroups.com> (raw)
In-Reply-To: 8563lhv5yt.fsf@emr.cs.iit.edu

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


      reply	other threads:[~2008-12-23  4:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=755b860d-d1c3-4bca-9565-5886bb61e458@e6g2000vbe.googlegroups.com \
    --to=mvukovic@nycap.rr.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.