[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
icalendar--datetime-to-iso-date (icalendar.el)
From: |
HASM |
Subject: |
icalendar--datetime-to-iso-date (icalendar.el) |
Date: |
Thu, 03 Nov 2016 06:27:00 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
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))
- icalendar--datetime-to-iso-date (icalendar.el),
HASM <=