all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Feature mostly complete
@ 2024-09-10  3:03 Ryan Leman
  2024-09-15 13:05 ` [FR] Allow starting multiple org-timers in sequence (was: Feature mostly complete) Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Ryan Leman @ 2024-09-10  3:03 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2285 bytes --]

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))))
'''

[-- Attachment #2: Type: text/html, Size: 2805 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-11-20 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10  3:03 Feature mostly complete Ryan Leman
2024-09-15 13:05 ` [FR] Allow starting multiple org-timers in sequence (was: Feature mostly complete) Ihor Radchenko
2024-09-20  0:30   ` Ryan Leman
2024-11-20 18:08   ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.