0
votes

I have two buffers open in emacs next to each other lets call them A,B in that order in the split screen. I have a function that opens a new file (C) and depending on which buffer (A,B) I execute the function in, if executed in A (scenario 1) the buffer will move to the right to be (C,A) and if executed in B (scenario 2), the buffer stays in place (C,B).

I use another function that simply close the new buffer (C) but now the order of the original files will change (B,A) in the first scenario (scenario 1).

Is there a way to include functionality in the (closing function I use) to preserve the original order of files A,B?

t in their place, after done with them another function to close these new two buffers. Is there a way to preserve the order in which the original buffers were in?

Meaning, if they were in this order A,B side to side, after closing the new buffers keep them in that order and not B,A for example.

1
It sounds like you would be interested in one of the many available libraries that help Emacs users restore previous window layouts and selected buffers -- e.g., elscreen, perspectives, workspaces, . . . . - - I did a brief Google search of restore layout window emacs and got a bunch of hits. - lawlist
What function are you using to open buffer C? Whatever function you're using seems to want to put C on the left, but you can probably configure it to open over the opposite windows you're using. - Brian Malehorn
Brian, the function I use has to put C on the left (I want it this way), but after closing C I want the original order of files to be preserved. Scenario 2 is no problem since the order stays (A,B) but scenario 1 is the problem. I was hoping for some functionality that would save the order of these buffers when executing the function then when using the closing function it preserved the saved order. - SFbay007

1 Answers

1
votes

This solved it:

  (setq my-window-conf (current-window-configuration))
  ....
  (set-window-configuration my-window-conf)  ;; restore window layout and
                                             ;; selected buffers