File: timeclock.el.html
This mode is for keeping track of time intervals. You can use it for whatever purpose you like, but the typical scenario is to keep track of how much time you spend working on certain projects.
Use timeclock-in when you start on a project, and timeclock-out
when you're done. Once you've collected some data, you can use
timeclock-workday-remaining to see how much time is left to be
worked today (where timeclock-workday specifies the length of the
working day), and timeclock-when-to-leave to calculate when you're free.
You'll probably want to bind the timeclock commands to some handy keystrokes. Assuming C-c t is unbound, you might use:
(keymap-set "C-c t i" 'timeclock-in)
(keymap-set "C-c t o" 'timeclock-out)
(keymap-set "C-c t c" 'timeclock-change)
(keymap-set "C-c t r" 'timeclock-reread-log)
(keymap-set "C-c t u" 'timeclock-update-mode-line)
(keymap-set "C-c t w" 'timeclock-when-to-leave-string)
If you want Emacs to display the amount of time "left" to your
workday in the mode-line, you can either set the value of
timeclock-mode-line-display(var)/timeclock-mode-line-display(fun) to t using M-x customize, or you can
add this code to your init file:
(require 'timeclock)
(timeclock-mode-line-display)
To cancel this mode line display at any time, just call
timeclock-mode-line-display(var)/timeclock-mode-line-display(fun) again.
You may also want Emacs to ask you before exiting, if you are
currently working on a project. This can be done either by setting
timeclock-ask-before-exiting to t using M-x customize (this is
the default), or by adding the following to your init file:
(add-hook 'kill-emacs-query-functions #'timeclock-query-out)
NOTE: If you change your timelog file without using timeclock's
functions, or if you change the value of any of timeclock's
customizable variables, you should run the command
timeclock-reread-log. This will recompute any discrepancies in
your average working time, and will make sure that the various
display functions return the correct value.
Defined variables (26)
timeclock-ask-before-exiting | If non-nil, ask if the user wants to clock out before exiting Emacs. |
timeclock-day-over | The date of the last day when notified "day over" for. |
timeclock-day-over-hook | A hook that is run when the workday has been completed. |
timeclock-discrepancy | A variable containing the time discrepancy before the last event. |
timeclock-done-hook | A hook run every time a project is marked as completed. |
timeclock-elapsed | A variable containing the time elapsed for complete periods today. |
timeclock-event-hook | A hook run every time any event is recorded. |
timeclock-file | The file used to store timeclock data in. |
timeclock-first-in-hook | A hook run for the first "in" event each day. |
timeclock-get-project-function | The function used to determine the name of the current project. |
timeclock-get-reason-function | A function used to determine the reason for clocking out. |
timeclock-get-workday-function | A function used to determine the length of today’s workday. |
timeclock-in-hook | A hook run every time an "in" event is recorded. |
timeclock-last-event | A list containing the last event that was recorded. |
timeclock-last-event-workday | The number of seconds in the workday of ‘timeclock-last-event’. |
timeclock-last-period | Integer representing the number of seconds in the last period. |
timeclock-load-hook | Hook that gets run after timeclock has been loaded. |
timeclock-mode-line-display | Non-nil if Timeclock-Mode-Line-Display mode is enabled. |
timeclock-mode-line-display-hook | Hook run after entering or leaving ‘timeclock-mode-line-display’. |
timeclock-mode-string | The timeclock string (optionally) displayed in the mode line. |
timeclock-out-hook | A hook run every time an "out" event is recorded. |
timeclock-relative | Whether to make reported time relative to ‘timeclock-workday’. |
timeclock-update-timer | The timer used to update ‘timeclock-mode-string’. |
timeclock-use-display-time | If non-nil, use ‘display-time-hook’ for doing mode line updates. |
timeclock-use-elapsed | Non-nil if the mode line should display time elapsed, not remaining. |
timeclock-workday | The length of a work period in seconds. |