Search and Sort


#1

UPDATE for this question, through trial and error, I found a solution for creating and saving a search. What I still ask for assistance with is finding a method to sort my search results. I would like to have the search results as stated below, sorted by each found tag. This is about a priority system and I would like to see this highest priority sort at the top of the find, then the next, etc. I don’t know if this is possible in TaskPaper or not. If it is, I would love to know how to make it happen. If not, I hope that this can be taken as suggestion.

My OP: I apologize for my density this morning. I have not used searches in a long time and I am not quite getting it. I have tested various things in the search bar from the following page: https://guide.taskpaper.com/reference/searches/

I know I can save searches to the sidebar in TaskPaper. This is what I am trying to do: I have a series of tags that I use as prioritization of things I want to get done. Using four iterations of the same tag these would be; @-active-1st, @-active-2nd, @-active-3rd, @-active

I can easily key up and down the sidebar to see each group. I was thinking it might be useful if I could create a search that would both include the above tagged items and if possible, to sort them in the order shown in my listing of them above.

Trying:

>// @-active [Works for top level @atcive tags only, ignores all @active-1st, 2nd, 3rd active tags ]
>// @-active-  [No Results ]
>// (@-active and @-active-)  [No Results ]
>// @-active and @-active-  [No Results ]
>// (@-active) and (@-active-)  [No Results ]
>// @-active*  [Tried using asterix as “any” modifier with No Results ]
>// @-active!  [Tried using exclamation mark as escape or for “any” modifier with No Results ]

FWIW, the tags all begin with a dash because I like them sorted to the top of the tags section on the sidebar and, as yet, there is no way to actually rearrange the tags in the sidebar.

Update:

This works:

// @-active or @-active-1st or @-active-2nd or @-active-3rd

