Emacs session / projects / window management

别说谁变了你拦得住时间么 提交于 2019-12-05 08:24:02

I tried to put myself in your shoes and conjure up my preferred Emacs solution. Best I can come up with is that I do occasionally get into a mode where I don't want my windows mucked with by dealing with an Emacs interrupt, one that requires different Emacs resources (buffers/windows). Say for example I have an ediff going on and I want to go to the scratch buffer to test out an idea without mucking with my ediff perspective, to borrow the Eclipse notion. In such a case I generally do C-x 5 2 to bring up a new frame. If I've already got multiple frames up on the monitor I will do C-x 5 f to select a named frame.

In your case, you might have one set of frames with a "proj-x" prefix and another with a "proj-y" prefix. In this case C-x f proj-x-foo provides a quick switch to handle your interrupt C-x f proj-y-fee switches you back. In most cases, I think you talking about two frames, which is even easier: C-x f o to switch between the two frames.

I think the take-home point is that with Emacs, one can "drop" what you're doing without the need to close anything, do something else and then come back to your original environment with little fuss or muss. This is a corollary to the notion that with Emacs you can have hundreds of files open simultaneously, i.e. you do not need to close a file and then open another. Open 'em all and have a ball. :-) And when you embrace this style, C-x s is your friend.

I like window-configuration-to-register (C-x r w <register_name>) for situations similar to what you're describing. Once you've save a window configuration to a register, it's just C-x r j <register_name> to get back to your saved configuration.

Maybe you're trying to get emacs to work like an IDE, which it isn't. I often have multiple projects open in emacs and just never close emacs, not for weeks. This is one of the main reasons I ended up on emacs years ago. On my current project I switch between java, ruby and Lisp. I also need features to edit jsp, erb, html and css, the only thing I haven't sorted out yet is javascript. As well as the ability to completely customize my environment, this is the power of emacs.

I do use ECB all the time, and typically as I move around files, it follows me, I don't work from a 'windows' perspective, but from an 'Im here' perspective. A particular buffer being open or not is actually unimportant. I also use IDO, so switching buffers is really easy and intuitive. I generally have two buffers displayed max (but potentially lots open). M-X s is also useful to ensure you've saved as it will enumerate all the unsaved buffers and prompt you about them.

When I do have to close emacs, I generally get back to where I was very quickly by cd'ing to that folder and type emacs app/controllers/my_controller.rb. From there the rails navigation is very helpful. M-Shift-down arrow and we're off ...

http://www.emacswiki.org/emacs/WindowsMode - Saves and restores Window configuration.

eproject has eproject-open-all-project-files, which ensures all files in the current project are opened (or invoke it with the prefix arg to choose an arbitrary project) and eproject-kill-project-buffers which closes all the files in the current project. This lets you easily get started with a project and lets you clean up when you are done.

Icicles and Bookmark+ can help you in several ways to use projects.

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