Function: timeclock-mode-line-display

timeclock-mode-line-display is an autoloaded, interactive and byte-compiled function defined in timeclock.el.gz.

Signature

(timeclock-mode-line-display &optional ARG)

Documentation

Toggle display of the amount of time left today in the mode line.

If timeclock-use-display-time is non-nil (the default), then the function display-time-mode(var)/display-time-mode(fun) must be active, and the mode line will be updated whenever the time display is updated. Otherwise, the timeclock will use its own sixty second timer to do its updating. With prefix ARG, turn mode line display on if and only if ARG is positive. Returns the new status of timeclock mode line display (non-nil means on).

If using a customized timeclock-workday value, this should be set before switching this mode on.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/timeclock.el.gz
;;; User Functions:

;;;###autoload
(define-minor-mode timeclock-mode-line-display
  "Toggle display of the amount of time left today in the mode line.
If `timeclock-use-display-time' is non-nil (the default), then
the function `display-time-mode' must be active, and the mode line
will be updated whenever the time display is updated.  Otherwise,
the timeclock will use its own sixty second timer to do its
updating.  With prefix ARG, turn mode line display on if and only
if ARG is positive.  Returns the new status of timeclock mode line
display (non-nil means on).

If using a customized `timeclock-workday' value, this should be
set before switching this mode on."
  :global t
  ;; cf display-time-mode.
  (setq timeclock-mode-string "")
  (or global-mode-string (setq global-mode-string '("")))
  (if timeclock-mode-line-display
      (progn
        (or (memq 'timeclock-mode-string global-mode-string)
            (setq global-mode-string
                  (append global-mode-string '(timeclock-mode-string))))
        (add-hook 'timeclock-event-hook #'timeclock-update-mode-line)
        (when timeclock-update-timer
          (cancel-timer timeclock-update-timer)
          (setq timeclock-update-timer nil))
        (if (boundp 'display-time-hook)
            (remove-hook 'display-time-hook #'timeclock-update-mode-line))
        (if timeclock-use-display-time
            (progn
              ;; Update immediately so there is a visible change
              ;; on calling this function.
              (if display-time-mode
                  (timeclock-update-mode-line)
                (message "Activate `display-time-mode' or turn off \
`timeclock-use-display-time' to see timeclock information"))
              (add-hook 'display-time-hook #'timeclock-update-mode-line))
          (setq timeclock-update-timer
                (run-at-time nil 60 'timeclock-update-mode-line))))
    (setq global-mode-string
          (delq 'timeclock-mode-string global-mode-string))
    (remove-hook 'timeclock-event-hook #'timeclock-update-mode-line)
    (if (boundp 'display-time-hook)
        (remove-hook 'display-time-hook
                     #'timeclock-update-mode-line))
    (when timeclock-update-timer
      (cancel-timer timeclock-update-timer)
      (setq timeclock-update-timer nil))))