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.
Related
See further below for the original question.
I've used gdb for over a couple of decades, and after an update gdb started defeating c-x-b and preventing windows from being used to view things I wanted to see, while forcing bindings to buffers I didn't care to see. The fix seems to have broken tab completion for shells.
Ah, so how can I to stop gdb from taking control of the buffers/windows/frames layout without breaking something else?
;; fix 'feature' of broken gdb where it takes control of an
;; emacs window, and locks the user out from switching from it
;;
(defun set-window-undedicated-p (window flag)
"Never set window dedicated."
flag)
(advice-add 'set-window-dedicated-p :override #'set-window-undedicated-p)
--- problem in the original post --->
about a year back, after an update, file name completion windows in the shell stopped closing after the completion. I figured this behavior would go away on the next release .. but it never has.
hitting tab -- all good
after completion, then another ls with tab
I can repeat this process until my shell panel is all but crowded out, and emacs fills with completion panels that all contain additional views of the shell.
Is this some kind of new feature that can be turned off? Or is it, as seems more likely, a bug? (How can it have lived for so long!?). Is there a simple way without taking one's hands off the keyboard to, in general, close the completion window so that the screen looks like it did before hitting tab?
[I had to take out the more detailed descriptions of the images because with them, stack exchange complained of unformatted code and wouldn't take the post... there was not even a hint of code in them. Anyway, this should be good enough.]
(Emacs newbie here)
Sometimes a Help buffer gets opened in my emacs editor. It opens in a different pane, splitting the current window into two halves vertically.
When I use C-k buffer-name, to kill a buffer (say Help), some other buffer (say scratch) gets opened automatically in that pane.
Is it possible to revert to my previous configuration, after a random buffer (Help or Debug..) gets opened.
My previous configuration would be to go back to a single window with no panes
To revert to the previous window configuration after any arbitrary change(s), you should enable winner-mode in your .emacs file:
(winner-mode 1)
Then you can use C-c<left> (repeatedly, if necessary) to undo window configuration changes with winner-undo.
C-c<right> calls winner-redo which returns you to the most recent configuration (immediately; not in single steps the like the 'undo' command).
Winner mode is the key to never ever getting annoyed by Emacs creating an unwanted window, but it also lets you do things you wouldn't have done before (for instance C-x1 to maximise one of your windows temporarily for easier reading, because getting back all the windows you just deleted is now trivial).
Obviously this is also incredibly useful if you accidentally mess up your window config!
Hello to revert back to one buffer you must hit C-x1 while standing in the buffer you want to keep. And to switch between frames C-xo
When calling ediff, run-python and some other commands, emacs will open a new frame, but I want emacs to open new window instead, is that possible?
Dunno why someone voted you down. Perhaps s?he thought you should have looked first in the Ediff manual (which I too recommend).
a. Command ediff-toggle-multiframe toggles between using multiple frames and a single frame (multiple windows).
b. The Ediff manual says also: "See ediff-window-setup-function for details on how to make
either of these modes the default one."
You will need to check whether Python mode similarly provides options or commands to control the window/frame behavior.
If Emacs is always opening a new frame for everything, then make sure you do not have a non-nil value for option pop-up-frames.
How do I customize which window GUD will use when i issue commands - 'up', 'down', etc ? It seems to use an arbitrary window, sometimes even the window with gdb in it - I want to be able to specify a specific window to be used.
Have you considered borrowing the key bindings mentioned in the following question?
Emacs, switch to previous window
This question implies that GUD steps on some things if you don't add a parameter. Maybe your command bindings are being affected similiarly.
Using gdb in Emacs 23
I asked a buddy of mine about this issue and here is what he said.
Well, we used xemacs and so it's not exactly apples to apples here. I
do have gnu-emacs installed on cygwin and I can't replicate his
problem. I think he definitely needs to list a version # for emacs
and the version # for all his installed packages.
When you press up/down it calls 'previous-line' and 'next-line'
respectively which both move the cursor in the default buffer. The
only thing I can think is that he has something running that switches
buffers (lisp 'set-buffer') temporarily and maybe doesn't set it back
or errors b/f restoring the buffer? Better to use
'with-current-buffer' (or one of the other with-* forms) that saves
the current state of the ui runs your lisp code and restores the ui
state.
I spend a lot of my time in emacs, and for the most part it's wonderful. But one thing really drives me nuts when I'm deep in it, and that's control over which window various new buffers are opened in. When I do find-file, it always opens in the current window, and this is what I like. But tons of other modes like to split my windows for me, change the layout, and do various other things that annoy me. For example running M-x manual-entry seems to have no rhyme or reason about where it opens the manpage, and various org-mode commands do the same thing, closing windows I want to keep open, etc. I don't like having to redo my layout everytime I want to look at my org agenda or open a manpage.
In short, is there anyway to globally control which windows are used for modes that want to open in a window other than the current one? Can I direct them more easily? Or will I have to hack each mode to act the way I want it to?
Try Winner mode:
http://www.emacswiki.org/emacs/WinnerMode
It provides an undo/redo for changes to the window configuration.
This question has always bugged me too. I found this:
http://www.gnu.org/software/emacs/elisp/html_node/Choosing-Window.html
It looks like you can use (setf pop-up-frames t) to make stuff show up in a new frame.
Also, it looks like you can use display-buffer-function to override the display function (how buffers are chosen.) Of course, you'd have to be good at elisp.