marcinkoziej / org-pomodoro

pomodoro technique for org-mode
https://github.com/lolownia/org-pomodoro
GNU General Public License v3.0
590 stars 79 forks source link

org-pomodoro-extend-last-clock breaks LOGBOOK drawer if it is collapsed. #26

Closed LeoUfimtsev closed 9 years ago

LeoUfimtsev commented 9 years ago

In this issue a new function was added: https://github.com/lolownia/org-pomodoro/issues/19

org-pomodoro-extend-last-clock

Now if if you customize org-clock-into-drawer and set it to clock into drawers always. Then if you start a pomodoro, when it ends, if your :LOGBOOK: is collapsed and you execute org-pomodoro-extend-last-clock, then it breaks the LOGBOOK. I.e the :END: tag is destroyed and things don't function properly any more.

I tried to fix it with something like:

(when (invisible-p (point)) (org-reveal)

But haven't been very successful thus far :-/

LeoUfimtsev commented 9 years ago

I hacked myself a little workaround that kinda works for the time being. It goes to the entry and expands the logbook drawer before calling the function. Unfortunately I lack the lisp knowledge to figure out how to fix it without manually expanding the drawer first.

(defun my/org-pomodoro-append-time () 
 "Append time to the previous pomodoro. The time added is from when you last finished the pomodoro till now"
 (interactive)

 ; WORKAROUND, function below is broken, to work around it we goto logbook and expand it.
 ;Move to current logbook
 (org-clock-goto)
 (search-forward ":LOGBOOK:")
 (org-cycle)

 (org-pomodoro-extend-last-clock)  ; BROKEN When using logdrawers. Awaiting fix: https://github.com/lolownia/org-pomodoro/issues/26
)
leoc commented 9 years ago

Awesome! I think that is the right way to fix this. Depending on the expected behavior I would add a save-excursion or save-window-excursion. I will add a fix this weekend.

LeoUfimtsev commented 9 years ago

:-)

leoc commented 9 years ago

Sorry, it took a while for me, to find a little time. Version 2.0.2 makes sure the LOGBOOK drawer is expanded.