Prevent emacs from automatically closing a window after completion - emacs

This is some variation of a problem already mentioned, but I can't figure out what exactly.
I have my frame split in three windows:
----------------
| | |
| |------|
| |shell |
----------------
When I'm typing the shell, I do "tab" to get completions. They appear in the window on the left. Then emacs doesn't close the buffer, but the entire window, and I'm left with a horizontally split screen:
----------------
| |
|--------------|
| shell |
----------------
I'm not sure I understand how to stop this from happening, and it's not a problem I remember ever having. My botched attempts managed to get to the state where emacs would not close the completion suggestion buffer at all, but that's not ideal either.
What can I do to have emacs normally close the completion buffer, but leave my window alone?

M-x dedicated-mode
;; This minor mode allows you to toggle a window's "dedicated" flag.
;; When a window is "dedicated", Emacs will not select files into that
;; window. This can be quite handy since many commands will use
;; another window to show results (e.g., compilation mode, starting
;; info, etc.) A dedicated window won't be used for such a purpose.
;;
;; Dedicated buffers will have "D" shown in the mode line.

Related

Close the specific Window in 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.)

Org Mode Table Create Table from Region shortcut doesn't work

I have a list of tab-separated values that I Select using C-<space> down down down...
If I use M-x org-table-create-or-convert-from-region, it perfectly converts that region to an org-table. However, the shortcut associate with that command C-c | doesn't work. It simply adds the | character at the end of the region.
I'm in the process of creating 100 or so tables through this process and I'd really want my keyboard binding to work. Unfortunately, this command doesn't disambiguate until I type a lot.
Am i missing something very obvious?
Edit: From a great tip from Andrey I typed C-h k C-c | . I can confirm, the key is bound as seen in the following output
C-c | runs the command org-table-create-or-convert-from-region, which
is an interactive autoloaded Lisp function in `org-table.el'.
It is bound to C-c |.

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:)

Emacs: pop-up bottom window for temporary buffers

I would like to have a pop-up bottom window for temporary buffers like compilation, Completions, etc. It should split-vertically the whole frame even if root window was split horizontally. For example:
Before M-x compile:
+------+------+
| | |
| | |
| | |
+------+------+
After:
+------+------+
| | |
+------+------+
| |
+------+------+
I'm absolutely satisfied with ecb-compilation-window, but I don't want to use ECB and CEDET.
Actually I see two ways make described behavior but both have their drawbacks.
Use split-root.el module.
Drawback: it uses delete-other-windows function and then rebuilds previous windows tree after root window is split as required. It invalidates all references to existed earlier windows in your code(or code of any module).
Set window-min-height variable to its minimal possible value(1) and call split-window-vertically during emacs startup minimizing window height after it's created. Then use this window for temporary buffers setting its height as required.
Drawbacks: Small annoying window with annoying modeline on the bottom of the frame, doesn't work with emacs --daemon.
Are there more elegant ways to do that without drawbacks?
Use popwin !
It behaves as you describe out of the box, and configuration is easy, it only took one line to get my anything buffers to pop-up at the bottom of the screen :
(push '("\*anything*" :regexp t :height 20) popwin:special-display-config)
There some more detailed config examples floating around japanese blogs, just google it.

When using two frames in emacs, how do I prevent the compilation buffer from showing up in both?

I work with two monitors, and often use emacs with two frames open; one for each monitor. each frame is split into two side-by-side windows, like so:
a | b <-- frame 1 in monitor 1
-------
c | d <-- frame 2 in monitor 2
When I hit my 'compile' button while in window a, the compilation buffer opens in the buffer next to it. So far so good:
a | compilation
-----------------
c | d
However, if I then move to window c to edit some stuff, then hit compile again, window d visits the compilation buffer as well:
a | compilation
------------------
c | compilation
So now I have half of my screen real-estate taken up by two copies of the same compilation buffer, wondering why I have two monitors :)
I can prevent this by conscientiously only hitting the compile key when my cursor is in the buffer next to the currently open compile buffer, but I hit 'compile' so early and often that I usually don't have the presence of mind to do so. I feel like there must be something I can tweak in .emacs so I shouldn't have to.
Any suggestions? Ideally, when I hit 'compile', the currently open compilation buffer should move from its previous window to the one next to the currently used window. If that's too complicated, I'd easily settle for having emacs not visit the compilation buffer in the neighboring window, if it's already open in another window.
(setq-default display-buffer-reuse-frames t)
From the documentation:
Non-nil means `display-buffer' should reuse frames.
If the buffer in question is already displayed in a frame, raise
that frame.