Todo lists in TextPad

Usage tips, posted by users. No questions here please.

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
hillsc
Posts: 35
Joined: Thu Jun 19, 2003 2:00 pm

Todo lists in TextPad

Post by hillsc »

I spend a lot of time in TextPad and like to keep track of what I'm doing in a little "todo" file. (Switching to another program is a pain. I'm already in TextPad anyway!) Trouble is, every time I close and re-open the file, my special tab settings are lost.

Document Classes to the rescue!!! I don't know why I didn't think of this before. (Slaps forehead!) I created a new "todo" document class and added "*.todo" as the file type filter. Once I had a document class, I then went crazy on the customizing. It has its own syntax highlighting as well as special colors and tab settings. Here's what it looks like in action:

Image

There are three comment characters: ==, !, and ?. I use == for headings and ! to bring my attention to something. The ? comment (not shown above) is the secondary comment, and turns a section of text gray.

Here is the syntax definition file:

Code: Select all

PERL=1

[Syntax]
Namespace1 = 6
IgnoreCase = Yes
BracketChars = {}
OperatorChars =
CommentStart = ==
CommentEnd = ==
CommentStartAlt = ?
CommentEndAlt = ?
SingleComment = !
SingleCommentEsc = \
StringsSpanLines = No
StringStart = "
StringEnd = "
StringAlt = 
StringEsc = \

[Keywords 1]
in_progress
completed
on_hold
Tab stops are at 3, 70, and 80. The background color and font are changed so it looks drastically different from the normal files I'm editing.

Just passing this on in case someone else wants to give it a try. No rocket science involved. Just another example of why TextPad is so cool. :)

Charlie
sos
Posts: 9
Joined: Sun Jul 23, 2006 9:23 pm

Post by sos »

It's rocket science to some of us starting out. This is something I'd like to do but I don't know what the process is of setting it up. I like how you changed the text color in certain places to mark things. Most of all I want it to stay so when I reopen the file it's still marked.

Any help on how to go about doing this would be great and please remember I'm just a beginner. Thank you in advance for any help.
hillsc
Posts: 35
Joined: Thu Jun 19, 2003 2:00 pm

Post by hillsc »

There are two parts to it:

1. Create a new document class
2. Create a syntax definition file

The document class is based on file type. For me, I said any file that ends in .todo is a "Todo List File".

Part of defining the document class is specifying your colors, font, tabs, etc. These are all up to you, although I placed tab stops at 3, 70, and 80.

The syntax definition file is above. Copy and paste that to a file (e.g., todo.syn) and place it in your TextPad 4's system folder. When create (or modify) the document class, pick this file for syntax definition.

That's really all you have to do.

Good luck!
sos
Posts: 9
Joined: Sun Jul 23, 2006 9:23 pm

Post by sos »

I figured out how to make the document class and the syntax file. I have that all set but I can't figure out how to make the comments and so on apply to my txt files.

I tried making the files in class of the new doc class *. and *.TXT but that doesn't work. I tried changing the syntax file in text document class to mine but then it wont spell check for some reason though it does mark the text as I want. I don't understand that because the new document class has the spell checks all selected. I tried changing the text.syn to add in the things like what the brackets should be and what a comment is and alt comment. Still no luck.

Any help on how to get this new document class to effect my txt files would be a big help and really appreciated. Thanks so much.
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

It sounds as though you are trying to make hillsc's syntax highlighting part of the existing text document class. Is this what you want?

The original suggestion works by creating a new document class called todo, associated with files called, say anything.todo. It is this document class that has the syntax file, tab stops and colour options set.

There is nothing that stops you making text files (*.txt) behave as a todo list but it will apply to all text files once set up. The beauty of the original suggestion is that you retain the original text file document class properties.

Hope this helps.
sos
Posts: 9
Joined: Sun Jul 23, 2006 9:23 pm

Post by sos »

What I am trying to do is to have a way to mark certain places in a txt document permanently by having the text different color so it catches my eye. This seemed to be a way to do it that would be very effective..

I made a new document class and a new syntax file just as suggested here. However it does not effect my txt files. I'm trying to figure out how to get this to work. When it didn't work I changed things as mentioned in my previous post in order to try to get it to work and still had no luck so I put things back as they were after.

"it will apply to all text files once set up."

