Page 1 of 1

Document Class File Specifiers

Posted: Wed Oct 15, 2008 5:57 pm
by tasbury
I have a document class for makefiles, specified to makefile, makefile.*, and *.mak. Makefile.mak gets syntax highlighting, but Makefile does not. It would be handy if more general file specifiers than *.mak worked.

Also, I am unable to find anywhere which document class is currently in effect, or any way to force the issue should I choose, and both of those would be useful as well.

Thank you.

Posted: Wed Oct 15, 2008 8:19 pm
by MudGuard
Try

Code: Select all

Makefile.

Posted: Thu Oct 16, 2008 1:40 am
by tasbury
Yes, the Makefile document class I have defines file specifiers for Makefile and *.mak. "AnyFileName.mak" is picked up, "Makefile" is not.

I'm using gnumake.syn, but of course the file specification is in under
"Configure/Preferences/Document Classes". The "how to customize document properties" help page indicates that filenames should work, but I can't get them to, so perhaps I should file this as a bug report...?

I have (since this morning) realized that I can get to document properties by right-clicking on the tab, and going to "syntax".

Thank you, anyone, for any light you can shine here.

Posted: Thu Oct 16, 2008 6:22 pm
by MudGuard
not

Code: Select all

Makefile
but

Code: Select all

Makefile.

Posted: Thu Oct 16, 2008 6:36 pm
by tasbury
I assume you're talking about the "files in class" column in the "Document Classes" branch of the Preferences dialog. Tried specifying "Makefile." instead of "Makefile". Made no difference.

The file specifiers I am using are Makefile.*, *.mak, Makefile., and *.mkf.

A file named "Makefile.lkj", for instance, gets tagged as a makefile, and highlighting is turned on, whereas "Makefile" still does not.

Thank you, though.

Posted: Thu Oct 16, 2008 9:33 pm
by ben_josephs
TextPad sorts the document classes alphabetically, and searches them backwards for a wildcard expression that matches the name of a file being opened. So if, for example, you have a class called Text, and it includes the file spec "*.", and if you have a class called Makefile, and it includes the file spec "Makefile", then if you open a file called Makefile, TextPad will match it with the file spec in the Text class and never notice that it also matches the file spec in the Makefile class.

Solution: put the makefile class near or at the end of the list, for example, by naming it ~Makefile.

Posted: Fri Oct 17, 2008 7:32 pm
by tasbury
Thank you! That makes perfect sense, but I still can't get it to work. I defined "zzMakefile", still uses gnumake.syn, files in class still Makefile., Makefile.*, *.mak, *.mkf. Makefile.mak still gets highlit, Makefile does not.
Changed zzMakefile class to only pick up Makefile., Makefile class to pick up Makefile.*, *.mak, *.mkf. No help.

How, just out of curiousity, do I *delete* document classes?

Posted: Fri Oct 17, 2008 10:09 pm
by ben_josephs
Take the dot off the end of the file spec: not
Makefile.
but
Makefile
.

There is a note in Configure | Preferences | Document Classes:
Note that this list of classes can only be modified when no documents are open.
Make sure that no other instances of TextPad are open either, so that you don't overwrite the new settings with the previous ones.

Posted: Sat Oct 18, 2008 3:16 pm
by tasbury
MudGuard (several posts ago) said *to* use the dot. I have tried both and not seen any difference.

I have also closed and re-opened all instances of textpad and the document classes are as I have set them.

Let's face it, setting a filename without extension as a class member in a document class just plain does not work.

I thank you all for your help.

Oh, and if anyone is curious, as far as I can tell the only way to remove junk document classes is to go to

HKCU\Software\Helios\TextPad 5\Document Classes\

in the registry, and manually remove the ones you don't like.

Thanks again.

Posted: Sat Oct 18, 2008 4:12 pm
by ben_josephs
tasbury wrote:Let's face it, setting a filename without extension as a class member in a document class just plain does not work.
It does here.
tasbury wrote:as far as I can tell the only way to remove junk document classes is to go to

HKCU\Software\Helios\TextPad 5\Document Classes\

in the registry, and manually remove the ones you don't like.
It works here as I described above.