CVS update by adrian packages/xemacs-packages/calendar ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Thu Sep 20 18:30:48 EDT 2007


  User: adrian  
  Date: 07/09/21 00:30:48

  Modified:    packages/xemacs-packages/calendar ChangeLog timeclock.el
Log:
packages: Simplify/fix timeclock.el error line number reporting

-------------------- ChangeLog entries follow: --------------------

xemacs-packages/calendar/ChangeLog addition:

2007-09-21  Adrian Aichner  <adrian at xemacs.org>

	* timeclock.el (timeclock-read-moment): Report current
	`line-number' in case of error.
	* timeclock.el (timeclock-log-data): Remove tracking of line
	number (which currently fails to track time balance entries)
	instead of making the tracking ever more complicated. Simply
	obtain current `line-number' in case of error.
	* timeclock.el (timeclock-find-discrep): Ditto.

Revision  Changes    Path
1.53      +10 -0     XEmacs/packages/xemacs-packages/calendar/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/calendar/ChangeLog,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -p -r1.52 -r1.53
--- ChangeLog	2007/07/11 06:49:31	1.52
+++ ChangeLog	2007/09/20 22:30:47	1.53
@@ -1,3 +1,13 @@
+2007-09-21  Adrian Aichner  <adrian at xemacs.org>
+
+	* timeclock.el (timeclock-read-moment): Report current
+	`line-number' in case of error.
+	* timeclock.el (timeclock-log-data): Remove tracking of line
+	number (which currently fails to track time balance entries)
+	instead of making the tracking ever more complicated. Simply
+	obtain current `line-number' in case of error.
+	* timeclock.el (timeclock-find-discrep): Ditto.
+
 2007-07-11  Norbert Koch  <viteno at xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.33 released.



1.7       +14 -12    XEmacs/packages/xemacs-packages/calendar/timeclock.el

Index: timeclock.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/calendar/timeclock.el,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- timeclock.el	2007/04/16 02:12:28	1.6
+++ timeclock.el	2007/09/20 22:30:47	1.7
@@ -695,7 +695,7 @@ being logged for.  Normally only \"in\" 
       (insert code " "
 	      (if timeclock-use-history
 		  (read-string "timeclock time: "
-	      (format-time-string "%Y/%m/%d %H:%M:%S" now)
+			       (format-time-string "%Y/%m/%d %H:%M:%S" now)
 			       'timeclock-history
 			       (format-time-string "%Y/%m/%d %H:%M:%S" now))
 		(format-time-string "%Y/%m/%d %H:%M:%S" now))
@@ -740,8 +740,10 @@ being logged for.  Normally only \"in\" 
 	    (project (match-string 8)))
       (list code (encode-time sec min hour mday mon year) project)))
    ((not (eobp))
-    (error "unexpected data in %s: %s"
+    (error "unexpected data in %s, line %d: %s"
 	   timeclock-file
+	   ;; XEmacs change
+	   (line-number)
 	   (buffer-substring
 	    (point-at-bol)
 	    (point-at-eol))))))
@@ -1026,7 +1028,7 @@ See the documentation for the given func
 	 (now (current-time))
 	 (todays-date (timeclock-time-to-date now))
 	 last-date-limited last-date-seconds last-date
-	 (line 0) last beg day entry event)
+	 last beg day entry event)
     (with-temp-buffer
       (insert-buffer
        (timeclock-get-timeclock-file-buffer (or filename timeclock-file)))
@@ -1037,7 +1039,6 @@ See the documentation for the given func
       (while (or (setq event (timeclock-read-moment))
 		 (and beg (not last)
 		      (setq last t event (list "o" now))))
-	(setq line (1+ line))
 	(cond ((equal (car event) "b")
 	       (setcar log-data (string-to-number (nth 2 event))))
 	      ((equal (car event) "h")
@@ -1046,7 +1047,8 @@ See the documentation for the given func
 					  3600.0)))
 	      ((equal (car event) "i")
 	       (if beg
-		   (error "Error in format of timelog file, line %d" line)
+		   (error "Error in format of timelog file, line %d"
+			  (line-number))
 		 (setq beg t))
 	       (setq entry (list (cadr event) nil
 				 (and (> (length (nth 2 event)) 0)
@@ -1067,7 +1069,8 @@ See the documentation for the given func
 		       last-date-limited nil)))
 	      ((equal (downcase (car event)) "o")
 	       (if (not beg)
-		   (error "Error in format of timelog file, line %d" line)
+		   (error "Error in format of timelog file, line %d"
+			  (line-number))
 		 (setq beg nil))
 	       (setcar (cdr entry) (cadr event))
 	       (let ((desc (and (> (length (nth 2 event)) 0)
@@ -1112,8 +1115,7 @@ discrepancy, today's discrepancy, and th
   ;;    total)
   (let* ((now (current-time))
 	 (todays-date (timeclock-time-to-date now))
-	 ;; XEmacs change
-	 (first t) (accum 0) (elapsed 0) (line 0)
+	 (first t) (accum 0) (elapsed 0)
 	 event beg last-date avg
 	 last-date-limited last-date-seconds)
     (unless timeclock-discrepancy
@@ -1129,8 +1131,6 @@ discrepancy, today's discrepancy, and th
 	  (unless (re-search-backward "^b\\s-+" nil t)
 	    (goto-char (point-min)))
 	  (while (setq event (timeclock-read-moment))
-	    ;; XEmacs change
-	    (setq line (1+ line))
 	    (cond ((equal (car event) "b")
 		   (setq accum (string-to-number (nth 2 event))))
 		  ((equal (car event) "h")
@@ -1155,7 +1155,8 @@ discrepancy, today's discrepancy, and th
 			   last-date-limited nil)
 		     (if beg
 			 ;; XEmacs change
-			 (error "Error in format of timelog file, line %d" line)
+			 (error "Error in format of timelog file, line %d"
+				(line-number))
 		       (setq beg (timeclock-time-to-seconds (cadr event))))))
 		  ((equal (downcase (car event)) "o")
 		   (if (and (nth 2 event)
@@ -1163,7 +1164,8 @@ discrepancy, today's discrepancy, and th
 		       (add-to-list 'timeclock-reason-list (nth 2 event)))
 		   (if (not beg)
 		       ;; XEmacs change
-		       (error "Error in format of timelog file, line %d" line)
+		       (error "Error in format of timelog file, line %d"
+			      (line-umber))
 		     (setq timeclock-last-period
 			   (- (timeclock-time-to-seconds (cadr event)) beg)
 			   accum (+ timeclock-last-period accum)





More information about the XEmacs-CVS mailing list