/[emacs]/emacs/lisp/calendar/timeclock.el
ViewVC logotype

Diff of /emacs/lisp/calendar/timeclock.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by eliz, Sat Nov 3 15:48:13 2001 UTC revision 1.18.4.1 by miles, Fri Apr 4 06:20:16 2003 UTC
# Line 124  If this variable is nil, no questions wi Line 124  If this variable is nil, no questions wi
124    "*A function used to determine the length of today's workday.    "*A function used to determine the length of today's workday.
125  The first time that a user clocks in each day, this function will be  The first time that a user clocks in each day, this function will be
126  called to determine what the length of the current workday is.  If  called to determine what the length of the current workday is.  If
127  nil, or equal to `timeclock-workday', nothing special will be done.  the return value is nil, or equal to `timeclock-workday', nothing special
128  If it is a quantity different from `timeclock-workday', however, a  will be done.  If it is a quantity different from `timeclock-workday',
129  record will be output to the timelog file to note the fact that that  however, a record will be output to the timelog file to note the fact that
130  day has a different length from the norm."  that day has a different length from the norm."
131    :type '(choice (const nil) (function-item timeclock-workday) function)    :type '(choice (const nil) function)
132    :group 'timeclock)    :group 'timeclock)
133    
134  (defcustom timeclock-ask-before-exiting t  (defcustom timeclock-ask-before-exiting t
# Line 273  positive.  Returns the new status of tim Line 273  positive.  Returns the new status of tim
273                    (> (prefix-numeric-value arg) 0)                    (> (prefix-numeric-value arg) 0)
274                  (not timeclock-modeline-display))))                  (not timeclock-modeline-display))))
275      (if on-p      (if on-p
276          (let ((list-entry (memq 'global-mode-string          (let ((list-entry (or (memq 'global-mode-string mode-line-format)
277                                  mode-line-format)))                                ;; In Emacs 21.3 we must use assq
278                                  (assq 'global-mode-string mode-line-format))))
279            (unless (or (null list-entry)            (unless (or (null list-entry)
280                        (memq 'timeclock-mode-string mode-line-format))                        (memq 'timeclock-mode-string mode-line-format))
281              (setcdr list-entry              (setcdr list-entry (cons 'timeclock-mode-string
282                      (cons 'timeclock-mode-string                                       (cdr list-entry))))
                           (cdr list-entry))))  
283            (unless (memq 'timeclock-update-modeline timeclock-event-hook)            (unless (memq 'timeclock-update-modeline timeclock-event-hook)
284              (add-hook 'timeclock-event-hook 'timeclock-update-modeline))              (add-hook 'timeclock-event-hook 'timeclock-update-modeline))
285            (when timeclock-update-timer            (when timeclock-update-timer
# Line 338  discover the name of the project." Line 338  discover the name of the project."
338        (error "You've already clocked in!")        (error "You've already clocked in!")
339      (unless timeclock-last-event      (unless timeclock-last-event
340        (timeclock-reread-log))        (timeclock-reread-log))
341      (unless (equal (timeclock-time-to-date      ;; Either no log file, or day has rolled over.
342                      (cadr timeclock-last-event))      (unless (and timeclock-last-event
343                     (timeclock-time-to-date (current-time)))                   (equal (timeclock-time-to-date
344                             (cadr timeclock-last-event))
345                            (timeclock-time-to-date (current-time))))
346        (let ((workday (or (and (numberp arg) arg)        (let ((workday (or (and (numberp arg) arg)
347                           (and arg 0)                           (and arg 0)
348                           (and timeclock-get-workday-function                           (and timeclock-get-workday-function
# Line 349  discover the name of the project." Line 351  discover the name of the project."
351          (run-hooks 'timeclock-first-in-hook)          (run-hooks 'timeclock-first-in-hook)
352          ;; settle the discrepancy for the new day          ;; settle the discrepancy for the new day
353          (setq timeclock-discrepancy          (setq timeclock-discrepancy
354                (- timeclock-discrepancy workday))                (- (or timeclock-discrepancy 0) workday))
355          (if (not (= workday timeclock-workday))          (if (not (= workday timeclock-workday))
356              (timeclock-log "h" (and (numberp arg)              (timeclock-log "h" (and (numberp arg)
357                                      (number-to-string arg))))))                                      (number-to-string arg))))))
# Line 458  as with time remaining, where negative t Line 460  as with time remaining, where negative t
460              (% (truncate (/ (abs seconds) 60)) 60))))              (% (truncate (/ (abs seconds) 60)) 60))))
461    
462  (defsubst timeclock-workday-remaining (&optional today-only)  (defsubst timeclock-workday-remaining (&optional today-only)
463    "Return a the number of seconds until the workday is complete.    "Return the number of seconds until the workday is complete.
464  The amount returned is relative to the value of `timeclock-workday'.  The amount returned is relative to the value of `timeclock-workday'.
465  If TODAY-ONLY is non-nil, the value returned will be relative only to  If TODAY-ONLY is non-nil, the value returned will be relative only to
466  the time worked today, and not to past time.  This argument only makes  the time worked today, and not to past time.  This argument only makes
# Line 491  See `timeclock-relative' for more inform Line 493  See `timeclock-relative' for more inform
493        string)))        string)))
494    
495  (defsubst timeclock-workday-elapsed ()  (defsubst timeclock-workday-elapsed ()
496    "Return a the number of seconds worked so far today.    "Return the number of seconds worked so far today.
497  If RELATIVE is non-nil, the amount returned will be relative to past  If RELATIVE is non-nil, the amount returned will be relative to past
498  time worked.  The default is to return only the time that has elapsed  time worked.  The default is to return only the time that has elapsed
499  so far today."  so far today."

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.18.4.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26