From 0ea15ba2625ab1ecb902b883efb5f94a273015f1 Mon Sep 17 00:00:00 2001 From: BardofSprites <89086143+BardofSprites@users.noreply.github.com> Date: Tue, 22 Apr 2025 18:10:04 -0400 Subject: study session with sowon cl script study.lisp found on my dotfiles-stow repo --- bard-elisp/bard-calendar.el | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'bard-elisp/bard-calendar.el') diff --git a/bard-elisp/bard-calendar.el b/bard-elisp/bard-calendar.el index d14a133..7c2efc6 100644 --- a/bard-elisp/bard-calendar.el +++ b/bard-elisp/bard-calendar.el @@ -3,11 +3,26 @@ ;; Org Clock (defun bard/auto-clock-in () - "Automatically clock in when task marked in progress (INPROG)." + "Automatically clock in when task marked in progress (INPROG), + and start study session." (when (equal (org-get-todo-state) "INPROG") - (org-clock-in)) - (when (equal (org-get-todo-state) "DONE") - (org-clock-out))) + (org-clock-in) + (bard/study-session))) + +(defun bard/study-session () + "Prompt for study parameters, run study session, and clock out when done." + (interactive) + (let* ((study-time (read-string "Study time (minutes): ")) + (break-time (read-string "Break time (minutes): ")) + (sessions (read-string "Number of sessions: ")) + (command (format "study %s %s %s" study-time break-time sessions)) + (process (start-process-shell-command "study-session" "*study*" command))) + (set-process-sentinel + process + (lambda (_proc event) + (when (string= event "finished\n") + (progn (org-clock-out) + (pop-to-buffer-same-window "todo.org"))))))) (defun bard/org-clock-report () (interactive) -- cgit v1.2.3