statatmbundle / Stata.tmbundle

A TextMate bundle providing support for the Stata statistical software package
MIT License
4 stars 5 forks source link

Allow users to customize do/ado-file headers #2

Open pschumm opened 11 years ago

pschumm commented 11 years ago

Users are likely to have very different preferences for the headers of their do/ado-files, and it would be nice if we could accommodate this via a user-configurable setting. I don't currently know the best way to do that.

briatte commented 11 years ago

A minimal way to do this would be to replace "Author" in the current header with the value of the TM_FULLNAME variable that the user can set in his TextMate preferences.

pschumm commented 11 years ago

Indeed, though it would be nice to have somewhat more flexibility than this if possible.

briatte commented 11 years ago

A solution might be to do as latex.tmbundle and have a preferences window, where you might be able to record a user-defined header (as well as other things, like workflow-specific settings). But if you take a look at the code from latex.tmbundle, it seems like a lot of work.

pschumm commented 11 years ago

Actually I just looked at that, and it seems fairly straightforward (the TODO bundle also provides a good example, though I'd personally prefer to work in Python rather than Ruby). The basic approach seems to be to call $DIALOG with a custom nib file. Help is available via ctrl-R when on a line containing

"$DIALOG" help

in a TextMate window. The result can then be written to

com.macromates.textmate.plist

and subsequently queried with tm_query.

That said, I wonder whether this is in fact the best way to handle automatic do/ado-file headers. Should we instead be handling these as templates that the user can create/modify?

briatte commented 11 years ago

I believe that heavy coders will already have their favourite header saved as a code snippet. Coding one into the bundle would rather be, IMHO, a way to help users who are not using such a system -- as your current do/ado header command does.