comparison lisp/calendar/timeclock.el @ 51871:0c6d39d0f49d

Minor commentary changes. (timeclock-relative, timeclock-ask-before-exiting) (timeclock-use-display-time): Doc changes. (timeclock-modeline-display): Give a message if `timeclock-use-display-time' is non-nil but `display-time-mode' is not active.
author Glenn Morris <rgm@gnu.org>
date Fri, 11 Jul 2003 13:15:05 +0000
parents 91e4e5fd11de
children 695cf19ef79e
comparison
equal deleted inserted replaced
51870:cdd43d169171 51871:0c6d39d0f49d
31 ;; track of how much time you spend working on certain projects. 31 ;; track of how much time you spend working on certain projects.
32 ;; 32 ;;
33 ;; Use `timeclock-in' when you start on a project, and `timeclock-out' 33 ;; Use `timeclock-in' when you start on a project, and `timeclock-out'
34 ;; when you're done. Once you've collected some data, you can use 34 ;; when you're done. Once you've collected some data, you can use
35 ;; `timeclock-workday-remaining' to see how much time is left to be 35 ;; `timeclock-workday-remaining' to see how much time is left to be
36 ;; worked today (assuming a typical average of 8 hours a day), and 36 ;; worked today (where `timeclock-workday' specifies the length of the
37 ;; `timeclock-when-to-leave' which will calculate when you're free. 37 ;; working day), and `timeclock-when-to-leave' to calculate when you're free.
38 38
39 ;; You'll probably want to bind the timeclock commands to some handy 39 ;; You'll probably want to bind the timeclock commands to some handy
40 ;; keystrokes. At the moment, C-x t is unused in Emacs 20: 40 ;; keystrokes. At the moment, C-x t is unused:
41 ;; 41 ;;
42 ;; (require 'timeclock) 42 ;; (require 'timeclock)
43 ;; 43 ;;
44 ;; (define-key ctl-x-map "ti" 'timeclock-in) 44 ;; (define-key ctl-x-map "ti" 'timeclock-in)
45 ;; (define-key ctl-x-map "to" 'timeclock-out) 45 ;; (define-key ctl-x-map "to" 'timeclock-out)
97 "*When reporting time, make it relative to `timeclock-workday'? 97 "*When reporting time, make it relative to `timeclock-workday'?
98 For example, if the length of a normal workday is eight hours, and you 98 For example, if the length of a normal workday is eight hours, and you
99 work four hours on Monday, then the amount of time \"remaining\" on 99 work four hours on Monday, then the amount of time \"remaining\" on
100 Tuesday is twelve hours -- relative to an averaged work period of 100 Tuesday is twelve hours -- relative to an averaged work period of
101 eight hours -- or eight hours, non-relative. So relative time takes 101 eight hours -- or eight hours, non-relative. So relative time takes
102 into account any discrepancy of time under-worked or overworked on 102 into account any discrepancy of time under-worked or over-worked on
103 previous days." 103 previous days. This only affects the timeclock modeline display."
104 :type 'boolean 104 :type 'boolean
105 :group 'timeclock) 105 :group 'timeclock)
106 106
107 (defcustom timeclock-get-project-function 'timeclock-ask-for-project 107 (defcustom timeclock-get-project-function 'timeclock-ask-for-project
108 "*The function used to determine the name of the current project. 108 "*The function used to determine the name of the current project.
130 that day has a different length from the norm." 130 that day has a different length from the norm."
131 :type '(choice (const nil) function) 131 :type '(choice (const nil) function)
132 :group 'timeclock) 132 :group 'timeclock)
133 133
134 (defcustom timeclock-ask-before-exiting t 134 (defcustom timeclock-ask-before-exiting t
135 "*If non-nil, ask if the user wants to clock out before exiting Emacs." 135 "*If non-nil, ask if the user wants to clock out before exiting Emacs.
136 This variable only has an effect if set with \\[customize]."
136 :set (lambda (symbol value) 137 :set (lambda (symbol value)
137 (if value 138 (if value
138 (add-hook 'kill-emacs-query-functions 'timeclock-query-out) 139 (add-hook 'kill-emacs-query-functions 'timeclock-query-out)
139 (remove-hook 'kill-emacs-query-functions 'timeclock-query-out)) 140 (remove-hook 'kill-emacs-query-functions 'timeclock-query-out))
140 (setq timeclock-ask-before-exiting value)) 141 (setq timeclock-ask-before-exiting value))
152 "*If non-nil, use `display-time-hook' for doing modeline updates. 153 "*If non-nil, use `display-time-hook' for doing modeline updates.
153 The advantage to this is that it means one less timer has to be set 154 The advantage to this is that it means one less timer has to be set
154 running amok in Emacs' process space. The disadvantage is that it 155 running amok in Emacs' process space. The disadvantage is that it
155 requires you to have `display-time' running. If you don't want to use 156 requires you to have `display-time' running. If you don't want to use
156 `display-time', but still want the modeline to show how much time is 157 `display-time', but still want the modeline to show how much time is
157 left, set this variable to nil. You will need to restart Emacs (or 158 left, set this variable to nil. Changing the value of this variable
158 toggle the function `timeclock-modeline-display') for the change to 159 while timeclock information is being displayed in the modeline has no
159 take effect." 160 effect. You should call the function `timeclock-modeline-display' with
161 a positive argument to force an update."
160 :set (lambda (symbol value) 162 :set (lambda (symbol value)
161 (let ((currently-displaying 163 (let ((currently-displaying
162 (and (boundp 'timeclock-modeline-display) 164 (and (boundp 'timeclock-modeline-display)
163 timeclock-modeline-display))) 165 timeclock-modeline-display)))
164 ;; if we're changing to the state that 166 ;; if we're changing to the state that
246 (defvar timeclock-elapsed nil 248 (defvar timeclock-elapsed nil
247 "A variable containing the time elapsed for complete periods today. 249 "A variable containing the time elapsed for complete periods today.
248 This value is not accurate enough to be useful by itself. Rather, 250 This value is not accurate enough to be useful by itself. Rather,
249 call `timeclock-workday-elapsed', to determine how much time has been 251 call `timeclock-workday-elapsed', to determine how much time has been
250 worked so far today. Also, if `timeclock-relative' is nil, this value 252 worked so far today. Also, if `timeclock-relative' is nil, this value
251 will be the same as `timeclock-discrepancy'.") 253 will be the same as `timeclock-discrepancy'.") ; ? gm
252 254
253 (defvar timeclock-last-period nil 255 (defvar timeclock-last-period nil
254 "Integer representing the number of seconds in the last period. 256 "Integer representing the number of seconds in the last period.
255 Note that you shouldn't access this value, but should use the function 257 Note that you shouldn't access this value, but should use the function
256 `timeclock-last-period' instead.") 258 `timeclock-last-period' instead.")
295 (remove-hook 'display-time-hook 'timeclock-update-modeline)) 297 (remove-hook 'display-time-hook 'timeclock-update-modeline))
296 (if timeclock-use-display-time 298 (if timeclock-use-display-time
297 (progn 299 (progn
298 ;; Update immediately so there is a visible change 300 ;; Update immediately so there is a visible change
299 ;; on calling this function. 301 ;; on calling this function.
300 (if display-time-mode (timeclock-update-modeline)) 302 (if display-time-mode (timeclock-update-modeline)
303 (message "Activate `display-time-mode' to see \
304 timeclock information"))
301 (add-hook 'display-time-hook 'timeclock-update-modeline)) 305 (add-hook 'display-time-hook 'timeclock-update-modeline))
302 (setq timeclock-update-timer 306 (setq timeclock-update-timer
303 (run-at-time nil 60 'timeclock-update-modeline)))) 307 (run-at-time nil 60 'timeclock-update-modeline))))
304 (setq global-mode-string 308 (setq global-mode-string
305 (delq 'timeclock-mode-string global-mode-string)) 309 (delq 'timeclock-mode-string global-mode-string))