Setting default syntax for new editors?


I wrote a small snippet in my init file, to make the default syntax gfm. This works, however, I now get periodic errors, such as when i close or move panes, etc.

atom.workspace.observeTextEditors (editor) ->
    original_grammar = editor.getGrammar() if editor?
    if original_grammar? and original_grammar is atom.syntax.grammarForScopeName('text.plain.null-grammar')

Anything obviously wrong?

Thanks in advance!