With increasing frequency, my Emacs session's function
other-buffer begins to malfunction.
Specifically, at some point, and for no reason I can discern,
other-buffer stops "seeing" some random buffer. By this I mean that, for example, even when some buffer
xyz was in fact the last buffer I visited before the current one, and shows up in the second row of the
*Buffer List* window,
other-buffer will not evaluate to
xyz, but instead will evaluate to the buffer shown in the third row of the
*Buffer List* window1,2.
other-buffer is not a Lisp function, so I don't know how to go about inspecting its source code. (Actually, even if I had access to its C source, I doubt I would be able to make much sense of it.)
Therefore, I'm looking for any information that may help troubleshoot this problem. As I said, it has been happening a lot lately, so I would like to get to the bottom of it.
What could explain this weird behavior from
other-buffer function is used by
switch-to-buffer, better known as "good ol'
C-x b", to determine its default argument. When one is flipping back and forth between two buffers, which is an extremely common situation, it is great to be able to rely on this default value, since it always resolves to precisely the buffer one wants to visit. When
other-buffer lands in the broken state I described above, and at least one of the buffers one is toggling over is among those that
other-buffer has decided to ignore,
C-x b becomes cumbersome at best, since one can no longer just hit Enter to accept the default, and supremely infuriating at worst, since the habit of doing precisely this (i.e. hitting Enter to accept the default) is a deeply ingrained one, and as a result one keeps visiting buffers one does not want to visit.
2 Yes, one can solve the problem in the short term by killing the buffer and recreating it. This is always disruptive, and in some cases extremely so. For example, I rely on many buffers (e.g. subordinate shell buffers, debugger buffers, etc.) whose histories are important, and would get discarded by such a re-creation.