From fbf6b15624ad91e8c8725829345511f89112a527 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 15 Mar 2017 11:38:39 +0100 Subject: [PATCH] workhours.org - automate adding new headings if month is missing. Signed-off-by: Andreas Gerler --- bba.org | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bba.org b/bba.org index 298e1def..6389d2f1 100644 --- a/bba.org +++ b/bba.org @@ -3792,8 +3792,14 @@ Split and show workhours: (find-file "~/org/workhours.org") (beginning-of-buffer) (org-shifttab 3) - (re-search-forward (concat "^\*\* "(format-time-string "%Y-%m"))) - (org-beginning-of-line) + (if (re-search-forward (concat "^\*\* "(format-time-string "%Y-%m")) nil t) + (org-beginning-of-line) + (progn + (beginning-of-buffer) + (org-next-visible-heading '1) + (org-meta-return) + (insert (format-time-string "%Y-%m")) + )) )) #+END_SRC -- 2.47.3