diff options
| author | Richard M. Stallman | 2007-05-10 16:32:30 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-05-10 16:32:30 +0000 |
| commit | 9adcbb0ce23a2fdbb363156022f0ec21a3e0dd6b (patch) | |
| tree | 33adfdb95d936eb2ce690a21dddaf3195a26486f | |
| parent | ef533d3e77093882d3a7895827252ac56fef8923 (diff) | |
| download | emacs-9adcbb0ce23a2fdbb363156022f0ec21a3e0dd6b.tar.gz emacs-9adcbb0ce23a2fdbb363156022f0ec21a3e0dd6b.zip | |
(timeclock-in): Fix non-interactive workday specifications.
(timeclock-log): Don't kill the log buffer if it already existed.
| -rw-r--r-- | lisp/calendar/timeclock.el | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index 398b2dd1de5..4e6e4120404 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el | |||
| @@ -375,8 +375,9 @@ discover the name of the project." | |||
| 375 | (setq timeclock-discrepancy | 375 | (setq timeclock-discrepancy |
| 376 | (- (or timeclock-discrepancy 0) workday)) | 376 | (- (or timeclock-discrepancy 0) workday)) |
| 377 | (if (not (= workday timeclock-workday)) | 377 | (if (not (= workday timeclock-workday)) |
| 378 | (timeclock-log "h" (and (numberp arg) | 378 | (timeclock-log "h" (number-to-string |
| 379 | (number-to-string arg)))))) | 379 | (/ workday (if (zerop (% workday (* 60 60))) |
| 380 | 60 60.0) 60)))))) | ||
| 380 | (timeclock-log "i" (or project | 381 | (timeclock-log "i" (or project |
| 381 | (and timeclock-get-project-function | 382 | (and timeclock-get-project-function |
| 382 | (or find-project (interactive-p)) | 383 | (or find-project (interactive-p)) |
| @@ -651,31 +652,35 @@ that variable's documentation." | |||
| 651 | "Log the event CODE to the timeclock log, at the time of call. | 652 | "Log the event CODE to the timeclock log, at the time of call. |
| 652 | If PROJECT is a string, it represents the project which the event is | 653 | If PROJECT is a string, it represents the project which the event is |
| 653 | being logged for. Normally only \"in\" events specify a project." | 654 | being logged for. Normally only \"in\" events specify a project." |
| 654 | (with-current-buffer (find-file-noselect timeclock-file) | 655 | (let ((extant-timelog (find-buffer-visiting timeclock-file))) |
| 655 | (goto-char (point-max)) | 656 | (with-current-buffer (find-file-noselect timeclock-file) |
| 656 | (if (not (bolp)) | 657 | (save-excursion |
| 657 | (insert "\n")) | 658 | (save-restriction |
| 658 | (let ((now (current-time))) | 659 | (widen) |
| 659 | (insert code " " | 660 | (goto-char (point-max)) |
| 660 | (format-time-string "%Y/%m/%d %H:%M:%S" now) | 661 | (if (not (bolp)) |
| 661 | (or (and project | 662 | (insert "\n")) |
| 662 | (stringp project) | 663 | (let ((now (current-time))) |
| 663 | (> (length project) 0) | 664 | (insert code " " |
| 664 | (concat " " project)) | 665 | (format-time-string "%Y/%m/%d %H:%M:%S" now) |
| 665 | "") | 666 | (or (and project |
| 666 | "\n") | 667 | (stringp project) |
| 667 | (if (equal (downcase code) "o") | 668 | (> (length project) 0) |
| 668 | (setq timeclock-last-period | 669 | (concat " " project)) |
| 669 | (- (timeclock-time-to-seconds now) | 670 | "") |
| 670 | (timeclock-time-to-seconds | 671 | "\n") |
| 671 | (cadr timeclock-last-event))) | 672 | (if (equal (downcase code) "o") |
| 672 | timeclock-discrepancy | 673 | (setq timeclock-last-period |
| 673 | (+ timeclock-discrepancy | 674 | (- (timeclock-time-to-seconds now) |
| 674 | timeclock-last-period))) | 675 | (timeclock-time-to-seconds |
| 675 | (setq timeclock-last-event (list code now project))) | 676 | (cadr timeclock-last-event))) |
| 676 | (save-buffer) | 677 | timeclock-discrepancy |
| 677 | (run-hooks 'timeclock-event-hook) | 678 | (+ timeclock-discrepancy |
| 678 | (kill-buffer (current-buffer)))) | 679 | timeclock-last-period))) |
| 680 | (setq timeclock-last-event (list code now project))))) | ||
| 681 | (save-buffer) | ||
| 682 | (run-hooks 'timeclock-event-hook) | ||
| 683 | (unless extant-timelog (kill-buffer (current-buffer)))))) | ||
| 679 | 684 | ||
| 680 | (defvar timeclock-moment-regexp | 685 | (defvar timeclock-moment-regexp |
| 681 | (concat "\\([bhioO]\\)\\s-+" | 686 | (concat "\\([bhioO]\\)\\s-+" |