Thank you and a minor suggestion

@jessegrosjean I just wanted to thank you for the software you’ve written. TaskPaper and FoldingText have now become vitality important tools for my workflow due to their ability to let me work with plain text. I wanted to let you know how much I appreciate the effort you put into this including the help in the forums. I really think I owe you more money based on the benefit I’ve received.

I wanted to mention what is perhaps my biggest request of TaskPaper. I’ve realized that I can’t accomplish all the tasks that flow in. This means some will just not get done. This means it is critical to my workflow to sort tasks and decide which ones will be accomplished and which ones will be cancelled. I wrote a script to sort by priority but I find myself wanting more sorting options. I’d like to sort by the value of one tag, then within that sorted list sort by value of another tag, etc. I’d like to sort by date too. I can certainly write scripts to do this (and probably will) but I would love to be able to just save a search and get this rather than having to actually modify my list with a script.

Anyway, thanks again. I hope TP and FT will be around for a long time to come!

I think I understand what you mean right up to…

Can you explain what you mean a bit more? Generally “searches” are about finding and filtering, they don’t define any search order. Maybe a few examples of what you would like?

Can you explain what you mean a bit more? Generally “searches” are about finding and filtering, they don’t define any search order. Maybe a few examples of what you would like?

Yeah, I hear you. In the parlance of formal languages “search” doesn’t include an ordering per se. OTOH, a google “search” would be useless without the ability to rank and sort the results. I’m after a mechanism by which I can see a sorted query. Perhaps this is broken down into three steps:

  1. perform a query
  2. using a ranking function of some kind, sort the results
  3. display the results like I can do with a “saved search.” That is, don’t actually modify the document, just show me the results

NOTE: perhaps step 3 is optional. Maybe the solution would be to just actually modify the document. This is basically what I do in my homemade scripts.

So perhaps this is like “augmented search” or whatever name we’d like to ascribe to the process. So maybe, rather than thinking about this as modifying the searching mechanism, maybe it’s an add-on framework or something where syntactically you specify a search query and a ranking/sorting function (though I’m not sure how the syntax would work precisely yet).

If others are interested I could think more carefully about syntactically how it might look, though I’m no expert in formal language theory.

The core of my request is that I need to budget my time according to a cost/benefit mechanism. This requires the ability to quickly see my tasks in an order that maximizes my benefit to cost ratio. TP currently offers no way for me to do that.

If I am following this, I “think” you are asking for results similar to what is in a database search or a finder window with sorted columns?

The only answer that I can think of is if Jessie put some sort of conditional into his TP3 search engine. Not aware of that being in TP3 now but I could have missed it?

(Possibly) on a side note, I started using styling tags. This allows me to get the formatting the way I like it because I am easily visually overwhelmed if I have lots of things to look at all at once. On that thought, perhaps you could write up a list of tags that fit your subsets more accurately and use those tags in your advanced searches? You can write out and save those searches so once you know how to find what you are looking for, you just have to click on the saved search name on the sidebar. I haven’t really thought that through, just to mention it if it helps.

Yeah, those analogies work (though I had originally thought of it in terms of an excel spreadsheet where you can sort by a column, then subsequently within those results by another column, etc.)

Yeah, I have the tags sorted out. And I can search on them. But results just mirror what is in the document. As an example, suppose you have a saved search like this:

Due <= 1 Week @search(@due <= [d] +1 week except @done)

This will show you the not-done tasks that are due within the next week. BUT, if a task due on 2016-09-05 comes before (in the document) a task due 2016-09-04, the search results will display you to them in that same order. There is no way within a search query to modify the ordering of the results. This means the underlying document must be sorted for TP’s searches to reflect that ordering.

What would be awesome would be to have something like this:

Due <= 1 Week @search(@due <= [d] +1 week except @done sort @due = [d])

Indicating that the saved search should subsequently be sorted by date based on the value of the @due tag. (of course again I don’t know the right syntax to make this work well yet)

Let’s support I have two tags: @effort() and @priority(). I want to be able to write a saved search:

Highest Priority @search(@priority and @effort and not @done sort @priority and @effort)

This executes the query of “@priority and @effort not @done” then sorts that result by the value in “@priority and @effort” where a numerical sort is the default. So the “saved search,” which is really now a “saved sorted search,” shows me the sorted results of the query.

I hope that makes sense. See my post here which is a hack solution to my problem.

Ok, I see your goal now, but I don’t expect TaskPaper to add this sort of behavior. I think it’s better done with scripts. By design TaskPaper’s model is that of a text editor, and it doesn’t support sorted views of that model. You can of course sort the underlying model (as you are doing with your existing scripts), but you can’t do temporary sorts. Attaching the sort to a search would be quite problematic because then searching a document could also reorder its contents. I think much better to just implement as a script.

Or after you’ve done a few scripts I could also imaging adding a “sort” command to TaskPaper. But it would be a separate command that you invoke, not a side effect of doing a search.

1 Like

Or after you’ve done a few scripts I could also imaging adding a “sort” command to TaskPaper. But it would be a separate command that you invoke, not a side effect of doing a search.

I’d love to have a “sort” command in TaskPaper that is a separate command you invoke. That would be great!

1 Like

Here’s a quick script to sort the children of the current item. Or if the current item doesn’t have any children it will then sort the current item with it’s siblings. In TaskPaper 3.5 you can save this into TaskPaper’s scripts folder, and once you do that it will show up in TaskPaper’s commands Palette.

function ToggleFoldTaskPaperContextScript(editor, options) {
  var selection = editor.selection
  if (parent = selection.startItem) {
    if (!parent.firstChild) {
      parent = parent.parent
    }
    editor.outline.groupUndoAndChanges(function () {
      var children = parent.children
      parent.removeChildren(children)
      children.sort(function (a, b) {
        return a.bodyString.localeCompare(b.bodyString)
      })
      parent.appendChildren(children)      
    })
  }
}

Application("TaskPaper").documents[0].evaluate({
  script: ToggleFoldTaskPaperContextScript.toString()
})

Thanks so much Jesse. This is really helpful. I haven’t yet updated to the newest TaskPaper mostly because I haven’t had time and was uncertain whether or not there would be a time investment in moving to the new updated app. I have a pretty well oiled machine right now and want the new features but don’t want everything to break.

But when I get to this I’ll update this thread with how it went. Thanks again.

1 Like