From: Andreas Gerler Date: Fri, 9 Dec 2022 16:59:42 +0000 (+0100) Subject: change work clocking. X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=4efa70c1b260de83c3e59c2eeb6c5de05b7812ee;p=emacsconfig.git change work clocking. previously we misused the org-clock feature. Now we manually write the clock and free up the org-clock to be used for actual tasks. Signed-off-by: Andreas Gerler --- diff --git a/bba.org b/bba.org index dd75ebfb..c8808b1f 100644 --- a/bba.org +++ b/bba.org @@ -2405,11 +2405,38 @@ taken from http://doc.norang.ca/org-mode.org (setq org-refile-target-verify-function 'bh/verify-refile-target) + (defun bba-clock-in () + "Clock in of workhours." + (interactive) + (find-file "~/org/workhours.org") + (goto-char (point-min)) + (if (re-search-forward (concat "^\*\* "(format-time-string "%Y-%m")) nil t) + (progn (org-beginning-of-line) + (re-search-forward "^ *:LOGBOOK:") + (next-line) + (org-beginning-of-line) + (insert (format-time-string "CLOCK: [%Y-%m-%d %a %H:%M]")) + (newline) + ))) + + (defun bba-clock-out () + "Clock out of workhours." + (interactive) + (find-file "~/org/workhours.org") + (goto-char (point-min)) + (if (re-search-forward (concat "^\*\* "(format-time-string "%Y-%m")) nil t) + (progn (org-beginning-of-line) + (re-search-forward "^ *:LOGBOOK:") + (next-line) + (org-end-of-line) + (insert (format-time-string "--[%Y-%m-%d %a %H:%M]")) + (org-ctrl-c-ctrl-c)))) + (global-set-key (kbd "") 'org-agenda) (global-set-key (kbd " c") 'calendar) - (global-set-key (kbd " I") 'bh/punch-in) - (global-set-key (kbd " O") 'bh/punch-out) + (global-set-key (kbd " I") 'bba-clock-in) + (global-set-key (kbd " O") 'bba-clock-out) (global-set-key (kbd " t") 'bh/insert-inactive-timestamp) (global-set-key (kbd " T") 'bh/toggle-insert-inactive-timestamp) (global-set-key (kbd "C-") 'previous-buffer) @@ -5611,7 +5638,7 @@ Some private settings outside this repository are loaded after this configuratio #+END_SRC * done - +[2014-08-27 Wed 11:02] Display greetings: #+BEGIN_SRC emacs-lisp @@ -5623,27 +5650,30 @@ Display greetings: Split and show workhours: -#+BEGIN_SRC emacs-lisp +#+begin_src emacs-lisp (if (equal "work" (getenv "SYSENV")) - (progn (org-agenda-list) - (split-window-right) - (other-window 1) - (find-file "~/org/workhours.org") - (goto-char (point-min)) - (org-shifttab 3) - (if (re-search-forward (concat "^\*\* "(format-time-string "%Y-%m")) nil t) - (org-beginning-of-line) - (progn - (goto-char (point-min)) - (org-next-visible-heading '1) - (org-meta-return) - (insert (format-time-string "%Y-%m")) - )) - )) - -#+END_SRC + (progn (org-agenda-list) + (split-window-right) + (other-window 1) + (find-file "~/org/workhours.org") + (goto-char (point-min)) + (org-shifttab 3) + (if (re-search-forward (concat "^\*\* "(format-time-string "%Y-%m")) nil t) + (progn + (org-beginning-of-line) + (org-cycle)) + (progn + (goto-char (point-min)) + (org-next-visible-heading '1) + (org-meta-return) + (insert (format-time-string "%Y-%m")) + (newline) + (insert ":LOGBOOK:") + (newline) + (insert ":END:"))) + )) +#+end_src - [2014-08-27 Wed 11:02] * old config #+BEGIN_SRC emacs-lisp :eval no :tangle no