[Utils] Move org-mode utils to ‘db-org.el’
and do some minor beautifications.
This commit is contained in:
parent
62ae309381
commit
f1ae359a35
|
@ -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
|
||||
|
||||
|
|
|
@ -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)))))
|
||||
|
||||
|
||||
;;;
|
||||
|
||||
|
|
Loading…
Reference in New Issue