diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index 2ba321c..d39dbad 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -1154,6 +1154,45 @@ ending at 23:61. When not given, FILES defaults to (concat date " 23:61") files)) + +;;; Other Utilities + +(defun db/bank-csv-to-org-table () + (interactive) + (goto-char (point-min)) + (kill-line 8) + (replace-regexp "^\"\\|\"$\\|\";\"" "|") + (goto-char (point-min)) + (org-mode) + (org-table-align) + ;; move columns around + (cl-loop + for (word . count) in '(("Wertstellung" . 6) + ("Umsatzart" . 6) + ("Buchungsdetails" . 3)) + do (progn (goto-char (point-min)) + (search-forward word) + (dotimes (i count) + (org-table-move-column-right)))) + (goto-char (point-min))) + +(defun db/org-cleanup-continuous-clocks () + "Join continuous clock lines in the current buffer." + (interactive) + (let* ((inactive-timestamp (org-re-timestamp 'inactive)) + (clock-line (concat "\\(^ *\\)CLOCK: " + inactive-timestamp + "--" + inactive-timestamp + " => .*\n *CLOCK: " + inactive-timestamp + "--\\[\\2\\] => .*$"))) + (save-excursion + (goto-char (point-min)) + (while (search-forward-regexp clock-line nil t) + (replace-match "\\1CLOCK: [\\4]--[\\3]") + (org-clock-update-time-maybe))))) + ;;; End diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index 21749a8..6f3a7fe 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -344,39 +344,6 @@ path." helm-source-bookmarks helm-source-bookmark-set))) - -;;; Org Utilities - -(defun db/bank-csv-to-org-table () - (interactive) - (goto-char (point-min)) - (kill-line 8) - (replace-regexp "^\"\\|\"$\\|\";\"" "|") - (goto-char (point-min)) - (org-mode) - (org-table-align) - ;; move columns around - (cl-loop - for (word . count) in '(("Wertstellung" . 6) ("Umsatzart" . 6) ("Buchungsdetails" . 3)) - do (progn (goto-char (point-min)) - (search-forward word) - (dotimes (i count) - (org-table-move-column-right)))) - (goto-char (point-min))) - -(defun db/org-cleanup-continuous-clocks () - "Join continuous clock lines in the current buffer." - (interactive) - (let* ((inactive-timestamp (org-re-timestamp 'inactive)) - (clock-line (concat "\\(^ *\\)CLOCK: " inactive-timestamp "--" inactive-timestamp " => .*" - "\n" - " *CLOCK: " inactive-timestamp "--\\[\\2\\] => .*$"))) - (save-excursion - (goto-char (point-min)) - (while (search-forward-regexp clock-line nil t) - (replace-match "\\1CLOCK: [\\4]--[\\3]") - (org-clock-update-time-maybe))))) - ;;;