From 516c35623888634a3ffcca845fed6b962749fbf2 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Mon, 8 Sep 2014 16:25:06 -0300 Subject: [PATCH] Fixes #81. Beautify on Save now retains `this` scope when beautifying Bug created when developing issue #56. --- lib/beautify.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/beautify.coffee b/lib/beautify.coffee index f2806e2ba..dfdef5cbb 100644 --- a/lib/beautify.coffee +++ b/lib/beautify.coffee @@ -123,7 +123,7 @@ beautify = -> PlainMessageView ?= require('atom-message-panel').PlainMessageView LoadingView ?= require "./loading-view" @messagePanel ?= new MessagePanelView title: 'Atom Beautify' - @messagePanel.attach(); + @messagePanel.attach() ; @loadingView ?= new LoadingView() @loadingView.show() forceEntireFile = atom.config.get("atom-beautify.beautifyEntireFileOnSave") @@ -232,16 +232,16 @@ beautify = -> @messagePanel.add(new PlainMessageView({ message: e.message, className: 'text-error' - })); + } )) ; return -handleSaveEvent = -> - atom.workspace.eachEditor (editor) -> +handleSaveEvent = => + atom.workspace.eachEditor (editor) => buffer = editor.getBuffer() plugin.unsubscribe buffer if atom.config.get("atom-beautify.beautifyOnSave") events = "will-be-saved" - plugin.subscribe buffer, events, beautify + plugin.subscribe buffer, events, beautify.bind(@) return return