Home Download Buy Blog Forum Support

sublime_plugin.EventListener.on_post_save API

sublime_plugin.EventListener.on_post_save API

Postby phillip.koebbe on Tue Dec 20, 2011 5:09 pm

I've been evaluating Sublime Text 2 for the past week(ish) and am pretty happy with what I've encountered. I'm currently trying to get syntax coloring working how I'd like by using this

https://gist.github.com/1497794

My current problem is when creating a new file. Once it is saved, the script gets executed and the message that the syntax was set gets printed in the console, but the syntax is then changed by something in Sublime after the on_post_save call. As an example, I create a new file that will be an RSpec spec file. When I save it, I see in the console the message "Switched syntax to: RSpec", but the syntax ultimately becomes Ruby. I added the on_activated call so I could get the syntax changed correctly by clicking off and then back onto the new file. Ideally, I wouldn't have to do that.

My questions are:

- What kinds of things happen in the save process *after* on_post_save is fired?
- Is there a better way to do what I'm I'm trying to do?

Thanks.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: sublime_plugin.EventListener.on_post_save API

Postby jps on Tue Dec 20, 2011 10:18 pm

What build of Sublime Text are you using? I think this will be working as expected in the current dev build.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: sublime_plugin.EventListener.on_post_save API

Postby phillip.koebbe on Tue Dec 20, 2011 11:05 pm

Currently using 2139. Is there a link that describes the process of evaluating a dev build?

The following is *not* meant to be a complaint, but a light-hearted glimpse into a programmer's reality...

For the record, I've burned almost two days playing around with syntax highlighting and various things in Sublime Text 2, and I'm having a great time. I keep thinking, "I'm not getting paid right now ... oh well, I'm having fun." The only thing that would make it better would be the ability to script in Ruby instead of Python. No offense to Python, but Ruby is my preference.

Thanks for a great tool.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm

Re: sublime_plugin.EventListener.on_post_save API

Postby guillermooo on Tue Dec 20, 2011 11:15 pm

Dev builds can be found here:

http://www.sublimetext.com/dev

You can switch between the stable/dev channels at any time. sublime.channel() will give you the current channel you're on.
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: sublime_plugin.EventListener.on_post_save API

Postby phillip.koebbe on Wed Dec 21, 2011 3:11 am

I just verified that the on_post_save does work the way I expect it to with build 2150. I commented out the on_activated callback and created a new RSpec file and on saving it, it was assigned the correct syntax.

As my daughter would say, 'Hupungus!'

Thanks.
-- Phillip

Code: Select all
while self.living? do
    mistake = Mistake.new
    self.learn_from!(mistake) unless mistake.fatal?
end
phillip.koebbe
 
Posts: 208
Joined: Tue Dec 20, 2011 4:58 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 18 guests