Emacs: pop-up bottom window for temporary buffers - emacs

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.

Related

Emacs won't run certain commands on startup

So I have this Emacs plugin which I quite like:
auto-indent-mode
However, when I add it to my startup file (_emacs) like this:
(auto-indent-mode)
It won't run.
Also, I would like to know how I could setup my Emacs window like this:
-----------
| A | B|
|______| |
| C | |
Thanks.
This mode appears to be buffer-local. If you always want this mode enabled, EmacsWiki suggests doing this:
(auto-indent-global-mode)
You can also enable it for certain modes, e.g.
(add-hook 'emacs-lisp-mode-hook #'auto-indent-mode)

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 |.

Prevent emacs from automatically closing a window after completion

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.

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.

How to make Emacs always open .c files in the left windows while .h in the right?

I always open three windows when writing C code like this:
|
| 2
1 |_____
|
| 3
|
Window 1 is used for code writing, window 2 is used for cscope, and window 3 is used for header file quick reference.
When I press in cscope window to show source, I want Emacs to display .c files always in window 1 while .h files in window 3, is there any possible solution?
Many thanks for your reply.
Take a look at the answer to a similar question. The key is to use the variable: special-display-regexps. It's nearly a drop-in solution, only you choose the window based on the extension (as opposed to not choosing a window).