I use top level projects for grouping (areas of focus). But in todays view (filter @due and @today tasks) I’d like to hide those top level projects (parent groups). Is there a way to do this?
The scripting interface would allow us to hide top-level items with:
editor.outline.root.children.forEach(
x => editor.forceHidden(x, true)
);
There may, however be an aspect of it which I am misunderstanding – I had expected the second argument of forceHidden
to yield a concealed subtree if true
(so that an application of forceDisplayed
to the //@due or @today
matches could then bring out the stars after twilight).
I haven’t yet managed however, to get that second argument of forceHidden
to affect the visibility of descendants.
Perhaps Jesse can spot what it is that I am overlooking ?
Another approach might be this - using a general blackout filter (except //*
), and then forcing display of the matches for an itemPath supplied to withOptions
(scroll to select and copy all code, down to the line after return main();
)
(() => {
'use strict';
// main :: IO ()
const main = () => {
const ds = Application('TaskPaper').documents;
return 0 < ds.length ? (
ds.at(0).evaluate({
script: tp3Context.toString(),
withOptions: {
itemPath: '//@due or @today'
}
})
) : 'No documents open in TaskPaper'
}
// ----------------- TASKPAPER CONTEXT -----------------
const tp3Context = (editor, options) => {
editor.itemPathFilter = 'except //*';
editor.outline.evaluateItemPath(
options.itemPath
).forEach(
x => editor.forceDisplayed(x, false)
);
return options.itemPath;
};
return main();
})();
Wow, excellent! Thanks! Will try out when I‘m at my desk.