I use the Emacs org-mode for clocking in and out of work and I would like to automate some specific tasks every time I clock out. For example, I have a shell script to push repositories to a version control system and I would like to do this automatically when I'm finished working (i.e. when I clock out). This could be extended to every time you clock in as well (e.x. whenever I clock in I want to open my e-mail client automatically).
Any ideas on how to write Emacs lisp in my .emacs file to accomplish this?
So, you want to track time in tasks in Org-mode? First, you need a task, any headline can be clocked in to. In order to clock in to a task, hit C-c C-x C-i, and hit C-c C-x C-o to clock back out. When you clock in to a headline a drawer appears, a drawer looks like this: You can expand and collapse the drawer with TAB.
In order to clock in to a task, hit C-c C-x C-i, and hit C-c C-x C-o to clock back out. When you clock in to a headline a drawer appears, a drawer looks like this:
These are taken straight from the org-mode clock-table documentation . You can use the S-<left>/<right> keys on the :block line to shift the time interval. Sometimes you need to manually make changes to a clock, because it's wrong, or you forgot to clock in, or your cat jumped on to your keyboard and clocked in to an embarrassing task.
While the clock is running, Org shows the current clocking time in the mode line, along with the title of the task. The clock time shown is all time ever clocked for this task and its children. If the task has an effort estimate (see Effort Estimates ), the mode line displays the current clocking time against it 74.
You could write a function that does what you need to have done, and add it to org-clock-out-hook
. Perhaps something like this (untested):
(defun my-on-org-clock-out ()
(shell-command "commit-everything.sh"))
(add-hook 'org-clock-out-hook 'my-on-org-clock-out)
Likewise, there is a hook called org-clock-in-hook
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With