unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* icalendar--datetime-to-iso-date (icalendar.el)
@ 2016-11-03 13:27 HASM
  2016-11-04  8:30 ` tomas
  0 siblings, 1 reply; 3+ messages in thread
From: HASM @ 2016-11-03 13:27 UTC (permalink / raw)
  To: help-gnu-emacs


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-04  9:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 13:27 icalendar--datetime-to-iso-date (icalendar.el) HASM
2016-11-04  8:30 ` tomas
2016-11-04  9:49   ` Yuri Khan

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