geiser-eval-buffer switch to different frame - emacs

I am trying out geiser and after evaluating it always switch to different frame with different buffer than my source code. Could this be prevented? Is it possible to stay after pressing C-c C-b in my current buffer?

Do you mean it switches to a different window? If so, you may want to check out the variables geiser-debug-jump-to-debug-p and geiser-debug-show-debug-p, which control changing focus to the * Geiser dbg * buffer and showing it at all, respectively.

Related

Emacs switch-to-buffer (C-x b) will change window if the buffer is opened in some other window

I would like to change the behavior of switch-to-buffer to always open the desired buffer in the current window instead of switching to another window if already opened.
My rationale for doing this :
I have 2 screens, one Emacs on each. One is for reading, the other one for writing. Some buffers will be in the reading side for a while, but now I want to edit them. I'd like to have them in front of me instead of automatically switch to this other window on the side.
Thank you.
That is what switch-to-buffer does - exactly what you say you want. Do you see something different when you start Emacs without an init file (emacs -Q)?
The only exception is when the window cannot be used for that buffer. As the doc string says:
If the selected window cannot display the specified
buffer (e.g. if it is a minibuffer window or strongly dedicated
to another buffer), call `pop-to-buffer' to select the buffer in
another window.

Can I disable window-splitting in a particular frame?

I'm a developer who uses emacs. In emacs I use multiple frames (what most people would call X windows), and the compile function for my builds. I like to have one frame for my compilation buffer, and the others for source. That allows me to navigate to build errors easily and get a nice big view of the source I'm investigating along side a nice big view of my build output. This works fine when I use the 'next-error' function from a source frame.
But when I move my pointer into the compilation frame, and click on an error, it vertically splits that frame to show the relevant source. I want it to show the relevant source in one of my other frames.
Is there a way to "lock" a frame so that it won't be split into windows, and so other frames will be used instead? I'm OK if it splits one of my other frames to display the new source files - just not the compilation frame (because that means I have to unsplit that frame and then switch the buffer of a different frame to display the buffer in question - that's cumbersome).
Alternatively it would be fine if I could use a different mouse button on an error in the compilation buffer to say "visit this file and line in a different frame".
I believe you can achieve your goals by making the window in your "compile frame" dedicated:
Functions for displaying a buffer can be told to not use specific windows by marking these windows as dedicated to their buffers.
Interactively, M-x set-window-dedicated-p should make your window dedicated.
From elisp, something like
(set-window-dedicated-p (selected-window) 1)
should do the same. Replacing 1 with t will make the window strongly dedicated:
As a special case, if flag is t, window becomes strongly dedicated to its buffer. set-window-buffer signals an error when the window it acts upon is strongly dedicated to its buffer and does not already display the buffer it is asked to display. Other functions do not treat t differently from any non-nil value.

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.

Emacs Lisp - opening new window

I'd like to write an emacs lisp function that will write output to a window other than the current window. It should create a new window if only the current one exists, and it should use an existing one otherwise. This is similar to what happens when you run C-h-f (Describe Function), and the description pops up in another window. What is the best way to do this?
See display-buffer:
display-buffer is an interactive
compiled Lisp function in `window.el'.
It is bound to C-x 4 C-o.
(display-buffer buffer-or-name
&optional not-this-window frame)
Make buffer buffer-or-name appear in
some window but don't select it.
buffer-or-name must be a buffer or the
name of an existing buffer. Return
the window chosen to display
buffer-or-name or nil if no such
window is found.
Optional argument not-this-window
non-nil means display the buffer in a
window other than the selected one,
even if it is already displayed in the
selected window.
Optional argument frame specifies
which frames to investigate when the
specified buffer is already displayed.
If the buffer is already displayed in
some window on one of these frames
simply return that window. Possible
values of frame are:
`visible' - consider windows on all
visible frames.
0 - consider windows on all visible or
iconified frames.
t - consider windows on all frames.
A specific frame - consider windows on
that frame only.
nil - consider windows on the selected
frame (actually the last
non-minibuffer frame) only. If,
however, either
display-buffer-reuse-frames' or
pop-up-frames' is non-nil (non-nil
and not graphic-only on a text-only
terminal), consider all visible or
iconified frames.
Or you can use pop-to-buffer if you want that buffer to be selected (which it sounds like you don't), or with-output-to-temp-buffer which binds the standard-output to be sent to the temporary buffer - read the documentation for more details (hat tip to Michael for that).

Emacs - Multiple columns one buffer

I'm trying to edit some assembly code which tends to be formatted in long but thin listings. I'd like to be able to use some of the acres of horizontal space I have and see more code on-screen at one time. Is there a method for getting Emacs (or indeed another editor) to show me multiple columns all pointing to the same buffer?
C-x 3 (emacs) and :vsplit (vim) are great for multiple separate views into the code, but I'd like it to flow from one column to the other (like text in a newspaper).
See follow-mode.
Excerpt:
Follow mode is a minor mode that makes two windows, both showing the same buffer, scroll as a single tall “virtual window.” To use Follow mode, go to a frame with just one window, split it into two side-by-side windows using C-x 3, and then type M-x follow-mode. From then on, you can edit the buffer in either of the two windows, or scroll either one; the other window follows it.
In Follow mode, if you move point outside the portion visible in one window and into the portion visible in the other window, that selects the other window—again, treating the two as if they were parts of one large window.
I use this function to invoke follow-mode, although it would need customization for a different screen size:
;;; I want a key to open the current buffer all over the screen.
(defun all-over-the-screen ()
(interactive)
(delete-other-windows)
(split-window-horizontally)
(split-window-horizontally)
(balance-windows)
(follow-mode t))
The "Multipager" plugin for Vim can do this with VIM splits for people who want to get this behavior in Vim.
Get it from Dr. Chip's page: http://mysite.verizon.net/astronaut/vim/index.html#MPAGE
Docs: http://mysite.verizon.net/astronaut/vim/doc/mpage.txt.html
Vim can do this using :vsplit - and you can have the same buffer open in multiple "windows" (which are actually sections within a single "window").
Documentation here
A quick look at the emacs wiki doesn't show a mode like you describe. However, it shouldn't be too hard to write one... You just need to split the window with C-x 3 and move the text in the other window down, and whenever you move the text, do the same to the other window...
Problems may occur when you get to the bottom of the buffer, do you want the cursor to immediately go to the other window at the top?
Hmm, maybe its not that easy. But it should still be doable...
this is the default behaviour of emacs when splitting the window (C-x 3 for vertical split)
you get two columns which both have the current buffer open
Use vertical-split with C-x 3. This will split the current buffer into two columns that you can switch between with C-x o.