unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: HASM <hasm@example.invalid>
To: help-gnu-emacs@gnu.org
Subject: icalendar--datetime-to-iso-date (icalendar.el)
Date: Thu, 03 Nov 2016 06:27:00 -0700	[thread overview]
Message-ID: <871sysiti3.fsf@127.0.0.1> (raw)


Shouldn't format in:
  icalendar--datetime-to-iso-date (icalendar.el)
be:
  "%04d%s%02d%s%02d"
instead of:
  "%d%s%d%s%d"?

At least that's how I read the wikipedia description of the standard:
  https://en.wikipedia.org/wiki/ISO_8601

This will allow, for those of use ISO dates with:
  (setq
   diary-date-forms    diary-iso-date-forms
   calendar-date-style 'iso
   )
 
To create a "simple' sort function for the diary, like the one below.

-- HASM

------------------------------------------------------------

(defun sort--diary (diary-filename)
  (with-current-buffer
    (set-buffer (find-file-noselect (expand-file-name diary-filename)))
    (goto-char (point-min))
    (while (search-forward "\C-j " nil t)
      (replace-match "^j "))
    (sort-lines nil (point-min) (point-max))
    (goto-char (point-min))
    (while (search-forward "^j" nil t)
      (replace-match "\C-j"))
    (save-buffer)))

(defvar sort--diary-filename (expand-file-name diary-file)
  "History for sort--diary diary-filename")

(defun sort-diary (diary-filename)
  "Sort diary file.  Requires dates to use ISO standard"
  (interactive (list (read-from-minibuffer
                      "diary file name: "
                      (car sort--diary-filename)
                      nil nil 'sort--diary-filename)))
  (sort--diary diary-filename))
  


             reply	other threads:[~2016-11-03 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 13:27 HASM [this message]
2016-11-04  8:30 ` icalendar--datetime-to-iso-date (icalendar.el) tomas
2016-11-04  9:49   ` Yuri Khan

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=871sysiti3.fsf@127.0.0.1 \
    --to=hasm@example.invalid \
    --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.
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).