That is exactly what I want and exactly what is not happening. I may have done something wrong but I have no idea what. I'm not a programmer, just and every day person so I'm trying to figure it all out as best I can as I go. I understand that the syntax file effects the document class but at this point the new ones I made up are not effecting .txt files.
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

It sounds as though you want to amend the existing text document class rather than creating a new class. I had wrongly assumed that you were trying to implement the todo suggestion.

What you suggest should be possible and would be accomplished by associating a syntax file with the text document class. Start by searching your hard drive for an existing file, say perl.syn or c.syn, open that (in TextPad of course :D ) and then save it as (for example) text.syn. Copy the text from hillsc's example and then edit the list of keywords under [keywords 1] to include whatever you wish to be highlighted.

To make the highlighting active you need to open TextPad preferences, expand the document classes, go to the syntax option, enable syntax highlighting and select the new syn file you have created. The actual colours displayed for keywords are also set within the document class. Apologies that I can not be too specific in this paragraph - away from Windows at the moment :D

Hope this helps.
sos
Posts: 9
Joined: Sun Jul 23, 2006 9:23 pm

Post by sos »

I don't know if you read my above statement with what different changes I tried but I did this. I also tried a few other things as listed which did not work.
sos wrote:I tried making the files in class of the new doc class *. and *.TXT but that doesn't work. I tried changing the syntax file in text document class to mine but then it wont spell check for some reason though it does mark the text as I want. I don't understand that because the new document class has the spell checks all selected. I tried changing the text.syn to add in the things like what the brackets should be and what a comment is and alt comment. Still no luck.
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

Did you modify a text.syn file provided with TextPad? The one on my machine has the following text:
WARNING: Do not attempt to add keywords to this file. They will be ignored, because it starts with "TEXT=1". You should use one of the other syntax definition files as a starting point.
When I used one based upon C, the keywords I had listed were highlighted correctly.

Hope this helps.
sos
Posts: 9
Joined: Sun Jul 23, 2006 9:23 pm

Post by sos »

I didn't add keywords to this file. I simply changed this part only in the "TEXT=1" syntax file thinking that would be enough to mark some color change but it didn't work.

BracketChars = []
CommentStart = ==
CommentEnd = ==
CommentStartAlt = --
CommentEndAlt = --

I also changed the colors to the ones I wanted in the text document class itself for the brackets and comments.
When I used one based upon C, the keywords I had listed were highlighted correctly.
How do I get one based on C and one of what? Are you meaning the text.syn file? If so how do I change that to make it C? As I said I'm not a programmer so my knowledge is limited.

I would also like to understand better how something like .todo class works to effect only certain documents. Would you then just save a particulate document as "wednesday.todo" or how do you mark those files so they trigger that document class to be effected?

Sorry I hope that's not to confusing. Thank you.
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

I don't think you need to make it C specifically, the important thing is that is is not TEXT. If you look at the syntax file given in the first post you will see it begins as follows.

Code: Select all

PERL=1
[Syntax]
Namespace1 = 6
IgnoreCase = Yes
If you find your text.syn file and edit the opening line to read PERL=1 as above this should allow syntax highlighting to work correctly.
sos
Posts: 9
Joined: Sun Jul 23, 2006 9:23 pm

Post by sos »

I tried but then it wont spell check for some reason though it does mark the text as I want. I don't understand that because the new document class has the spell checks all selected they are also checked as the default document class. When I change it back to TEXT=1 the spell check works again and the markings don't. So it seems like I can either keep the spell check or the marked text but not both.
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

You're right. The following is taken from the help file.
When syntax highlighting is enabled, only comments, strings and plain text are spell checked. Checking of comments and strings can be individually enabled for each document class on the document class pages of the Properties dialog box.
sos
Posts: 9
Joined: Sun Jul 23, 2006 9:23 pm

Post by sos »

I would also like to understand better how something like .todo class works to effect only certain documents. Would you then just save a particulate document as "wednesday.todo" or how do you mark those files so they trigger that document class to be effected?
So back to my second question of how a todo class works to get only certain doccuments to use syntax highlighting. Anyone?
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

The main thing you have to do is associate a document class (todo) with a file extension (.todo). That is the key mechanism that enables TextPad to associate a specific document with a class.

If you create that definition within the document classes then only wednesday.todo or *.todo will trigger the highlighting.
Post Reply