On 2015-12-16, at 02:54, Nick Dokos <ndo...@gmail.com> wrote:
> Marcin Borkowski <mb...@mbork.pl> writes: > >> On 2015-12-14, at 21:48, Nick Dokos <ndo...@gmail.com> wrote: >> >>> Marcin Borkowski <mb...@mbork.pl> writes: >>> >>>>> On 2015-12-12, at 09:53, Nicolas Goaziou <m...@nicolasgoaziou.fr> wrote: >>>>> >>>>>> You can use a dedicated function in `org-agenda-skip-function' for that >>>>>> (e.g., ignore task if one of its parents is a done task). >>>> >>>> OK, so it doesn't work (probably because I'm doing something wrong...) >>>> >>>> I did this: >>>> >>>> (defun mbork/org-agenda-skip-if-parent-done () >>>> "Return t if any of the parents of the current entry is a DONE >>>> item." >>>> (save-excursion >>>> (catch 'done >>>> (while (org-up-heading-safe) >>>> (if (org-entry-is-done-p) >>>> (throw 'done t)))))) >>>> >>>> (setq org-agenda-custom-commands >>>> '(("n" >>>> "Agenda and TODOs" >>>> ((agenda "") >>>> (alltodo "" ((org-agenda-skip-function >>>> #'mbork/org-agenda-skip-if-parent-done))))))) >>>> >>>> and I see this: >>>> >>>> and: Wrong type argument: integer-or-marker-p, t >>>> >>>> What may be the problem? How do I even debug this? >>>> >>> >>> Are you testing it with emacs -q -l /path/to/min/org-init.el? >>> If not, you probably should: I don't get any errors with the >>> stuff above in my minimal org file, which leads me to suspect >>> it's something in (the rest of) your configuration. >> >> Strange. I have the same error even with emacs -q, with minimal Org >> config - the above function and one simple agenda file, containing this: >> >> * DONE done >> ** TODO todo >> >> Org-mode version 8.2.10 (release_8.2.10 @ >> /usr/local/share/emacs/25.0.50/lisp/org/) >> >> Any hints? >> >> Here's the debugger output: >> >> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p t) >> goto-char(t) >> (and (setq to (or (org-agenda-skip-eval org-agenda-skip-function-global) >> (org-agenda-skip-eval org-agenda-skip-function))) (goto-char to)) > > Not so strange: I probably did not hit the (throw 'done t) in your > function. The spec says that the function has to return a position > in the buffer: > > ,---- > | org-agenda-skip-function is a variable defined in ‘org-agenda.el’. > | Its value is nil > | > | This variable may be risky if used as a file-local variable. > | > | Documentation: > | Function to be called at each match during agenda construction. > | If this function returns nil, the current match should not be skipped. > | Otherwise, the function must return a position from where the search > | should be continued. > `---- Stupid me. Thanks. -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University