From f1ae359a3559e1be94186460777f1d387472d534 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 13 Jan 2018 14:25:05 +0100 Subject: [PATCH] =?UTF-8?q?[Utils]=20Move=20org-mode=20utils=20to=20?= =?UTF-8?q?=E2=80=98db-org.el=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and do some minor beautifications. --- site-lisp/db-org.el | 39 +++++++++++++++++++++++++++++++++++++++ site-lisp/db-utils.el | 33 --------------------------------- 2 files changed, 39 insertions(+), 33 deletions(-) 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))))) - ;;;