forked from mirrors/org-mode
`org-timer-set-timer': new prefix argument.
Called with a numeric prefix argument, `org-timer-set-timer' uses this numeric value as the duration of the timer. Called with a `C-u' prefix argument, use `org-timer-default-timer' 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."
This commit is contained in:
parent
e7a3e1a223
commit
59badeeaaf
|
@ -1,3 +1,8 @@
|
||||||
|
2010-05-28 Bastien Guerry <bzg@altern.org>
|
||||||
|
|
||||||
|
* org-timer.el (org-timer-set-timer): Use a prefix argument.
|
||||||
|
See the docstring of the function.
|
||||||
|
|
||||||
2010-05-24 Bastien Guerry <bzg@altern.org>
|
2010-05-24 Bastien Guerry <bzg@altern.org>
|
||||||
|
|
||||||
* org-timer.el (org-timer-set-timer): Fix bug about cancelling
|
* org-timer.el (org-timer-set-timer): Fix bug about cancelling
|
||||||
|
|
|
@ -305,15 +305,35 @@ VALUE can be `on', `off', or `pause'."
|
||||||
(message "%d minute(s) %d seconds left before next time out"
|
(message "%d minute(s) %d seconds left before next time out"
|
||||||
rmins rsecs))))
|
rmins rsecs))))
|
||||||
|
|
||||||
|
(defun bzg-test (&optional test)
|
||||||
|
(interactive "P")
|
||||||
|
test)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun org-timer-set-timer ()
|
(defun org-timer-set-timer (&optional opt)
|
||||||
"Set a timer."
|
"Prompt for a duration and set a timer.
|
||||||
(interactive)
|
|
||||||
(let ((minutes
|
If `org-timer-default-timer' is not zero, suggest this value as
|
||||||
|
the default duration for the timer. If a timer is already set,
|
||||||
|
prompt the use if she wants to replace it.
|
||||||
|
|
||||||
|
Called with a numeric prefix argument, use this numeric value as
|
||||||
|
the duration of the timer.
|
||||||
|
|
||||||
|
Called with a `C-u' prefix argument, use `org-timer-default-timer'
|
||||||
|
without prompting the user for a duration.
|
||||||
|
|
||||||
|
With two `C-u' prefix argument, use `org-timer-default-timer'
|
||||||
|
without prompting the user for a duration and automatically
|
||||||
|
replace any running timer."
|
||||||
|
(interactive "P")
|
||||||
|
(let ((minutes (or (and (numberp opt) (number-to-string opt))
|
||||||
|
(and (listp opt) (not (null opt))
|
||||||
|
(number-to-string org-timer-default-timer))
|
||||||
(read-from-minibuffer
|
(read-from-minibuffer
|
||||||
"How many minutes left? "
|
"How many minutes left? "
|
||||||
(if (not (eq org-timer-default-timer 0))
|
(if (not (eq org-timer-default-timer 0))
|
||||||
(number-to-string org-timer-default-timer)))))
|
(number-to-string org-timer-default-timer))))))
|
||||||
(if (not (string-match "[0-9]+" minutes))
|
(if (not (string-match "[0-9]+" minutes))
|
||||||
(org-timer-show-remaining-time)
|
(org-timer-show-remaining-time)
|
||||||
(let* ((mins (string-to-number (match-string 0 minutes)))
|
(let* ((mins (string-to-number (match-string 0 minutes)))
|
||||||
|
@ -335,7 +355,8 @@ VALUE can be `on', `off', or `pause'."
|
||||||
(t (error "Not in an Org buffer"))))
|
(t (error "Not in an Org buffer"))))
|
||||||
timer-set)
|
timer-set)
|
||||||
(if (or (and org-timer-current-timer
|
(if (or (and org-timer-current-timer
|
||||||
(y-or-n-p "Replace current timer? "))
|
(or (equal opt '(16))
|
||||||
|
(y-or-n-p "Replace current timer? ")))
|
||||||
(not org-timer-current-timer))
|
(not org-timer-current-timer))
|
||||||
(progn
|
(progn
|
||||||
(when org-timer-current-timer
|
(when org-timer-current-timer
|
||||||
|
|
Loading…
Reference in a new issue