Skip to content

Instantly share code, notes, and snippets.

@hghwng
Created September 6, 2016 03:07
Show Gist options
  • Save hghwng/57d6f62ff48ebdce804927f0451c8a93 to your computer and use it in GitHub Desktop.
Save hghwng/57d6f62ff48ebdce804927f0451c8a93 to your computer and use it in GitHub Desktop.
Org mode: parse week with customizable start of week number
(with-eval-after-load 'org
(setq start-week 37)
(advice-add 'org-read-date-analyze :around
(lambda (original-fun ans org-def org-defdecode)
(funcall original-fun
(if (string-match "^s\\([0-9]+\\)\\(.*\\)" ans)
(concat "w"
(number-to-string (+ start-week
(string-to-number (match-string 1 ans))))
(match-string 2 ans))
ans)
org-def org-defdecode)))
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment