]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
workhours.org
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 15 Mar 2017 10:38:39 +0000 (11:38 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 15 Mar 2017 10:38:39 +0000 (11:38 +0100)
- automate adding new headings if month is missing.

Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
bba.org

diff --git a/bba.org b/bba.org
index 298e1def475900ed01589db0f9752fe15adc0662..6389d2f1f428672ff12efe73b7e721796eeb268d 100644 (file)
--- 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