user462455
user462455

Reputation: 13618

Emacs killing buffers

(Emacs newbie here)

Sometimes a Help buffer gets opened in my emacs editor. It opens in a different pane, splitting the current window into two halves vertically.

When I use C-k buffer-name, to kill a buffer (say Help), some other buffer (say scratch) gets opened automatically in that pane.

Is it possible to revert to my previous configuration, after a random buffer (Help or Debug..) gets opened.

My previous configuration would be to go back to a single window with no panes

Upvotes: 0

Views: 296

Answers (2)

user1316487
user1316487

Reputation:

Hello to revert back to one buffer you must hit C-x1 while standing in the buffer you want to keep. And to switch between frames C-xo

Upvotes: 0

phils
phils

Reputation: 73365

To revert to the previous window configuration after any arbitrary change(s), you should enable winner-mode in your .emacs file:

(winner-mode 1)

Then you can use C-c<left> (repeatedly, if necessary) to undo window configuration changes with winner-undo.

C-c<right> calls winner-redo which returns you to the most recent configuration (immediately; not in single steps the like the 'undo' command).

Winner mode is the key to never ever getting annoyed by Emacs creating an unwanted window, but it also lets you do things you wouldn't have done before (for instance C-x1 to maximise one of your windows temporarily for easier reading, because getting back all the windows you just deleted is now trivial).

Obviously this is also incredibly useful if you accidentally mess up your window config!

Upvotes: 3

Related Questions