Say I have two existing files named "file1.el" and "file2.el".
Then I perform the following steps:
I open a file named "file1.el"
C-x C-fa file named "file2.el", now currently I have 1 window and it displays the "file2.el" buffer.
(display-buffer "file1.el"), it opens a new window that displays
file1.elbuffer on the same frame.
I want to kill the
file1.elbuffer and its corresponding window, so I
(quit-window t (get-buffer-window "file1.el")), and I got what I want.
However, things are different when I do some buffer switches on the window displaying "file1.el", just after step 3. If I have done it, the step 4 will only kill the "file1.el" buffer, but NOT quitting the window that displaying it. Instead, after step 4, that window will display another buffer that I've switch to previously.
My question is that why
quit-window behavior is different in this scenario?