 $ () ->
-  currentContent = ''
+  contentSrc = ''
   $window = $ window
   $body = $ window.document.body
   $theme = $ '#theme'

      return

    done = (body, status, xhr) ->
      currentContent = body
      lock body

    fail = () ->
      edit newTaste

        break  if filename is promptFilename
    url = "tastes/#{filename}"

    contentSrc = getDomContent().trim().replace(/\s+\n/g, '\n')
    contentSrc += '\n'  if contentSrc.length
    setContent contentSrc  if contentSrc isnt getDomContent()
    return true  unless contentSrc.length

    done = (body, status, xhr) ->
      window.location.hash = filename

    fail = () ->
      window.alert "Failed to save"
      edit()

    lock()
    $.ajax({
      method: 'PUT'
      url
      contentType: 'application/octet-stream'
      data: contentSrc
    }).done(done).fail(fail)
    false

  edit = (content = contentSrc) ->
    $content.html content
    $content.attr('contentEditable', 'true').focus()
    $content.on 'blur', keepFocus
