changeset 51549:48facdb1558e

(display-time-hook, timeclock-modeline-display): Define for byte-compiler. (timeclock-time-to-date, timeclock-workday-remaining) (timeclock-time-to-seconds, timeclock-seconds-to-time): Move earlier in the file so defined before used. (timeclock-status-string): No need for `let*' so use `let'. (timeclock-query-out): Always return a non-nil value.
author Glenn Morris <rgm@gnu.org>
date Thu, 12 Jun 2003 17:28:48 +0000
parents 321bb549acc3
children 5ffaa82e4d48
files lisp/calendar/timeclock.el
diffstat 1 files changed, 41 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/timeclock.el	Thu Jun 12 17:28:09 2003 +0000
+++ b/lisp/calendar/timeclock.el	Thu Jun 12 17:28:48 2003 +0000
@@ -144,6 +144,10 @@
 (defvar timeclock-update-timer nil
   "The timer used to update `timeclock-mode-string'.")
 
+;; For byte-compiler.
+(defvar display-time-hook)
+(defvar timeclock-modeline-display)
+
 (defcustom timeclock-use-display-time t
   "*If non-nil, use `display-time-hook' for doing modeline updates.
 The advantage to this is that it means one less timer has to be set
@@ -321,6 +325,10 @@
   :group 'timeclock
   :require 'timeclock)
 
+(defsubst timeclock-time-to-date (time)
+  "Convert the TIME value to a textual date string."
+  (format-time-string "%Y/%m/%d" time))
+
 ;;;###autoload
 (defun timeclock-in (&optional arg project find-project)
   "Clock in, recording the current time moment in the timelog.
@@ -392,13 +400,26 @@
     (if arg
 	(run-hooks 'timeclock-done-hook))))
 
+(defsubst timeclock-workday-remaining (&optional today-only)
+  "Return the number of seconds until the workday is complete.
+The amount returned is relative to the value of `timeclock-workday'.
+If TODAY-ONLY is non-nil, the value returned will be relative only to
+the time worked today, and not to past time.  This argument only makes
+a difference if `timeclock-relative' is non-nil."
+  (let ((discrep (timeclock-find-discrep)))
+    (if discrep
+	(if today-only
+	    (- (cadr discrep))
+	  (- (car discrep)))
+      0.0)))
+
 ;;;###autoload
 (defun timeclock-status-string (&optional show-seconds today-only)
   "Report the overall timeclock status at the present moment."
   (interactive "P")
-  (let* ((remainder (timeclock-workday-remaining))
-	 (last-in (equal (car timeclock-last-event) "i"))
-	 status)
+  (let ((remainder (timeclock-workday-remaining))
+        (last-in (equal (car timeclock-last-event) "i"))
+        status)
     (setq status
 	  (format "Currently %s since %s (%s), %s %s, leave at %s"
 		  (if last-in "IN" "OUT")
@@ -431,9 +452,11 @@
 (defun timeclock-query-out ()
   "Ask the user before clocking out.
 This is a useful function for adding to `kill-emacs-query-functions'."
-  (if (and (equal (car timeclock-last-event) "i")
-	   (y-or-n-p "You're currently clocking time, clock out? "))
-      (timeclock-out)))
+  (and (equal (car timeclock-last-event) "i")
+       (y-or-n-p "You're currently clocking time, clock out? ")
+       (timeclock-out))
+  ;; Unconditionally return t for `kill-emacs-query-functions'.
+  t)
 
 ;;;###autoload
 (defun timeclock-reread-log ()
@@ -465,19 +488,6 @@
 	    (truncate (/ (abs seconds) 60 60))
 	    (% (truncate (/ (abs seconds) 60)) 60))))
 
-(defsubst timeclock-workday-remaining (&optional today-only)
-  "Return the number of seconds until the workday is complete.
-The amount returned is relative to the value of `timeclock-workday'.
-If TODAY-ONLY is non-nil, the value returned will be relative only to
-the time worked today, and not to past time.  This argument only makes
-a difference if `timeclock-relative' is non-nil."
-  (let ((discrep (timeclock-find-discrep)))
-    (if discrep
-	(if today-only
-	    (- (cadr discrep))
-	  (- (car discrep)))
-      0.0)))
-
 (defsubst timeclock-currently-in-p ()
   "Return non-nil if the user is currently clocked in."
   (equal (car timeclock-last-event) "i"))
@@ -520,6 +530,18 @@
 	(message string)
       string)))
 
+(defsubst timeclock-time-to-seconds (time)
+  "Convert TIME to a floating point number."
+  (+ (* (car time) 65536.0)
+     (cadr time)
+     (/ (or (car (cdr (cdr time))) 0) 1000000.0)))
+
+(defsubst timeclock-seconds-to-time (seconds)
+  "Convert SECONDS (a floating point number) to an Emacs time structure."
+  (list (floor seconds 65536)
+	(floor (mod seconds 65536))
+	(floor (* (- seconds (ffloor seconds)) 1000000))))
+
 (defsubst timeclock-when-to-leave (&optional today-only)
   "Return a time value representing at when the workday ends today.
 If TODAY-ONLY is non-nil, the value returned will be relative only to
@@ -657,22 +679,6 @@
 	    (project (match-string 8)))
 	(list code (encode-time sec min hour mday mon year) project))))
 
-(defsubst timeclock-time-to-seconds (time)
-  "Convert TIME to a floating point number."
-  (+ (* (car time) 65536.0)
-     (cadr time)
-     (/ (or (car (cdr (cdr time))) 0) 1000000.0)))
-
-(defsubst timeclock-seconds-to-time (seconds)
-  "Convert SECONDS (a floating point number) to an Emacs time structure."
-  (list (floor seconds 65536)
-	(floor (mod seconds 65536))
-	(floor (* (- seconds (ffloor seconds)) 1000000))))
-
-(defsubst timeclock-time-to-date (time)
-  "Convert the TIME value to a textual date string."
-  (format-time-string "%Y/%m/%d" time))
-
 (defun timeclock-last-period (&optional moment)
   "Return the value of the last event period.
 If the last event was a clock-in, the period will be open ended, and