Altering Line Endings

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Altering Line Endings

Rob Brackett-3
I recently spent some time working on a plugin (https://github.com/Mr0grog/editorconfig-textmate) to support EditorConfig (http://editorconfig.org).

One of EditorConfig's features is the ability to specify line endings to use with a property named "end_of_line". Looking into TextMate, OakDocument has -lineEnding and -setLineEnding. Are these the right methods to call? What should I pass to them? (Calling -lineEnding always just gave me back nil whenever I tried it.)

I know all the work is happening on TM2 right now (this is currently written to work against TM1), but I'd like to get it working for both versions.

Thanks for any help!

-Rob

_______________________________________________
textmate-plugins mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate-plugins
Reply | Threaded
Open this post in threaded view
|

Re: Altering Line Endings

Allan Odgaard-4
On Jul 26, 2012, at 12:12 AM, Rob Brackett <[hidden email]> wrote:

> I recently spent some time working on a plugin (https://github.com/Mr0grog/editorconfig-textmate) to support EditorConfig (http://editorconfig.org).

Neat, I didn’t know about this, looks very similar to the .tm_properties system we have in 2.0.

> […] Looking into TextMate, OakDocument has -lineEnding and -setLineEnding. Are these the right methods to call? What should I pass to them? (Calling -lineEnding always just gave me back nil whenever I tried it.)

The lineEnding property is a C enumeration:

    enum line_ending_t { kLF = 0, kCR, kCRLF };

So you should get back 0, 1, or 2 back. Normally 0 for kLF.

> I know all the work is happening on TM2 right now (this is currently written to work against TM1), but I'd like to get it working for both versions.

For 2.0 the internals are completely different, but it sounds like this should just be added to the current settings stuff (that already reads .tm_properties files per folder, where a line ending setting do exist).

If you haven’t heard yet, the source is now available¹, which should make it easier, should you wish to look into this.

Kind regards Allan

¹ https://github.com/textmate/textmate

_______________________________________________
textmate-plugins mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate-plugins
Reply | Threaded
Open this post in threaded view
|

Re: Altering Line Endings

Rob Brackett-3

On Aug 9, 2012, at 2:53 PM, Allan Odgaard wrote:

> On Jul 26, 2012, at 12:12 AM, Rob Brackett <[hidden email]> wrote:
>
>> I recently spent some time working on a plugin (https://github.com/Mr0grog/editorconfig-textmate) to support EditorConfig (http://editorconfig.org).
>
> Neat, I didn’t know about this, looks very similar to the .tm_properties system we have in 2.0.

Yeah, I noticed the same thing after digging around a bit—at first I thought things were hard-coded in TM2 until I saw a post about tm_properties :)

It would be awesome if TM2 added native support for .editorconfig!

>
>> […] Looking into TextMate, OakDocument has -lineEnding and -setLineEnding. Are these the right methods to call? What should I pass to them? (Calling -lineEnding always just gave me back nil whenever I tried it.)
>
> The lineEnding property is a C enumeration:
>
>    enum line_ending_t { kLF = 0, kCR, kCRLF };
>
> So you should get back 0, 1, or 2 back. Normally 0 for kLF.

Awesome, that should make this pretty straightforward.

>
>> I know all the work is happening on TM2 right now (this is currently written to work against TM1), but I'd like to get it working for both versions.
>
> For 2.0 the internals are completely different, but it sounds like this should just be added to the current settings stuff (that already reads .tm_properties files per folder, where a line ending setting do exist).
>
> If you haven’t heard yet, the source is now available¹, which should make it easier, should you wish to look into this.

Just saw the notice about open-sourcing it this morning. I did actually get TM2 working a few days after I sent this original e-mail; I suppose I should have sent a follow-up here. Having the source open will definitely let me see if there's a better way than what I'm currently doing, though.

Thanks!

-Rob

_______________________________________________
textmate-plugins mailing list
[hidden email]
http://lists.macromates.com/listinfo/textmate-plugins