Function: timeclock-make-hours-explicit
timeclock-make-hours-explicit is an interactive and byte-compiled
function defined in timeclock.el.gz.
Signature
(timeclock-make-hours-explicit OLD-DEFAULT)
Documentation
Specify all workday lengths in timeclock-file.
OLD-DEFAULT hours are set for every day that has no number indicated.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/timeclock.el.gz
(defun timeclock-make-hours-explicit (old-default)
"Specify all workday lengths in `timeclock-file'.
OLD-DEFAULT hours are set for every day that has no number indicated."
(interactive "P")
(if old-default (setq old-default (prefix-numeric-value old-default))
(error "`timeclock-make-hours-explicit' requires an explicit argument"))
(let ((extant-timelog (find-buffer-visiting timeclock-file))
current-date)
(with-current-buffer (find-file-noselect timeclock-file t)
(unwind-protect
(save-excursion
(save-restriction
(widen)
(goto-char (point-min))
(while (progn (skip-chars-forward "\n") (not (eobp)))
;; This is just a variant of `timeclock-moment-regexp'.
(unless (looking-at
(concat "^\\([bhioO]\\) \\([0-9]+/[0-9]+/[0-9]+\\) "
"\\([0-9]+:[0-9]+:[0-9]+\\)"))
(error "Can't parse `%s'" timeclock-file))
(let ((this-date (match-string 2)))
(unless (or (and current-date
(string= this-date current-date))
(string= (match-string 1) "h"))
(insert (format "h %s %s %s\n" (match-string 2)
(match-string 3) old-default)))
(if (string-match "^[ih]" (match-string 1)) ; ignore logouts
(setq current-date this-date)))
(forward-line))
(save-buffer)))
(unless extant-timelog (kill-buffer (current-buffer)))))))