diff --git a/lib/beautify.coffee b/lib/beautify.coffee index d00aa43..0e6f055e 100644 --- a/lib/beautify.coffee +++ b/lib/beautify.coffee @@ -125,7 +125,7 @@ getConfigOptionsFromSettings = (langs) -> # console.log(options); options -beautify = -> +beautify = ({onSave})-> path ?= require("path") MessagePanelView ?= require('atom-message-panel').MessagePanelView PlainMessageView ?= require('atom-message-panel').PlainMessageView @@ -133,7 +133,7 @@ beautify = -> @messagePanel ?= new MessagePanelView title: 'Atom Beautify Error Messages' @loadingView ?= new LoadingView() @loadingView.show() - forceEntireFile = atom.config.get("atom-beautify.beautifyEntireFileOnSave") + forceEntireFile = onSave && atom.config.get("atom-beautify.beautifyEntireFileOnSave") # Show error showError = (e) => @loadingView.hide() @@ -306,7 +306,7 @@ handleSaveEvent = => plugin.unsubscribe buffer if atom.config.get("atom-beautify.beautifyOnSave") events = "will-be-saved" - plugin.subscribe buffer, events, beautify.bind(@) + plugin.subscribe buffer, events, beautify.bind(@, {onSave:true}) return return