]> git.eshelyaron.com Git - emacs.git/commitdiff
(timeclock-in): Run the new day section if, after rereading the log file,
authorGlenn Morris <rgm@gnu.org>
Sat, 13 Jul 2002 18:56:04 +0000 (18:56 +0000)
committerGlenn Morris <rgm@gnu.org>
Sat, 13 Jul 2002 18:56:04 +0000 (18:56 +0000)
timeclock-last-event is nil, indicating no log file exists yet. Take
account of the fact that timeclock-discrepancy will be nil in that case.

lisp/ChangeLog
lisp/calendar/timeclock.el

index 707dc9dc1220fa876a0611d9b168b1d7c91f2b38..f3e66eb7df3d07211fab199630298519b7228efa 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-13  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+       * calendar/timeclock.el (timeclock-in): Handle the case where no
+       log file exists (ie the very first call).
+
 2002-07-13  Kai Gro\e,b_\e(Bjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 
        * net/ange-ftp.el: Do not hook into file-name-handler-alist, this
index 21a931297e872116dc20b808b1e387224e9a8915..db679b8d55e5c6c4d6d207ed3f62626d4d8b9c15 100644 (file)
@@ -338,9 +338,11 @@ discover the name of the project."
       (error "You've already clocked in!")
     (unless timeclock-last-event
       (timeclock-reread-log))
-    (unless (equal (timeclock-time-to-date
-                   (cadr timeclock-last-event))
-                  (timeclock-time-to-date (current-time)))
+    ;; Either no log file, or day has rolled over.
+    (unless (and timeclock-last-event
+                 (equal (timeclock-time-to-date
+                         (cadr timeclock-last-event))
+                        (timeclock-time-to-date (current-time))))
       (let ((workday (or (and (numberp arg) arg)
                         (and arg 0)
                         (and timeclock-get-workday-function
@@ -349,7 +351,7 @@ discover the name of the project."
        (run-hooks 'timeclock-first-in-hook)
        ;; settle the discrepancy for the new day
        (setq timeclock-discrepancy
-             (- timeclock-discrepancy workday))
+             (- (or timeclock-discrepancy 0) workday))
        (if (not (= workday timeclock-workday))
            (timeclock-log "h" (and (numberp arg)
                                    (number-to-string arg))))))