Stop emacs from opening window automatically - emacs

This question probably applies to other emacs modes than haskell-mode, since I assume emacs has got a general way of opening windows for automatically created buffers:
haskell-mode for emacs enables me to hit C-c C-l to load the contents of the current buffer into a Haskell interactive session, which automatically causes emacs to open the buffer for the session in a split window in the current frame. Since I am running a setup with multiple emacs clients connected to a server, I really don't want to show the buffer in each open frame I've got. Is there a way to prevent emacs from doing this kind of thing?

Ah, I found a solution just after posting this :).
Adding
(setq special-display-buffer-names
'("*haskell*" "*Help*"))
to my .emacs tells emacs to open these buffers in a frame instead of a split.
Edit: But still, an even better solution would be for emacs never to create frames/splits automatically, but just silently create special buffers in the background. I can't figure out how to specify this though.

in init.el
(setq split-height-threshold 5)
(setq split-width-threshold 5)

Related

Compilation buffer like "pop-up" buffer

I want to create a buffer that will behave like a pop-up buffer.
Wanted Features
It should be closed with ESC.
It should kill window when a buffer is killed (Could also do with a hook but if there's
builtin version it would be better)
Restrictions
I use evil-mode and I don't want to use external packages.
Things I've Done:
It should be on the bottom of the frame.
(display-buffer (get-buffer-create "*kmonad-scratchpad*")
'(display-buffer-at-bottom (window-height . 0.15)))
It should be immediately focused.
(pop-to-buffer "*kmonad-scratchpad*")
Looked at compile.el but couldn't find how it's implemented.
Differences with similar questions:
How to create buffer similar to *compilation* in Emacs? Mine needs to be writable, it messes with evil mode.
Emacs: pop-up bottom window for temporary buffers Don't want to use popwin.el

emacs doc-view new frame

I am new to Emacs and presently I am using it heavily for LaTeXing.
Please help me out with the following customizations:
How to scroll continuously in doc-view-mode? I have
(setq doc-view-continuous t)
in my .emacs file. This enables scrolling through the pages, however, the pages "jump" to the next one. I do not like reading to the bottom of the screen. Is it possible to resolve it?
I invoke doc-view using C-c C-c and the PDF loads into a new window. Is it possible to load it in a new frame?
I have used
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
in my .emacs file. This works fine. However, the first line is just below the top screen. Can I create some margin ONLY on top?
How do I copy/paste from Emacs to other application, like a browser? I couldn't copy the code above using C-w in Emacs and then Ctrl-v in Iceweasel (browser). I had to use Kate, sadly. (This I realized while typing this question!)
Regards,
Saurav Agarwal
You should be able to scroll "line by line" with C-n and C-p.
I do not know that mode (I use tex-mode), but what you probably want is to find out how C-c C-c is invoking doc-view and use it with other-window, for example:
(defun new-frame-dvi-file ()
(interactive)
(split-window-right)
(other-window 1)
(tex-view))
I could not find anything that sets a top margin ONLY, but found this:
(set-frame-parameter nil 'internal-border-width 10)
You can share clipboards with this:
(setq x-select-enable-clipboard t)
Anyway, even if it sounds really boring, sometimes it is really useful to take a look at the manual. Sometimes you don't need to read it all and you can find the answer quickly ;-)
Hope it helps!

How to turn off *input/output* buffer in gud

I recently switched to using GNU Emacs 24 from 23, and I notice that whenever I enter gud the *input/output* buffer is open. I have close it manually with C-x 0 everytime I debug. Can anyone point me to the correct variable which needs to be configured in order to stop displaying this buffer by default?
There is a 'gud-gdb' in new emacs releases that implement the old behavior of gdb/emacs interaction (no dedicated-windows and no I/O buffer). If you don't want to call M-x gud-gdb when you use it you can define an alias for M-x gdb
I have this problem as well. After a quick look at the source code, the problem appears to be that GUD dedicates most of its windows (that is, it calls set-window-dedicated-p on them). A dedicated window is one that cannot be switched away from. I guess more and more young guns are using GUD in many windows mode and want GUD to manage their window layout, and those of us that like to do that manually are in the minority. There doesn't seem to be anything obvious in gdb-mi.el that disables this behavior (for example, gdb-set-window-buffer seems to always do a set-window-dedicated-p to t for all windows it manages).
For now, this solution is more or less the one I'm using -- I manually deactivate the window dedication. This seems suboptimal, though. There ought to be some way to get GUD to let you manually manage the window layout. This question is related.
You can disable window dedication altogether like this: (in Emacs 24.4+)
(defun set-window-undedicated-p (window flag)
"Never set window dedicated."
flag)
(advice-add 'set-window-dedicated-p :override #'set-window-undedicated-p)
Note that this doesn't affect already dedicated windows.

How to make the windowing system's focus switch to another application using elisp?

I want to open the currently editing html page in a browser and then switch the
window system focus to the browser on a key press. I am using gnome desktop environment.
Below is the code (except the focus switching)
(defun open-in-browser()
(interactive)
(save-buffer)
; switch the windowing systems focus to the browser
(let ((filename (buffer-file-name)))
(browse-url (concat "file://" filename))))
(global-set-key (kbd "<f5>") 'open-in-browser)
I have tried using the lower-frame function and suspend-frame function,
both hides the emacs-frame which is not desired since i will not be able to see the code,
apart from that i have to type ALT-TAB twice to swith to emacs-frame again.
How to switch to another application (just like emulation of ALT-TAB in gnome) using
elisp.
The function you are looking for is probably unfocus-frame but it is obsolete. You need a cooperating window manager in order to actually do what you ask.
You cannot do what you are asking for. Changing the focus is the responsibility of the window manager and emacs cannot do it. You could
call an external program from emacs to do what you want
create a keybinding that would combine <f5> and ALT-TAB
There are programs which can be used to control window managers from the command line, so that you can call a command from elisp to activate windows and stuff.
One such program is wmctrl. I don't know if it works with Gnome, you should try it.

How to Save all edited-situations and resume all the situations from the last time when opening Emacs again

I learned that to add those codes in .emacs can make Emacs saves automatically all situations before quitting and start it next time, Emacs can show the last situation and go on editing it.
(load "desktop")
(desktop-load-default)
(desktop-read)
(add-hook 'kill-emacs-hook
'(lambda()(desktop-save "~/")))
but this codes makes a problem that you only can open one Emacs, when you want to start another Emacs at the same time, only the previous one can run.
I want the function saving all situations for the next use, but I also need to start one more Emacs, How can I get the two sides work simultaneously?
Thank you for your help. I am waiting......
Use different desktop files; or use emacsclient instead of emacs to start new editing buffers once you have your main Emacs up and running. There are multiple examples in Google of an emacs alias / function / whatever to start Emacs if it is not running, and otherwise run emacsclient.