Brief: a buffer open in 2+ panes can receive the same callback from multiple editors, because each pane is an editor, but there’s only one buffer.
Perhaps obvious for some, but the problem is, Atom appears to recommend solutions that create the problem >.<
Here is the case, from the Atom docs:
A single TextBuffer can belong to multiple editors […] if the same file is open in two different panes
Also from Atom docs, a typical use case/recommendation of ‘observeTextEditors’. Many of these textEditor methods are actually quite concerning in light of this behavior, just the existence of these methods is odd !
atom.workspace.observeTextEditors (editor) -> editor.insertText('Hello World')
So let’s design a simple test for our init script and observe the stacking behavior
atom.workspace.observeTextEditors (editor) -> editor.onDidSave () -> editor.insertText('Hello World\n') # Reload > split right > split right > split right > and save!
We will see a few ‘Hello Worlds’ after saving, instead of just one. Different editors issued their own callback, but each applied it to the same buffer. Oddly, the behavior will persist so long as one of the files remains open.
Luckily, this problem can be averted by enabling the tree view setting ‘Always Open Existing’. It is usually disabled!