Skip to content

Commit

Permalink
Fixes #103. BeautifyEntireFileOnSave only applies when saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavin001 committed Oct 26, 2014
1 parent 9ec22bf commit dda313f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/beautify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ getConfigOptionsFromSettings = (langs) ->
# console.log(options);
options

beautify = ->
beautify = ({onSave})->
path ?= require("path")
MessagePanelView ?= require('atom-message-panel').MessagePanelView
PlainMessageView ?= require('atom-message-panel').PlainMessageView
LoadingView ?= require "./loading-view"
@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()
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit dda313f

Please sign in to comment.