|
@@ -159,12 +159,14 @@ With prefix arg STOP, stop it entirely."
|
|
|
(defun org-timer-stop ()
|
|
|
"Stop the relative timer."
|
|
|
(interactive)
|
|
|
- (run-hooks 'org-timer-stop-hook)
|
|
|
- (setq org-timer-start-time nil
|
|
|
- org-timer-pause-time nil
|
|
|
- org-timer-current-timer nil)
|
|
|
- (org-timer-set-mode-line 'off)
|
|
|
- (message "Timer stopped"))
|
|
|
+ (if (not org-timer-current-timer)
|
|
|
+ (message "No running timer")
|
|
|
+ (run-hooks 'org-timer-stop-hook)
|
|
|
+ (setq org-timer-start-time nil
|
|
|
+ org-timer-pause-time nil
|
|
|
+ org-timer-current-timer nil)
|
|
|
+ (org-timer-set-mode-line 'off)
|
|
|
+ (message "Timer stopped")))
|
|
|
|
|
|
;;;###autoload
|
|
|
(defun org-timer (&optional restart no-insert-p)
|
|
@@ -349,13 +351,14 @@ VALUE can be `on', `off', or `pause'."
|
|
|
(defun org-timer-cancel-timer ()
|
|
|
"Cancel the current timer."
|
|
|
(interactive)
|
|
|
- (when (eval org-timer-current-timer)
|
|
|
+ (if (not org-timer-current-timer)
|
|
|
+ (message "No timer to cancel")
|
|
|
(run-hooks 'org-timer-cancel-hook)
|
|
|
(cancel-timer org-timer-current-timer)
|
|
|
- (setq org-timer-current-timer nil)
|
|
|
- (setq org-timer-timer-is-countdown nil)
|
|
|
- (org-timer-set-mode-line 'off))
|
|
|
- (message "Last timer canceled"))
|
|
|
+ (setq org-timer-current-timer nil
|
|
|
+ org-timer-timer-is-countdown nil)
|
|
|
+ (org-timer-set-mode-line 'off)
|
|
|
+ (message "Last timer canceled")))
|
|
|
|
|
|
(defun org-timer-show-remaining-time ()
|
|
|
"Display the remaining time before the timer ends."
|
|
@@ -389,9 +392,17 @@ without prompting the user for a duration.
|
|
|
|
|
|
With two `C-u' prefix arguments, use `org-timer-default-timer'
|
|
|
without prompting the user for a duration and automatically
|
|
|
-replace any running timer."
|
|
|
+replace any running timer.
|
|
|
+
|
|
|
+By default, the timer duration will be set to the number of
|
|
|
+minutes in the Effort property, if any. You can ignore this by
|
|
|
+using three `C-u' prefix arguments."
|
|
|
(interactive "P")
|
|
|
- (let ((minutes (or (and (numberp opt) (number-to-string opt))
|
|
|
+ (let ((minutes (or (and (not (equal opt '(64)))
|
|
|
+ (number-to-string
|
|
|
+ (org-hh:mm-string-to-minutes
|
|
|
+ (org-entry-get (point) "effort"))))
|
|
|
+ (and (numberp opt) (number-to-string opt))
|
|
|
(and (listp opt) (not (null opt))
|
|
|
(number-to-string org-timer-default-timer))
|
|
|
(read-from-minibuffer
|