Maximizing / restoring a window in emacs

时光毁灭记忆、已成空白 提交于 2019-11-30 12:49:30

问题


Ok, so maybe this is more a question for the superuser site but I figured there'd be a hell of a lot more emacs users on stackoverflow.

Basically I often have my emacs split into about 4 windows so I can look at a bunch of buffers at the same time.. however I'd like to be able to C-x 1 (make the window the same size as emacs) and then somehow restore back to my nice 4 window layout I was just looking at.

Is there an easy way to do this or do I need some elisp / lisp (note: I don't know ANY elisp.)

Thanks! John.


回答1:


Try winner-mode.

With winner-mode enabled, you can restore your previous window configuration with C-c<left>.

You can type it repeatedly to step back through the window configuration history, so you're safe even when there have been multiple intervening changes.

C-c<right> returns you (directly) to the most recent configuration.




回答2:


I'm sure there are a few different solutions for this, but I use:

C-x r w x to store the window configuration and C-x r j x to restore it, where x is the name of the register to store it in.

Then, I also like winner-mode which allows swiching back to previous window configurations with winner-undo and winner-redo (which I bound to C-^ and C-c ^ because I can't stand the bindings C-c <left> and C-c <right> that are set by default).




回答3:


(winner-mode 1) is my preferred general solution (and I would urge anyone not already using it to add it to their init file immediately), but it's also worth pointing out that for this particular question (maximising a single window and then returning to the previous configuration), simply creating a new frame works very nicely.

  • C-x52 to create the new frame.
  • C-x50 to delete it and return to the original frame.

In a terminal, it's completely seamless. With GUI Emacs it's fine if your new frames are automatically full-screen (or however you prefer them to be), but not as good if you're manually sizing them.




回答4:


You should also try C-x 0 in the window you'd like to close, as it will close that specific window but not any other. I think that most people wants this most of the times they use C-x 1.




回答5:


I use escreen.el for multiple workspace management, but as a side effect, each workspace remembers the window configuration. So, you may find it a useful package.

Other people suggest elscreen instead of escreen, but I haven't used this package yet. So I can't say if it also preserves window configuration of workspaces.




回答6:


http://www.emacswiki.org/emacs/frame-cmds.el

See commands maximize-frame and restore-frame (aka toggle-frame). There are also commands maximize-frame-horizontally, maximize-frame-vertically, restore-frame-horizontally, and restore-frame-vertically.



来源:https://stackoverflow.com/questions/7641755/maximizing-restoring-a-window-in-emacs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!