When I run C-x C-v (find-alternate-file), unrelated buffers may be killed by side effect. When inspecting it I've found out that the problem disappears when I remove persp-kill-buffer-h from kill-buffer-hook. It seems that persp-kill-buffer-h switches buffers in the middle of find-alternate-file and then another buffer, in addition to the current one, gets killed during the operation.
It's possible to watch the bug in action by switching to some perspective, instrumenting find-alternate-file for debugging and running C-x C-v. In the debugger, step until you reach (run-hooks 'kill-buffer-hook) line in find-alternate-file and observe that the current buffer gets switched after evaluating the line.
When I run C-x C-v (find-alternate-file), unrelated buffers may be killed by side effect. When inspecting it I've found out that the problem disappears when I remove persp-kill-buffer-h from kill-buffer-hook. It seems that persp-kill-buffer-h switches buffers in the middle of find-alternate-file and then another buffer, in addition to the current one, gets killed during the operation. It's possible to watch the bug in action by switching to some perspective, instrumenting find-alternate-file for debugging and running C-x C-v. In the debugger, step until you reach (run-hooks 'kill-buffer-hook) line in find-alternate-file and observe that the current buffer gets switched after evaluating the line.