Close the specific Window in Emacs - emacs

its really easy to create window in emacs, like C-x 2 create a window downside of the current window and C-x 3 create a window right of current window. So its easily to create a layout like:
| 2 |
1 |------------| 4
| 3 |
now it comes to the question, how do i fast kill the specific window (like i work in window No. 1, look something in No.2 and dont want No.3 so want fast kill it) without jumping to that window? I know that we can use C-x o to switch to that window and use C-x 0 to kill it. Are there anyway to do it like for example presse C-x k 3 to kill the window No.3?

If you use library frame-cmds.el then you can use command delete-windows-on to delete all windows for a given buffer. The buffer name is read with completion, so this is usually pretty quick.
Interactively:
Without a prefix arg, deletes matching windows on all frames
With prefix arg >= 0, deletes matching windows on only the selected (current) frame
With prefix arg < 0, deletes matching windows on all visible frames
You can of course use delete-windows-on to define your own command that always acts as does delete-windows-on with a positive prefix arg. Just use (delete-windows-on nil t).
(If you use Icicles then C-u C-x 0 (command icicle-delete-window) and command icicle-delete-window-by-name give you similar behavior. These are multi-commands, which means you can delete multiple window with a single command invocation.)

Related

Emacs buffer copy with single stroke

assume I have focus on BrokerSyncMasteredRecord.cc. I want to fast copy BrokerSyncMasteredRecord.cc to the left by one stroke(like some hotkeys). the final state in pic 2. Currently, I can only use C-x b and type in a few chars of the buffer name. this is very slow.
NOTE: this should not be another opened replica buffer(e.g., BrokerSyncMasteredRecord.cc[replicated], you know what i mean if you are a emacs user) but exact the same buffer, just show in two different windows
I'll just quote the Emacs tutorial (f1 t) for you:
* MULTIPLE WINDOWS
------------------
One of the nice features of Emacs is that you can display more than
one window on the screen at the same time. (Note that Emacs uses the
term "frames"--described in the next section--for what some other
applications call "windows". The Emacs manual contains a Glossary of
Emacs terms.)
>> Move the cursor to this line and type C-l C-l.
>> Now type C-x 2 which splits the screen into two windows.
Both windows display this tutorial. The editing cursor stays in
the top window.
This basic tutorial is just 1000 lines, almost small enough to use as a capcha
for asking questions about Emacs:)

How to make emacs allow opening one buffer in different frames?

I have two frames of the same Emacs instance (got them by C-x 5 2) and a file opened in one of these frames. Then I try to show this file in a buffer in another frame (by C-x b) and nothing happens.
Actually, I think it shows this file in a buffer in the first frame, but this is not what I want it to do. I want it to show this buffer in both frames.
When there is only one frame and some windows in it, opening one buffer in different windows is no problem. I want the same behaviour but with several frames.
Most likely you are using iswitch, as what you describe is its default behavior.
You can change it by doing M-x customize-variable RET iswitchb-default-method. probably you want to choose option samewindow
The ido equivalent variable , in case you are using it, is ido-default-buffer-method (ido defaults to raise-frame, that does not match with your observed behavior).
You may find if you are using one or the other using the way #Olaf describes.
Maybe, you have C-x b redefined. I have the same behaviour with iswitch-buffer. But when I enter M-x switch-to-buffer, it shows the buffer in the second window.
You can find out, which command is executed with C-h c C-x b.

In Emacs, can we maximize current active window, and then restore it back in multiple window environment?

I like to open multiple window, each with its own file opened. Sometimes, I want to maximize the one I edited to occupy whole screen, and then to restore it back to its previous size and position..
Is there a way?
According to the emacs menu, I can only figure out enlarge-window, shrink-window.. thats it..
More or less - try using winner-mode. It will remember the last few (ca 200) window configurations, and will let you walk through them with a simple (C-c (right|left)) keystroke. And it's quite easy to turn on, since it's built in:
(when (fboundp 'winner-mode)
(winner-mode 1))
Combine it with windmove and moving between your windows will be even more awesome.
Use the command window-configuration-to-register: M-x window-configuration-to-register, press the Enter key, then some register (character), e.g. a. To maximize current window, use C-x 1. When you want to restore, type C-x r j a.
Workaround.
ESC ESC ESC maximizes the buffer with active cursor.
M-x ` to navigate between other buffers.

Eclipse and emacs+ : C-x 0 and C-x 2 does not work - C-x 1 and C-x 3 works

I try to use Emacs+ plugin for Eclipse. There is four ways to split windows :
C-x 0 - removes current window
(does not work)
C-x 1 - show only the current windows (it works)
C-x 2 - split horizontally (does not work)
C-x 3 - split vertically (it works)
I have an azerty keyboard and if I want to write a number, I have to push "Shift + < number >". If I use the qwerty layout, there is no problem because I don't have to push "shift" to write a number.
Any ideas ?
Everyone's keybindings are different. In emacs you can say that C-x2 is often bound to a particular function, but it is not the case that it always is bound in that way. In your situation it is more complicated because of the different keyboard.
You may find it helpful to use describe-key to tell you about the keystrokes you are using. It will tell you about a particular key combination, as you type it, including what function is bound to it, if any. I personally have describe-key bound to C-h k.
There is the converse, describe-function (bound to C-h f for me), which will tell you about a function whose name you provide, including what keys it is bound to. Using these may help you diagnose.
For me, C-x 2 runs the command split-window-vertically and C-x 3 runs the command split-window-horizontally.
I have tried the keybindings and was successfull.
In my environment I use
Eclipse 3
Emacs+ 3.6.0
Windows 7
Hope this is any help for you.
But perhaps you should check the key settings in Eclipse. Look for Preferences->General->Keys
Search for split window and you will see your settings in Eclipse.

Emacs merging buffers into one without using C-x 1 keybind

Could you suggest the key bind in emacs to do the following:
Steps: for example
1) I divided all text editor area into 2 pieces with command C-x 2
2) Then I divided first one on another 2 pieces with C-x 3
3) How can I make the first piece (a buffer in this case)
See attached image for better description of what I want getimage http://img.skitch.com/20090922-ra1394bnrbsigrdgm5uycjtrds.jpg
If i understand you correctly you want to C-x 0 in the window you want to close.
The interactive solution is to put the cursor in the bottom buffer and hit C-x 0.
the other option if you enjoy using the mouse is to right click on the modeline of the buffer you want to close (the one which shows helpers.py in your screenshot). The only thing which you have to note is that you should not click on the file name, as right click on file name is bind to switch buffer by default.
C-x 0 did the trick