aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Wiegley2001-04-24 01:39:55 +0000
committerJohn Wiegley2001-04-24 01:39:55 +0000
commit3dc630b9e18cac41246c81e2d7d11c25857f4e58 (patch)
tree190cd11ba2d77e05639cfb9e52663e9b350794e7
parent9c6a6a5a66a535115fae4b861cfdbabef0ea507d (diff)
downloademacs-3dc630b9e18cac41246c81e2d7d11c25857f4e58.tar.gz
emacs-3dc630b9e18cac41246c81e2d7d11c25857f4e58.zip
(timeclock-day-required): If the time required for a particular day is
not set, use `timeclock-workday'. (timeclock-find-discrep): Added some sample code in a comment.
-rw-r--r--lisp/ChangeLog31
-rw-r--r--lisp/calendar/timeclock.el102
2 files changed, 86 insertions, 47 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index edc8d51a1e4..b47aa3576f3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,34 @@
12001-04-23 John Wiegley <johnw@gnu.org>
2
3 * calendar/timeclock.el (timeclock-day-required): If the time
4 required for a particular day is not set, use `timeclock-workday'.
5 (timeclock-find-discrep): Added some sample code in a comment.
6
7 * eshell/eshell.el (eshell-command): Made a few changes so that
8 `eshell-command' could be called programmatically.
9
10 * eshell/esh-mode.el: Moved `eshell-non-interactive-p' to
11 eshell.el.
12
13 * eshell/eshell.el (eshell-non-interactive-p): Moved this variable
14 here.
15
162001-04-22 John Wiegley <johnw@gnu.org>
17
18 * calendar/timeclock.el: Updated copyright.
19 (timeclock-generate-report): Don't report the daily or two-week
20 total, if no time has been worked in that period.
21 (timeclock-find-discrep): Moved call to `file-readable-p'; removed
22 final computational form, which was unnecessary; corrected a
23 parsing problem when timeclock-relative was nil.
24
252001-04-22 Kahlil Hodgson <kahlil@discus.anu.edu.au>
26
27 * calendar/timeclock.el (timeclock-modeline-display): Check if
28 `list-entry' is null.
29 (timeclock-use-display-time): The first argument to `set-variable'
30 must be a symbol.
31
12001-04-23 Eli Zaretskii <eliz@is.elta.co.il> 322001-04-23 Eli Zaretskii <eliz@is.elta.co.il>
2 33
3 * calendar/calendar.el (diary-entry-marker) 34 * calendar/calendar.el (diary-entry-marker)
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index 82d1e4c3490..bb4976a1ca2 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -1,6 +1,6 @@
1;;; timeclock.el --- mode for keeping track of how much you work 1;;; timeclock.el --- mode for keeping track of how much you work
2 2
3;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. 3;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
4 4
5;; Author: John Wiegley <johnw@gnu.org> 5;; Author: John Wiegley <johnw@gnu.org>
6;; Created: 25 Mar 1999 6;; Created: 25 Mar 1999
@@ -170,10 +170,10 @@ take effect."
170 timeclock-update-timer))) 170 timeclock-update-timer)))
171 (setq currently-displaying nil)) 171 (setq currently-displaying nil))
172 (and currently-displaying 172 (and currently-displaying
173 (set-variable timeclock-modeline-display nil)) 173 (set-variable 'timeclock-modeline-display nil))
174 (setq timeclock-use-display-time value) 174 (setq timeclock-use-display-time value)
175 (and currently-displaying 175 (and currently-displaying
176 (set-variable timeclock-modeline-display t)) 176 (set-variable 'timeclock-modeline-display t))
177 timeclock-use-display-time)) 177 timeclock-use-display-time))
178 :type 'boolean 178 :type 'boolean
179 :group 'timeclock 179 :group 'timeclock
@@ -275,7 +275,8 @@ positive. Returns the new status of timeclock modeline display
275 (if on-p 275 (if on-p
276 (let ((list-entry (memq 'global-mode-string 276 (let ((list-entry (memq 'global-mode-string
277 mode-line-format))) 277 mode-line-format)))
278 (unless (memq 'timeclock-mode-string mode-line-format) 278 (unless (or (null list-entry)
279 (memq 'timeclock-mode-string mode-line-format))
279 (setcdr list-entry 280 (setcdr list-entry
280 (cons 'timeclock-mode-string 281 (cons 'timeclock-mode-string
281 (cdr list-entry)))) 282 (cdr list-entry))))
@@ -712,7 +713,7 @@ This is only provided for coherency when used by
712 713
713 714
714(defsubst timeclock-day-required (day) 715(defsubst timeclock-day-required (day)
715 (car day)) 716 (or (car day) timeclock-workday))
716 717
717(defsubst timeclock-day-length (day) 718(defsubst timeclock-day-length (day)
718 (timeclock-entry-list-length (cdr day))) 719 (timeclock-entry-list-length (cdr day)))
@@ -998,13 +999,23 @@ identical to what would be return if `timeclock-relative' were nil."
998 ;; This is not implemented in terms of the functions above, because 999 ;; This is not implemented in terms of the functions above, because
999 ;; it's a bit wasteful to read all of that data in, just to throw 1000 ;; it's a bit wasteful to read all of that data in, just to throw
1000 ;; away more than 90% of the information afterwards. 1001 ;; away more than 90% of the information afterwards.
1001 (when (file-readable-p timeclock-file) 1002 ;;
1002 (let* ((now (current-time)) 1003 ;; If it were implemented using those functions, it would look
1003 (todays-date (timeclock-time-to-date now)) 1004 ;; something like this:
1004 (first t) (accum 0) 1005 ;; (let ((days (timeclock-day-alist (timeclock-log-data)))
1005 event beg last-date avg 1006 ;; (total 0.0))
1006 last-date-limited last-date-seconds) 1007 ;; (while days
1007 (unless timeclock-discrepancy 1008 ;; (setq total (+ total (- (timeclock-day-length (cdar days))
1009 ;; (timeclock-day-required (cdar days))))
1010 ;; days (cdr days)))
1011 ;; total)
1012 (let* ((now (current-time))
1013 (todays-date (timeclock-time-to-date now))
1014 (first t) (accum 0)
1015 event beg last-date avg
1016 last-date-limited last-date-seconds)
1017 (unless timeclock-discrepancy
1018 (when (file-readable-p timeclock-file)
1008 (setq timeclock-project-list nil 1019 (setq timeclock-project-list nil
1009 timeclock-last-project nil 1020 timeclock-last-project nil
1010 timeclock-reason-list nil 1021 timeclock-reason-list nil
@@ -1028,10 +1039,11 @@ identical to what would be return if `timeclock-relative' were nil."
1028 (add-to-list 'timeclock-project-list (nth 2 event)) 1039 (add-to-list 'timeclock-project-list (nth 2 event))
1029 (setq timeclock-last-project (nth 2 event))) 1040 (setq timeclock-last-project (nth 2 event)))
1030 (let ((date (timeclock-time-to-date (cadr event)))) 1041 (let ((date (timeclock-time-to-date (cadr event))))
1031 (if (and timeclock-relative 1042 (if (if timeclock-relative
1032 (if last-date 1043 (if last-date
1033 (not (equal date last-date)) 1044 (not (equal date last-date))
1034 first)) 1045 first)
1046 (equal date todays-date))
1035 (setq first nil 1047 (setq first nil
1036 accum (- accum 1048 accum (- accum
1037 (if last-date-limited 1049 (if last-date-limited
@@ -1051,39 +1063,31 @@ identical to what would be return if `timeclock-relative' were nil."
1051 (if (not beg) 1063 (if (not beg)
1052 (error "Error in format of timelog file!") 1064 (error "Error in format of timelog file!")
1053 (setq timeclock-last-period 1065 (setq timeclock-last-period
1054 (- (timeclock-time-to-seconds (cadr event)) 1066 (- (timeclock-time-to-seconds (cadr event)) beg)
1055 beg)
1056 accum (+ timeclock-last-period accum) 1067 accum (+ timeclock-last-period accum)
1057 beg nil))) 1068 beg nil))
1069 (setq beg nil))
1058 (if (equal last-date todays-date) 1070 (if (equal last-date todays-date)
1059 (setq timeclock-elapsed 1071 (setq timeclock-elapsed
1060 (+ timeclock-last-period timeclock-elapsed))))) 1072 (+ timeclock-last-period timeclock-elapsed)))))
1061 (setq timeclock-last-event event 1073 (setq timeclock-last-event event
1062 timeclock-last-event-workday 1074 timeclock-last-event-workday
1063 (if (equal (timeclock-time-to-date now) 1075 (if (equal (timeclock-time-to-date now) last-date-limited)
1064 last-date-limited)
1065 last-date-seconds 1076 last-date-seconds
1066 timeclock-workday)) 1077 timeclock-workday))
1067 (forward-line)) 1078 (forward-line))
1068 (setq timeclock-discrepancy accum))) 1079 (setq timeclock-discrepancy accum))))
1069 (setq accum (if today-only 1080 (setq accum (if today-only
1070 timeclock-elapsed 1081 timeclock-elapsed
1071 timeclock-discrepancy)) 1082 timeclock-discrepancy))
1072 (if timeclock-last-event 1083 (if timeclock-last-event
1073 (if (equal (car timeclock-last-event) "i") 1084 (if (equal (car timeclock-last-event) "i")
1074 (setq accum (+ accum (timeclock-last-period now))) 1085 (setq accum (+ accum (timeclock-last-period now)))
1075 (if (not (equal (timeclock-time-to-date 1086 (if (not (equal (timeclock-time-to-date
1076 (cadr timeclock-last-event)) 1087 (cadr timeclock-last-event))
1077 (timeclock-time-to-date now))) 1088 (timeclock-time-to-date now)))
1078 (setq accum (- accum timeclock-last-event-workday))))) 1089 (setq accum (- accum timeclock-last-event-workday)))))
1079 (setq accum 1090 accum))
1080 (- accum
1081 (if (and timeclock-last-event
1082 (equal (timeclock-time-to-date
1083 (cadr timeclock-last-event))
1084 (timeclock-time-to-date now)))
1085 timeclock-last-event-workday
1086 timeclock-workday))))))
1087 1091
1088;;; A reporting function that uses timeclock-log-data 1092;;; A reporting function that uses timeclock-log-data
1089 1093
@@ -1158,10 +1162,14 @@ identical to what would be return if `timeclock-relative' were nil."
1158 (if (null two-week-len) 1162 (if (null two-week-len)
1159 (setq two-week-len today-len)) 1163 (setq two-week-len today-len))
1160 (if html-p (insert "<p>")) 1164 (if html-p (insert "<p>"))
1161 (insert "\nTime spent on this task today: " 1165 (if today-len
1162 (timeclock-seconds-to-string today-len) 1166 (insert "\nTime spent on this task today: "
1163 ". In the last two weeks: " 1167 (timeclock-seconds-to-string today-len)
1164 (timeclock-seconds-to-string two-week-len)) 1168 ". In the last two weeks: "
1169 (timeclock-seconds-to-string two-week-len))
1170 (if two-week-len
1171 (insert "\nTime spent on this task in the last two weeks: "
1172 (timeclock-seconds-to-string two-week-len))))
1165 (if html-p (insert "<br>")) 1173 (if html-p (insert "<br>"))
1166 (insert "\n" 1174 (insert "\n"
1167 (timeclock-seconds-to-string (timeclock-workday-elapsed)) 1175 (timeclock-seconds-to-string (timeclock-workday-elapsed))
@@ -1262,7 +1270,7 @@ identical to what would be return if `timeclock-relative' were nil."
1262 "</td>\n") 1270 "</td>\n")
1263 (setq i (1+ i)))) 1271 (setq i (1+ i))))
1264 (insert "</tr>\n") 1272 (insert "</tr>\n")
1265 1273
1266 (insert "<tr>\n") 1274 (insert "<tr>\n")
1267 (insert "<td align=\"center\">Time out</td>\n") 1275 (insert "<td align=\"center\">Time out</td>\n")
1268 (let ((i 0) (l 5)) 1276 (let ((i 0) (l 5))
@@ -1272,7 +1280,7 @@ identical to what would be return if `timeclock-relative' were nil."
1272 "</td>\n") 1280 "</td>\n")
1273 (setq i (1+ i)))) 1281 (setq i (1+ i))))
1274 (insert "</tr>\n") 1282 (insert "</tr>\n")
1275 1283
1276 (insert "<tr>\n") 1284 (insert "<tr>\n")
1277 (insert "<td align=\"center\">Break</td>\n") 1285 (insert "<td align=\"center\">Break</td>\n")
1278 (let ((i 0) (l 5)) 1286 (let ((i 0) (l 5))
@@ -1282,7 +1290,7 @@ identical to what would be return if `timeclock-relative' were nil."
1282 "</td>\n") 1290 "</td>\n")
1283 (setq i (1+ i)))) 1291 (setq i (1+ i))))
1284 (insert "</tr>\n") 1292 (insert "</tr>\n")
1285 1293
1286 (insert "<tr>\n") 1294 (insert "<tr>\n")
1287 (insert "<td align=\"center\">Workday</td>\n") 1295 (insert "<td align=\"center\">Workday</td>\n")
1288 (let ((i 0) (l 5)) 1296 (let ((i 0) (l 5))