So I wanted a timer that can take several times and in sequence complete
each timer. This is especially useful for things such as studying where you
might want a timer for studying then another right after for the break
without having to run the same command again.

So this simply takes in text input, requested it to be like: 90 30 90
120.... etc so space separated.

The only issue I had was some error by freeDesktop essentially saying this
had timed out but this code is about 90% done I'd assume unless that
timeout issue is harder to solve than I'm assuming. Would you all want to
'polish' it up and maybe add it? Seems very small but useful and even the
name goes well with orgs other timer commands such as start and stop.

Only thing I'd want is credit via some acknowledgement, can even be in a
code comment :)
here is my github if you wanted it https://github.com/Lemanrp.

'''
;same as org-timer-start but accepts string input of numbers then starts
each timer in order. Good for things like studying where you might schedule
study time, break time, study time, break etc. Obviously good for any task
you need timers right after timer.

(defun org-timer-sequence-start ()
  "Start a sequence of timers with pauses in between."
  (interactive)
  (let ((timer-sequence (mapcar #'string-to-number
                                (split-string (read-string "Enter series of
numbers space-separated: ")))))
    (cl-labels ((run-timer-sequence (seq)
                                    (when seq  ;; Ensure the list is not
empty
                                      (let ((next-time (pop seq)))  ;; Get
the first element and shorten seq list
                                        ;; Set the timer for the next
interval
                                        (org-timer-set-timer next-time)
                                        ;; Display a message indicating the
timer has started
                                        (message "Timer started for %d
minutes..." next-time)
                                        ;; Schedule the next step in the
sequence
                                        (run-at-time (* next-time 60) nil
#'run-timer-sequence seq)))))
      ;; Start the first timer by calling the local function
      (run-timer-sequence timer-sequence))))
'''

Reply via email to