emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ryan Leman <ryan.leman92@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Feature mostly complete
Date: Mon, 9 Sep 2024 23:03:59 -0400	[thread overview]
Message-ID: <CA+e5oH-Y=ZBtP3ZGOnU-eGdbNf=9zkWGhs6z0uzXZOmFjwUuUA@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2024-09-10  3:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10  3:03 Ryan Leman [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+e5oH-Y=ZBtP3ZGOnU-eGdbNf=9zkWGhs6z0uzXZOmFjwUuUA@mail.gmail.com' \
    --to=ryan.leman92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).