Nick Dokos <ndo...@gmail.com> writes: > Mike McLean <mike.mcl...@pobox.com> writes: > >> Hello >> >> In the last few days I started getting an error when moving tasks to the >> DONE state. >> >> I have ~(setq org-clock-out-when-done t)~ in my Emacs configuration. >> >> I get the following back trace when I mark a task as done: >> >> Debugger entered--Lisp error: (void-variable org-state) >> (member org-state org-done-keywords) >> ... >> org-clock-out-if-current() >> run-hooks(org-after-todo-state-change-hook) >> ... >> org-todo(nil) > > This is probably a lexical binding problem: org-state is supposed to be > dynamically bound by org-todo and then used by org-clock-out-if-current, > but it seems that the communication is lost. > > I'm not sure what the solution is (I haven't really followed the > upstream discussion), but I wonder if adding > > (defvar org-state) > > in org.el, just before the > > (defun org-todo ... > > line is enough to resolve the problem (basically letting org-todo know > that org-state is dynamically bound). > > Untested and possibly wrong.
Manually tested your suggestion and it fixes the issue of '(void-variable org-state)'. Technically I'm not sure what a reliable fix looks like. There is e.g. already the line (defvar org-state) ;; dynamically scoped into this function in org-clock.el. Best regards, -- Marco Wahl GPG: 0x49010A040A3AE6F2