I had to use the OR modifier and spell them all out without a paren or an “any” modifier (as in, any find of “active” and "-1st, etc.).

Would still love to see this search results sorted. Any chance of this happening?


#2

My memory is not what it should, but I remember a discussion on this topic somewhere in the forum a year or two ago. I think that unless there are major changes in the taskpaper engine, this is not currently possible. The good news is that Jesse is planing on redoing Taskpaper using the WriteRoom engine he is working on right now. Maybe we can remind him and put our wish list for the upcoming version :slight_smile:

So @jessegrosjean, can we add that to the “maybe” wish list? That and the ability of doing more with the results (Like hiding some parents, styling, etc. )


#3

Okay, is that what you want to do? I can try to help you getting the script to sort your results.

Now… Is there any reason why you are doing something like @active, @active-first, ... instead of something that would be a lot easier to sort like, @active(1), @active(2), etc...?

If you decide to go with my suggestion, I think that I can modify the sorting script in the other page in about 5 mins. Just change the script so that it becomes active instead of priority


#4

I would generally suggest using tag values, i.e., @active(1), @active(2), @active(3), etc. Then you can search for them using numeric compare:

@active >=[n] 2
@active  <[n] 3

etc.

I think this approach is more flexible than using just different tag names with the same prefix.


#5

Thanks for the tips on the naming guys but, as convoluted as it sounds I have it the way I have it for a reason. Although, it hadn’t occurred to me that I could put parens in a tag with a number in them.

It probably won’t make sense to too many here but my brain has trouble with sequencing tasks. Ironic I know as I am intelligent enough to have figured this out but I still have to do it. It’s the same thing with priority 1, priority 2, etc.

This is just me making an end run around that little challenge I have. I need to trick my brain sometimes with word pictures. 1st, 2nd, and 3rd makes more sense to me than (1), (2), and (3).

As to the search code that I finally went with, isn’t there a character I could have used to search any character that I could have also used? something like “@active” and (modifier symbol here) for any matches to “@active” and any other character?

And yes, it would be very nice if Jessie allowed custom sorting in his new build.


#6

Yes, you can use regular expressions in your search. Again, I just know enough to be dangerous, but if you tell me exactly what you are thinking on, I can help you. Here is an example of a simple regular expression that would simplify your search quite a bit.

matches "@active"

If you only have three possibilities (1st, 2nd, 3rd), here is another example that is kind of self-explanatory.

matches "@active" except matches "@active-2"


#7

Thanks. I need to sit down and put this together some day for the way my brain works.

Your example;
matches “@-active”
… includes all the actual searches under “Searches”, that is to say, the search strings themselves. How do I exclude any result of the literal search strings under the Project “Searches” (Assuming it is a project)?

Curiously, my earlier example;
@-active-1st or @-active-2nd or @-active-3rd or @-active-4th
… does not include searches as projects.

This doesn’t do it:
matches “@-active” except matches “Searches”


#8

I’m still not sure about reordering/hiding parents, it makes editing just too confusing I think.

I am considering adding a new embedded WebView that plugins can use and that has access to the editor model API. The goal would be a place for open ended UI that doesn’t fit well into the current text editor.

Still in brainstorm stage, but at the moment I’m thinking it would be an optional sidebar/inspector view to the right of the editor. Since it would be an embedded WebView plugins could build up whatever UI they wanted there and keep it synced with the underlying document model.

I think it would be a really good place for summary type information. And might be a better place to build the more complex systems that people are now using search for. So for example you could present a custom filtered view of the document in that view, and then when you click on some UI there you could jump to the proper location in the text editor view.


#9

I am finding that the concept of Projects as a hierarchy is causing more problems then solutions. The most important thing I need to focus on are my tasks. And in my tasks, the most important thing is to set and keep priorities associated with them.

I won’t go as far as to say that creating a project is irrelevant, but just today I have started testing putting in a tag for each project. That is, one with the same name as the existing project. I also created a new project named “Tasks” to put all my tasks in.

This finally allows me to sort my tasks in one space as I want to see them (without all those annoying Project headers). Because I now have tags associated with project names on each task, I can also quickly click on that tag and see where I am on that project. Assuming I also add the same tags to my existing project pieces (if not a task) I should still be able to stay in touch with my projects.

But again, it all comes down to the tasks. And now, the tasks are all in one place and on the same level.


#10

Wow. It sounds too good to be true.


#11

Try this,

matches "@-active" except (@search union archive///*)

I think I have a good grasp of the query language used by TaskPaper, but not with regex. That is why I tend to use regex more sparingly.


#12

Sounds good. The TaskPaper mode for Emacs uses very similar concept for Agenda view.


#13

Wow, very arcane, but useful, thanks. Meaning, I would not have come up with that as a guess — ever. One thing that I would like to see in the FAQs, and I will start making note of myself regardless, is to see in one place a primer for what is needed to customize TaskPaper. There is a tutorial on this site of sorts. It gives some examples in context. But it doesn’t really spell out the choices for the parts of the structure or syntax. This ends up with a good bit of trial and error.

I don’t know RegEx very well myself but I know there are primers available for RegEx. If I capture or link one of those for future reference then the next time I am curious about a custom or a complex search I will know what to study. Thanks for sharing this.


#14

I have tried to understand Emacs and so far, I cannot. Lots of YouTube tutorials start talking about it’s language, how to program it so save a file, move a cursor, etc. But so far I have not see anyone just tell me what it is and what it can do - for me?

It’s called an editor and you said it can emulate TaskPaper on other platforms. So I assume it is a text based engine similar to … BBEdit? Not the same necessarily but, is this the idea here? I see all these examples of code but, what does it look like in actual use? For example, “here is a new Emacs document, here is what starting with a letter template looks like. And now, here are some things I can actually do in real time using Emacs” (for my writing).

I hope I am being clear? I just don’t quite grasp what it is or why I would use it? Since I do not comprehend this, talk of how a script in Emacs could enhance my TaskPaper use just flies over my head.

If you have any links for good tutorials about using Emacs that show what I am talking about, I would love to see them. Color me, curious but confounded.

Thanks.

ADDED: This is a good introduction to something that interests me, using something called Org-mode. Emacs Org-mode - a system for note-taking and project planning. I think this is worth my giving it a try. They use a term “agenda view” that creates a flat file of all the tasks I want to see no matter how buried they are in other levels of other items. This is what I was trying to say to Jessie and, I think what Jessie is now considering in his recent statement about creating a custom view in a future version.


#15

Emacs is a text editor like e.g., BBedit, Vim, SublimeText, or Atom. Additionally, implementations of Emacs typically feature a dialect of the Lisp programming language that provides a deep extension capability, allowing users and developers to write new commands and applications for the editor. (like e.g., Org mode).

You don’t need to know Lisp programming to be able to use Emacs for writing of texts and code.

I think the Practical Emacs Tutorial is a good starting point.

Actually I borrowed the concept of agenda view from the Org mode, though the implementation is a bit different.

The TaskPaper mode for Emacs is hosted on GitHub. Full documentation is available there.

To start using the TaskPaper mode you need install GNU Emacs first. Then download the code from GitHub and follow the installation instructions in README.md. Now you can start to use it.

How to use the Agenda view is described in README.md in “Multi-Document Support and Agenda View” section.


#16

Hey @mylevelbest,

you can also take a look at my other post about agenda mode: