{"action":"opened","number":80,"pull_request":{"url":"https://api.github.com/repos/atom/atom-keymap/pulls/80","id":35937012,"html_url":"https://github.com/atom/atom-keymap/pull/80","diff_url":"https://github.com/atom/atom-keymap/pull/80.diff","patch_url":"https://github.com/atom/atom-keymap/pull/80.patch","issue_url":"https://api.github.com/repos/atom/atom-keymap/issues/80","number":80,"state":"open","locked":false,"title":"Always reload keymap if CSON parsing succeeded","user":{"login":"izuzak","id":38924,"avatar_url":"https://avatars.githubusercontent.com/u/38924?v=3","gravatar_id":"","url":"https://api.github.com/users/izuzak","html_url":"https://github.com/izuzak","followers_url":"https://api.github.com/users/izuzak/followers","following_url":"https://api.github.com/users/izuzak/following{/other_user}","gists_url":"https://api.github.com/users/izuzak/gists{/gist_id}","starred_url":"https://api.github.com/users/izuzak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/izuzak/subscriptions","organizations_url":"https://api.github.com/users/izuzak/orgs","repos_url":"https://api.github.com/users/izuzak/repos","events_url":"https://api.github.com/users/izuzak/events{/privacy}","received_events_url":"https://api.github.com/users/izuzak/received_events","type":"User","site_admin":true},"body":"This fixes https://github.com/atom/atom-keymap/issues/69.\r\n\r\nIt seems that [this check](https://github.com/atom/atom-keymap/blob/ad7566febcc835318f46fa554863b4797865f1bb/src/keymap-manager.coffee#L337):\r\n\r\n```\r\nif bindings = @readKeymap(filePath, true)\r\n  # code for reloading the keymap\r\n```\r\n\r\nis currently failing for two different situations, so reloading doesn't happen:\r\n* `readKeymap` returned `undefined`, which happens when CSON parsing failed. It's expected that reloading doesn't happen in this situation, so the check is fine for this.\r\n* `readKeymap` returned `null`, which happens when CSON parsing succeeded, but the CSON file was either empty or had only comments (i.e. no CSON objects were parsed). It's expected that reloading does happen in this situation, so the check needs to be fixed for this.\r\n\r\nThis pull request tweaks the check so that the keymap is reloaded even if no CSON objects were found after successful parsing. In other words, if CSON parsing was okay, the keymap is reloaded.\r\n\r\n1bad0d3 adds specs which expectedly fail with this output without the fix applied:\r\n\r\n```\r\n.......................................FF........\r\n\r\nKeymapManager\r\n  ::loadKeymap(path, options)\r\n    if called with a file path\r\n      if called with watch: true\r\n        when the file is changed\r\n          it reloads the file's key bindings and notifies ::onDidReloadKeymap observers with the keymap path if the file is empty or has only comments\r\n            timeout: timed out after 300 msec waiting for something to happen\r\n          it reloads the file's key bindings and notifies ::onDidReloadKeymap observers with the keymap path if the file has only comments\r\n            timeout: timed out after 300 msec waiting for something to happen\r\n\r\n\r\nFinished in 2.817 seconds\r\n49 tests, 258 assertions, 2 failures, 0 skipped\r\n```\r\n\r\ncc @kevinsawicki @nathansobo for :eyes: ","created_at":"2015-05-21T14:07:55Z","updated_at":"2015-05-21T14:07:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/atom/atom-keymap/pulls/80/commits","review_comments_url":"https://api.github.com/repos/atom/atom-keymap/pulls/80/comments","review_comment_url":"https://api.github.com/repos/atom/atom-keymap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/atom/atom-keymap/issues/80/comments","statuses_url":"https://api.github.com/repos/atom/atom-keymap/statuses/c58f94d19c4b9535972241466631220173b83b17","head":{"label":"atom:iz-fix-keymap-when-empty","ref":"iz-fix-keymap-when-empty","sha":"c58f94d19c4b9535972241466631220173b83b17","user":{"login":"atom","id":1089146,"avatar_url":"https://avatars.githubusercontent.com/u/1089146?v=3","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"repo":{"id":17691877,"name":"atom-keymap","full_name":"atom/atom-keymap","owner":{"login":"atom","id":1089146,"avatar_url":"https://avatars.githubusercontent.com/u/1089146?v=3","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atom/atom-keymap","description":"Atom's selector-based keymap system","fork":false,"url":"https://api.github.com/repos/atom/atom-keymap","forks_url":"https://api.github.com/repos/atom/atom-keymap/forks","keys_url":"https://api.github.com/repos/atom/atom-keymap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atom/atom-keymap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atom/atom-keymap/teams","hooks_url":"https://api.github.com/repos/atom/atom-keymap/hooks","issue_events_url":"https://api.github.com/repos/atom/atom-keymap/issues/events{/number}","events_url":"https://api.github.com/repos/atom/atom-keymap/events","assignees_url":"https://api.github.com/repos/atom/atom-keymap/assignees{/user}","branches_url":"https://api.github.com/repos/atom/atom-keymap/branches{/branch}","tags_url":"https://api.github.com/repos/atom/atom-keymap/tags","blobs_url":"https://api.github.com/repos/atom/atom-keymap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atom/atom-keymap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atom/atom-keymap/git/refs{/sha}","trees_url":"https://api.github.com/repos/atom/atom-keymap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atom/atom-keymap/statuses/{sha}","languages_url":"https://api.github.com/repos/atom/atom-keymap/languages","stargazers_url":"https://api.github.com/repos/atom/atom-keymap/stargazers","contributors_url":"https://api.github.com/repos/atom/atom-keymap/contributors","subscribers_url":"https://api.github.com/repos/atom/atom-keymap/subscribers","subscription_url":"https://api.github.com/repos/atom/atom-keymap/subscription","commits_url":"https://api.github.com/repos/atom/atom-keymap/commits{/sha}","git_commits_url":"https://api.github.com/repos/atom/atom-keymap/git/commits{/sha}","comments_url":"https://api.github.com/repos/atom/atom-keymap/comments{/number}","issue_comment_url":"https://api.github.com/repos/atom/atom-keymap/issues/comments{/number}","contents_url":"https://api.github.com/repos/atom/atom-keymap/contents/{+path}","compare_url":"https://api.github.com/repos/atom/atom-keymap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atom/atom-keymap/merges","archive_url":"https://api.github.com/repos/atom/atom-keymap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atom/atom-keymap/downloads","issues_url":"https://api.github.com/repos/atom/atom-keymap/issues{/number}","pulls_url":"https://api.github.com/repos/atom/atom-keymap/pulls{/number}","milestones_url":"https://api.github.com/repos/atom/atom-keymap/milestones{/number}","notifications_url":"https://api.github.com/repos/atom/atom-keymap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atom/atom-keymap/labels{/name}","releases_url":"https://api.github.com/repos/atom/atom-keymap/releases{/id}","created_at":"2014-03-13T02:31:22Z","updated_at":"2015-05-07T20:38:32Z","pushed_at":"2015-05-21T14:07:55Z","git_url":"git://github.com/atom/atom-keymap.git","ssh_url":"git@github.com:atom/atom-keymap.git","clone_url":"https://github.com/atom/atom-keymap.git","svn_url":"https://github.com/atom/atom-keymap","homepage":null,"size":1342,"stargazers_count":30,"watchers_count":30,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":25,"forks":16,"open_issues":25,"watchers":30,"default_branch":"master"}},"base":{"label":"atom:master","ref":"master","sha":"ad7566febcc835318f46fa554863b4797865f1bb","user":{"login":"atom","id":1089146,"avatar_url":"https://avatars.githubusercontent.com/u/1089146?v=3","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"repo":{"id":17691877,"name":"atom-keymap","full_name":"atom/atom-keymap","owner":{"login":"atom","id":1089146,"avatar_url":"https://avatars.githubusercontent.com/u/1089146?v=3","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atom/atom-keymap","description":"Atom's selector-based keymap system","fork":false,"url":"https://api.github.com/repos/atom/atom-keymap","forks_url":"https://api.github.com/repos/atom/atom-keymap/forks","keys_url":"https://api.github.com/repos/atom/atom-keymap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atom/atom-keymap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atom/atom-keymap/teams","hooks_url":"https://api.github.com/repos/atom/atom-keymap/hooks","issue_events_url":"https://api.github.com/repos/atom/atom-keymap/issues/events{/number}","events_url":"https://api.github.com/repos/atom/atom-keymap/events","assignees_url":"https://api.github.com/repos/atom/atom-keymap/assignees{/user}","branches_url":"https://api.github.com/repos/atom/atom-keymap/branches{/branch}","tags_url":"https://api.github.com/repos/atom/atom-keymap/tags","blobs_url":"https://api.github.com/repos/atom/atom-keymap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atom/atom-keymap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atom/atom-keymap/git/refs{/sha}","trees_url":"https://api.github.com/repos/atom/atom-keymap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atom/atom-keymap/statuses/{sha}","languages_url":"https://api.github.com/repos/atom/atom-keymap/languages","stargazers_url":"https://api.github.com/repos/atom/atom-keymap/stargazers","contributors_url":"https://api.github.com/repos/atom/atom-keymap/contributors","subscribers_url":"https://api.github.com/repos/atom/atom-keymap/subscribers","subscription_url":"https://api.github.com/repos/atom/atom-keymap/subscription","commits_url":"https://api.github.com/repos/atom/atom-keymap/commits{/sha}","git_commits_url":"https://api.github.com/repos/atom/atom-keymap/git/commits{/sha}","comments_url":"https://api.github.com/repos/atom/atom-keymap/comments{/number}","issue_comment_url":"https://api.github.com/repos/atom/atom-keymap/issues/comments{/number}","contents_url":"https://api.github.com/repos/atom/atom-keymap/contents/{+path}","compare_url":"https://api.github.com/repos/atom/atom-keymap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atom/atom-keymap/merges","archive_url":"https://api.github.com/repos/atom/atom-keymap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atom/atom-keymap/downloads","issues_url":"https://api.github.com/repos/atom/atom-keymap/issues{/number}","pulls_url":"https://api.github.com/repos/atom/atom-keymap/pulls{/number}","milestones_url":"https://api.github.com/repos/atom/atom-keymap/milestones{/number}","notifications_url":"https://api.github.com/repos/atom/atom-keymap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atom/atom-keymap/labels{/name}","releases_url":"https://api.github.com/repos/atom/atom-keymap/releases{/id}","created_at":"2014-03-13T02:31:22Z","updated_at":"2015-05-07T20:38:32Z","pushed_at":"2015-05-21T14:07:55Z","git_url":"git://github.com/atom/atom-keymap.git","ssh_url":"git@github.com:atom/atom-keymap.git","clone_url":"https://github.com/atom/atom-keymap.git","svn_url":"https://github.com/atom/atom-keymap","homepage":null,"size":1342,"stargazers_count":30,"watchers_count":30,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":25,"forks":16,"open_issues":25,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/atom/atom-keymap/pulls/80"},"html":{"href":"https://github.com/atom/atom-keymap/pull/80"},"issue":{"href":"https://api.github.com/repos/atom/atom-keymap/issues/80"},"comments":{"href":"https://api.github.com/repos/atom/atom-keymap/issues/80/comments"},"review_comments":{"href":"https://api.github.com/repos/atom/atom-keymap/pulls/80/comments"},"review_comment":{"href":"https://api.github.com/repos/atom/atom-keymap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/atom/atom-keymap/pulls/80/commits"},"statuses":{"href":"https://api.github.com/repos/atom/atom-keymap/statuses/c58f94d19c4b9535972241466631220173b83b17"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":28,"deletions":1,"changed_files":2}}