0

I'm trying to make emacs buffer list to behave like tabs in most web browsers:

  1. If I open buffers "1", "2" and "3" in that order, they should remain in that order unles I move them on purpose with functions explained in point 4.
  2. If I use the "switch-to-buffer" function or any other implementation of this functionality, this should not alter the ordering of the buffers in the buffer list.
  3. Same for finding files. New buffers should go to the end of the otherwise unaltered list.
  4. Move-current-buffer-down and move-current-buffer-up (new) commands should move the current buffer up and down in the buffer list.

I'm most concerned with point 2 as I can't found any way to avoid the default behavior of emacs and every alternative package I tried. Also, I don't know why this function I made does not behaves as I want.

(defun my-buffer-switcher () (interactive)
       (switch-to-buffer (read-buffer "") t)
       )

Because, from emacs help page:

(switch-to-buffer BUFFER-OR-NAME &optional NORECORD FORCE-SAME-WINDOW)

If optional argument NORECORD is non-nil, do not put the buffer at the front of the buffer list, and do not make the window displaying it the most recently selected one.

Sorry if I'm missing something but I can't find any solution.

Note: By "order" (in point 1) I mean, the order in which buffers cycle when using previous-buffer and next-buffer (or equivalent) functions.

Thanks a lot.

  • You should not try to fiddle around with the result of (buffer-list)! Rather make your own list and provide appropriate commands for it. – Tobias Mar 30 at 12:37

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.