[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Diary insert date formatting
From: |
Glenn Morris |
Subject: |
Re: Diary insert date formatting |
Date: |
Mon, 10 Aug 2009 11:27:02 -0700 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
rpd wrote:
> Currently when I insert a diary date it is entered in this format:
> Jul 31, 2009
>
> Can I change this to include the abbreviated day as well e.g:
> Fri Jul 31, 2009 ?
The problem with doing this is how to distinguish the latter from an
entry you want to apply every Friday, rather than one specific Friday.
The simplest method is to just remove support for such entries.
If you want to keep those as well, you will need to use a more complex
expression in the last element of diary-date-forms below.
The following assumes Emacs 23, and is only lightly tested.
(defun my-diary-insert-entry (arg &optional event)
"See `diary-insert-entry'."
(interactive
(list current-prefix-arg last-nonmenu-event))
(let ((calendar-date-display-form
'((if dayname
(concat dayname " "))
monthname " " day ", " year)))
(diary-make-entry (calendar-date-string (calendar-cursor-to-date t event) t)
arg)))
(add-hook 'calendar-load-hook
(lambda ()
(define-key calendar-mode-map "id" 'my-diary-insert-entry)))
(setq diary-date-forms
'(("\\sw+ *" monthname " *" day ", *" year "[^0-9]")
(month "/" day "[^/0-9]")
(month "/" day "/" year "[^0-9]")
(monthname " *" day "[^,0-9]")
(monthname " *" day ", *" year "[^0-9]")
;; (dayname "\\W")
))
Message not available