Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: option to refile the timer history as org-clock entry #13

Open
aster-hu opened this issue Feb 16, 2024 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@aster-hu
Copy link

It would be nice if the work history can be refiled as org-clock entry under todo items.

So entries like this

History
[01] WORK 15:41-15:46 : Work
[01] BREAK 15:38-15:41 : Work
[01] WORK 15:28-15:38 : Work

can be converted to an org-clock entry under a TODO item:

* TODO Initial draft
:LOGBOOK:
CLOCK: [2024-02-16 Fri 15:28]--[2024-02-16 Fri 15:38] =>  0:10
CLOCK: [2024-02-16 Fri 15:41]--[2024-02-16 Fri 15:46] =>  0:05
:END:

This will be very useful to incorporate pomm.el into org's clock table.

@SqrtMinusOne SqrtMinusOne added the enhancement New feature or request label Feb 17, 2024
@SqrtMinusOne
Copy link
Owner

Yeah, I wasn't aware of org-clock until recently, but the idea sounds nice. Will see.

@Sabicool
Copy link

Sabicool commented Jul 9, 2024

@aster-hu
Not a direct solution to the issue, but a workaround that has been working for me is to add the pomm functions to the org-clock-in-hook and the org-clock-out-hook. This way when I clock in and clock out of tasks in my org-mode files it automatically starts and stops the timer in pomm as well as setting the context.

As a brief example/my own working example I have shared mine below. I primarily use pomm-third-time. On clock out I am asked whether I want to switch to continue the timer, break, stop the timer or open the transient menu.

      (defun my/pomm-clock-in-hook ()
        (setf (alist-get 'context pomm-third-time--state)
              org-clock-heading)
        (cond ((string= (alist-get 'status pomm-third-time--state)
                        "stopped")
               (pomm-third-time-start))
              ((string= (alist-get 'kind (alist-get 'current pomm-third-time--state))
                        "break")
               (pomm-third-time-switch))
              ((string= (alist-get 'kind (alist-get 'current pomm-third-time--state))
                        "work")
               t)
              (t (pomm-third-time))))
      (add-hook 'org-clock-in-hook 'my/pomm-clock-in-hook)
      (defun my/pomm-clock-out-hook ()
        (let ((input (string (read-char "Would you like to change the timer?\n[n]o [b]reak [s]top [m]enu"))))
          (cond ((string= input "b")
                 (pomm-third-time-switch))
                ((or (string= input "s") (string= input "S"))
                 (pomm-third-time-stop))
                ((string= input "m")
                 (pomm-third-time))
                (t t))))
      (add-hook 'org-clock-out-hook 'my/pomm-clock-out-hook 90 nil)

@SqrtMinusOne
Copy link
Owner

@Sabicool Interesting. I think I'll add a link to this to the README.

I've been experimenting with integrating org-clock andpomm for the last month or so, and I've ended up doing the opposite: making pomm call org-clock-in-last and org-clock-out. I think this works best for me.

I've described this in more detail in the README: https://github.com/SqrtMinusOne/pomm.el?tab=readme-ov-file#usage-with-org-clock

@Sabicool
Copy link

Sabicool commented Jul 12, 2024

@Sabicool Interesting. I think I'll add a link to this to the README.

I've been experimenting with integrating org-clock andpomm for the last month or so, and I've ended up doing the opposite: making pomm call org-clock-in-last and org-clock-out. I think this works best for me.

I've described this in more detail in the README: https://github.com/SqrtMinusOne/pomm.el?tab=readme-ov-file#usage-with-org-clock

I wonder if with that approach. I'm working on "task A", clock in and then if I finish it at the end of that pomodoro, that it will run org-clock-in-last and clock back into "task A" which is now marked as DONE which would not be ideal. I'm not familiar with your workflow as I don't use it, but its good to see the package is flexible and cater towards different workflows.

@SqrtMinusOne
Copy link
Owner

it will run org-clock-in-last and clock back into "task A" which is now marked

I've actually taken that into account: if a pomodoro ends, org-clock-in-last won't be called when the next one starts.

The integration may be suboptimal because it requires starting both pomodoro and org-clock, but I sometimes start one without the other anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants