diff --git a/dot_doom.d/org.el b/dot_doom.d/org.el index afb0e2a..74f8e16 100644 --- a/dot_doom.d/org.el +++ b/dot_doom.d/org.el @@ -281,21 +281,28 @@ ;; Export current clock subtree to Personio (defun bascht/org-clock-to-personio () (interactive) + (when (org-clock-is-active) + (org-clock-out)) (evil-window-left 0) (persp-switch "@Org") (find-file "/home/bascht/Documents/Zettelkasten/CustomerAlfaview.org") (goto-char (org-find-exact-headline-in-buffer "Arbeitszeiten")) (goto-char (org-find-exact-headline-in-buffer (format-time-string "%Y-%m"))) (search-forward ":LOGBOOK:") - (search-forward ":END:") - (while (not (s-equals? (s-trim (thing-at-point 'line t)) ":LOGBOOK:")) - (forward-line -1) + (while '(not (string-equal (s-trim (thing-at-point 'line t)) ":END:")) + (message "(while) at line [%s]" (s-trim (thing-at-point 'line t))) + (forward-line 1) + ;; (sleep-for 0.2) + ;; (message "Processing line [%s]: %s" (s-trim (thing-at-point 'line t)) (not (s-equals? (s-trim (thing-at-point 'line t)) ":LOGBOOK:"))) + ;; (sleep-for 0.2) (let* ((line (s-trim (thing-at-point 'line t))) (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" org-clock-string "[ \t]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \t]+\\([0-9]+\\):\\([0-9]+\\)\\)"))) - (re-search-forward re) + ;; (nonincremental-re-search-forward re) + (string-match re line) + ;; (sleep-for 0.2) (message "Matching %s in %s" line (match-string 0))))) ;; Temporary test-function to re-trigger the export and get the logs