Skip to content

Commit

Permalink
Fix: :children todo
Browse files Browse the repository at this point in the history
Fixes #75.  Thanks to Ben Leggett (@bleggett) for reporting.
  • Loading branch information
alphapapa committed Mar 15, 2019
1 parent fbf4f04 commit eaad119
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
3 changes: 2 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ These selectors take one argument alone, or multiple arguments in a list.

** 1.2-pre

Nothing yet.
*Fixed*
+ =:children todo= group selection ([[https://github.com/alphapapa/org-super-agenda/issues/75][#75]]). (Thanks to [[https://github.com/bleggett][Ben Leggett]].)

** 1.1

Expand Down
39 changes: 20 additions & 19 deletions org-super-agenda.el
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,26 @@ making it stretch across the screen."
(cl-defmacro org-super-agenda--map-children (&key form any)
"Return FORM mapped across child entries of entry at point, if it has any.
If ANY is non-nil, return as soon as FORM returns non-nil."
(declare (indent defun))
(org-with-gensyms (tree-start tree-end result all-results)
`(let ((,tree-start (point))
,tree-end ,all-results)
(when (org-goto-first-child)
(goto-char ,tree-start)
,(when any
`(save-excursion
(setq ,tree-end (org-end-of-subtree))))
(setq ,all-results (org-map-entries (lambda ()
(let ((,result ,form))
,(when any
`(when ,result
(setq org-map-continue-from ,tree-end)))
,result))
nil 'tree))
(if ,any
(--any (not (null it)) ,all-results)
,all-results)))))
(declare (indent defun)
(debug (":form" form [&optional ":any" sexp])))
(org-with-gensyms (tree-start result all-results region-beginning region-end)
`(save-excursion
(save-restriction
(let ((,tree-start (point))
,all-results)
(when (org-goto-first-child)
(narrow-to-region (point) (save-excursion
(goto-char ,tree-start)
(org-end-of-subtree)))
(goto-char (point-min))
(setq ,all-results
(cond (,any (cl-loop thereis ,form
while (outline-next-heading)))
(t (cl-loop collect ,form
while (outline-next-heading)))))
(if ,any
(--any (not (null it)) ,all-results)
,all-results)))))))

;;;; Support functions

Expand Down
21 changes: 12 additions & 9 deletions org-super-agenda.info
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,10 @@ File: README.info, Node: 12-pre, Next: 11, Up: Changelog
6.1 1.2-pre
===========

Nothing yet.
*Fixed*
• :children todo group selection (#75
(https://github.com/alphapapa/org-super-agenda/issues/75)).
(Thanks to Ben Leggett (https://github.com/bleggett).)


File: README.info, Node: 11, Next: 103, Prev: 12-pre, Up: Changelog
Expand Down Expand Up @@ -629,14 +632,14 @@ Node: Normal selectors12349
Node: Tips16980
Node: Changelog17831
Node: 12-pre18041
Node: 1118143
Node: 10319718
Node: 10219929
Node: 10120063
Node: 10020401
Node: Development20506
Node: Bugs20898
Node: Credits21537
Node: 1118306
Node: 10319881
Node: 10220092
Node: 10120226
Node: 10020564
Node: Development20669
Node: Bugs21061
Node: Credits21700

End Tag Table

Expand Down

0 comments on commit eaad119

Please sign in to comment.