As topic says - I'm using tabbar + tabbar-forward-tab to quickly switch between recent buffers right now, but I don't really like it. I'd rather have the names of the previous and next buffer show up in my modeline, and use the built in buffer switch functions instead. Sounds easy, but I couldn't find where the buffer names are stored. Also, I don't know if modifying the modeline is trivial either.

Is this possible?

  • 2
    You can certainly do this, but your problem is that the code used by switch-to-next-buffer and switch-to-previous-buffer for deciding which buffer to switch to is somewhat complex, and not isolated from the actual "switch-to" behaviour; so (a) you would need to replicate quite a lot of code; and (b) the mode line is updated really frequently, so doing a lot of processing on each refresh is not ideal. – phils Oct 5 '17 at 12:06
  • 2
    Buffers are stored in the buffer-list. I don't think you can quite do what you want to do, however. It stores buffers in order of recent use, so the "previous" and the "next" buffer are the same thing. Aside from that, putting the name of the next/previous buffer in the modeline would probably be more confusing than it's worth: I imagine it would be easy to forget that you're editing the current buffer, not the buffer listed in the modeline. – Dan Oct 5 '17 at 13:48
  • 1
    This does not answer your question, but just thought I'd mention it. If you put your mouse (if you have one) pointer over the buffer name in the mode line you'll see that it tells you that clicking mouse-1 takes you to the previous buffer and clicking mouse-3 takes you to the next buffer. – Drew Oct 5 '17 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.