branch: externals/taxy commit 2e88d43710d29d28757cd0e14aa26adcacdead1c Author: Adam Porter <a...@alphapapa.net> Commit: Adam Porter <a...@alphapapa.net>
Fix: (taxy-fill) Or, apply object to root taxy When used with taxy-take-keyed*, this allows the root taxy to have its :take specified, rather than having to use a sub-taxy as the first to have its :take specified. --- README.org | 1 + taxy.el | 29 +++++++++++++++++------------ taxy.info | 12 +++++++----- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/README.org b/README.org index 1537329..ca60ab2 100644 --- a/README.org +++ b/README.org @@ -720,6 +720,7 @@ Note that =taxy-magit-section.el= is not installed with the =taxy= package by de *** Fixes + ~taxy-magit-section~'s ~insert-object~ function. ++ ~taxy-fill~ now applies objects to the root taxy if no sub-taxys take them. ** 0.1 diff --git a/taxy.el b/taxy.el index 19279f7..b6755ac 100644 --- a/taxy.el +++ b/taxy.el @@ -70,18 +70,23 @@ (defun taxy-fill (objects taxy) "Fill TAXY with OBJECTS according to its definition." (cl-labels ((apply-object (object taxy) - (cl-loop for taxy in (taxy-taxys taxy) - when (funcall (taxy-predicate taxy) object) - do (progn - (if (taxy-take taxy) - (funcall (taxy-take taxy) object taxy) - (if (taxy-taxys taxy) - (or (apply-object object taxy) - (push object (taxy-objects taxy))) - (push object (taxy-objects taxy)))) - (setf object (funcall (taxy-then taxy) object))) - unless object return t - finally return nil))) + (or (cl-loop for taxy in (taxy-taxys taxy) + when (funcall (taxy-predicate taxy) object) + do (progn + (if (taxy-take taxy) + (funcall (taxy-take taxy) object taxy) + (if (taxy-taxys taxy) + (or (apply-object object taxy) + (push object (taxy-objects taxy))) + (push object (taxy-objects taxy)))) + (setf object (funcall (taxy-then taxy) object))) + unless object return t + finally return nil) + ;; No sub-taxys took the object: add it to this taxy. + (when (funcall (taxy-predicate taxy) object) + (if (taxy-take taxy) + (funcall (taxy-take taxy) object taxy) + (push object (taxy-objects taxy))))))) (dolist (object objects taxy) (apply-object object taxy)))) diff --git a/taxy.info b/taxy.info index a21f37e..abbb7f6 100644 --- a/taxy.info +++ b/taxy.info @@ -823,6 +823,8 @@ File: README.info, Node: Fixes, Up: 02-pre ----------- • ‘taxy-magit-section’’s ‘insert-object’ function. + • ‘taxy-fill’ now applies objects to the root taxy if no sub-taxys + take them. File: README.info, Node: 01, Prev: 02-pre, Up: Changelog @@ -895,11 +897,11 @@ Node: Magit section29575 Node: Changelog30176 Node: 02-pre30326 Node: Fixes30434 -Node: 0130574 -Node: Development30677 -Node: Copyright assignment30883 -Node: Credits31482 -Node: License31672 +Node: 0130666 +Node: Development30769 +Node: Copyright assignment30975 +Node: Credits31574 +Node: License31764 End Tag Table