all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: reingold@emr.cs.iit.edu (Edward M. Reingold)
To: help-gnu-emacs@gnu.org
Cc: Glenn Morris <rgm@gnu.org>, mvukovic@nycap.rr.com
Subject: Re: how to get calendar- for an offset day
Date: 18 Dec 2008 09:49:30 -0600	[thread overview]
Message-ID: <8563lhv5yt.fsf@emr.cs.iit.edu> (raw)
In-Reply-To: fa480a52-4e81-462c-a2d1-7feb9e5c2799@u18g2000pro.googlegroups.com

>>>>> "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.


  reply	other threads:[~2008-12-18 15:49 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 [this message]
2008-12-23  4:24   ` Mirko

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=8563lhv5yt.fsf@emr.cs.iit.edu \
    --to=reingold@emr.cs.iit.edu \
    --cc=help-gnu-emacs@gnu.org \
    --cc=mvukovic@nycap.rr.com \
    --cc=rgm@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.