Skip to content

Instantly share code, notes, and snippets.

@alexdevero
Created February 15, 2018 07:40
Show Gist options
  • Save alexdevero/657b4345ff7e115abd926964d4ddb401 to your computer and use it in GitHub Desktop.
Save alexdevero/657b4345ff7e115abd926964d4ddb401 to your computer and use it in GitHub Desktop.
Atom - Unsubscribe from the gitrefresh event for every repo in the current project
(->
###*
# Unsubscribe from the gitrefresh event for every repo in the current project
# A fix for issue: https://github.com/atom/atom/issues/9544
###
disableGitRefreshOnFocus = ->
atom.project.repositories.forEach (repo) ->
if repo and repo.subscriptions and repo.subscriptions.disposables and repo.subscriptions.disposables.size
Array.from(repo.subscriptions.disposables).forEach (item) ->
content = item.disposalAction + ''
if content.indexOf('focus') > 1
item.dispose()
return
return
atom.project.emitter.on 'did-change-paths', disableGitRefreshOnFocus
disableGitRefreshOnFocus()
atom.commands.add 'atom-text-editor', 'custom:refresh-git-status', ->
atom.project.repositories.forEach (repo) ->
if repo != null
repo.refreshStatus()
).call this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment