all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm+news@stanford.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Diary insert date formatting
Date: Mon, 10 Aug 2009 11:27:02 -0700	[thread overview]
Message-ID: <saiqgved8p.fsf@xoc2.stanford.edu> (raw)
In-Reply-To: mailman.4212.1249760813.2239.help-gnu-emacs@gnu.org

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


  parent reply	other threads:[~2009-08-10 18:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4212.1249760813.2239.help-gnu-emacs@gnu.org>
2009-08-09  3:55 ` Diary insert date formatting Xah Lee
2009-08-09 14:01   ` Diary insert date formatting-Help still needed please rpd
     [not found]   ` <mailman.4233.1249826480.2239.help-gnu-emacs@gnu.org>
2009-08-09 22:09     ` B. T. Raven
2009-08-10 11:47       ` Diary insert date formatting-Help still needed please-Still needed! rpd
2009-08-10 18:27 ` Glenn Morris [this message]
2009-08-10 20:00   ` Diary insert date formatting rpd
2009-08-11 16:25     ` Diary insert date formatting-continued! rpd
     [not found]     ` <mailman.4392.1250007957.2239.help-gnu-emacs@gnu.org>
2009-08-11 19:21       ` Glenn Morris
2009-08-11 20:06         ` rpd
     [not found]   ` <mailman.4324.1249934454.2239.help-gnu-emacs@gnu.org>
2009-08-10 21:45     ` Diary insert date formatting Glenn Morris
2009-08-08 19:46 rpd

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=saiqgved8p.fsf@xoc2.stanford.edu \
    --to=rgm+news@stanford.edu \
    --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.