Skip to content

Instantly share code, notes, and snippets.

@celadevra
Created October 2, 2013 00:51
Show Gist options
  • Save celadevra/6787490 to your computer and use it in GitHub Desktop.
Save celadevra/6787490 to your computer and use it in GitHub Desktop.
Generate a series of org-style time stamps, can be used with org-capture-templates. Easing daily time planning.
(defun org-install-series-time-stamp (a b)
"For inserting a morning diary using org's template system.
At the function call, it calls org-insert-time-stamp to
insert a series of active time stamps, one line each. The
function is called with 2 parameters: a hour of the
work day and the b, in the form of int N and M.
i.e. (org-install-series-time-stamp 9 18)"
()
(cond ((< b a) (org-install-series-time-stamp b a))
((< a (- b 1)) (concat (org-insert-time-stamp
(current-time)
nil nil nil nil
(concat
" " (number-to-string a) ":00-"
(number-to-string (+ 1 a)) ":00"))
"\n" (make-string (org-outline-level) 42) " "
(org-install-series-time-stamp (+ 1 a) b)))
((= a (- b 1)) (concat (org-insert-time-stamp
(current-time)
nil nil nil nil
(concat
" " (number-to-string a) ":00-"
(number-to-string (+ 1 a)) ":00"))
(org-install-series-time-stamp (+ 1 a) b)))
((= a b) ())))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment