stop emacs swapping windows when setting breakpoints - emacs

Context: This is GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) running on Debian 6.0.7.
When running pdb (M-x pdb), emacs switches which buffer is in which window when I set a breakpoint. I've searched the internet and here, and haven't yet found a way to stop this. Here's the scenario:
I'm using a wide window which is split hoirizontally for side-by-side working. Once I've started pdb (M-x pdb) with my python file, I have one window which has my debug session (indicating gud-pathfile.py). The other window has my pathfile.py source file. Each time I click on a line in the source and then click on the red "set breakpoint" button, the windows swap (if the .py file was in the right window, it's now in the left, etc.).
Thank you for your time and help.
Blessings,
Doug

Here's a standard solution. It makes it very easy to restore the
previous window configuration.
(winner-mode)
(global-set-key (kbd "<f7>") 'winner-undo)
(global-set-key (kbd "C-<f7>") 'winner-redo)

Related

How do I exit Emacs from the terminal?

I just installed Emacs 26.3 on Ubuntu 20.04. I opened a buffer in the terminal, and I cannot close it. C-x C-c does nothing. f10 to activate the menu does not activate the menu.
I'm using a .emacs file that maps cut/copy/paste commands to the normal C-x/C-c/C-v. I don't think that this can affect the issue, however, because I have the exact same setup (including the same .emacs file) on by Emacs 24.5/Ubuntu 16.04 laptop, and it has no problem exiting with C-x C-c. Also, I had the exact same problem before I installed the .emacs file on the new system.
How do I kill Emacs?
This question exists, but it has no useful answers.
ESC x save-buffers-kill-terminal
OFC binding C-x will affect C-x C-c. You don't need to know anything about Emacs to realize the problem. Just think twice.

emacs sr-speedbar ubuntu - same window

I am on ubuntu. Just installed sr-speebar via marmalade. I know speedbar comes built in but I was not able using the wiki directions to get it into the same frame.
So I installed via marmalde this package speedar Maramalade
I have put (require 'sr-speedbar) in my .emacs.
The issue is that on Ubuntu windows key opens a window mode. So I can't test it. there are a whole pile of comands but I can't get it too work.
`sr-speedbar-open' Open `sr-speedbar' window. `sr-speedbar-close' Close `sr-speedbar' window.
.
How could I get this working?
Update:
set the keyboard shortcut
(require 'sr-speedbar)
(global-set-key (kbd "<f6>") 'sr-speedbar-open)
However now I get this error
Symbol's function definition is void: sr-speedbar-open

In emacs, query-replace-regexp keyboard shortcut doesn't work in the terminal (e.g., emacs -nw)

Is it expected that C-M-% and ESC C-% do not run the command query-replace-regexp when running emacs in a terminal window (for example, emacs -nw)?
According to describe-function the binding exists, but emacs runs query-replace instead (which has the binding M-%). This has happened on several machines I've tried it on, and does not happen when I run emacs in a window.
The problem is that C-% simply can't be typed in a terminal. The only control sequences available are those that corresponds to ascii-code 0-31, mainly C-letter.
I have created a new shortcut in my .emacs file.
(global-set-key "\M-q" 'query-replace-regexp)
Control-Alt-Shift-% all together works on Windows and Fedora Linux. Does your keyboard have all those keys?

Emacs uses dvi2tty instead of evince to open dvi

I started to use emacs for LateX editing again. Back in the days, it was configured automatically that C-c C-f would open the corresponding *.dvi file with evince. With the latest version of emacs, it does not do the same. Is there a way to open the doc with evince? (I am sure there is a way. It is emacs afterall).
Thanks!
I use this code with auctex-mode:
;; use evince for dvi and pdf viewer
;; evince-dvi backend should be installed
(setq TeX-view-program-selection
'((output-dvi "DVI Viewer")
(output-pdf "PDF Viewer")
(output-html "Google Chrome")))
(setq TeX-view-program-list
'(("DVI Viewer" "evince %o")
("PDF Viewer" "evince %o")
("Google Chrome" "google-chrome %o")))
You didn't mention if you're using auctex-mode or the old latex-mode that comes bundled with Emacs.
Depending on whether you are using AUCTeX or emacs' default LaTeX mode there are different configuration options to set this. I would suggest you have a look at them with customize-browse since the config strings can be pretty dense.
With AUCTeX
Browse to Emacs > Wp > Tex > AUCTeX > Tex Command > TeX View > TeX View Program Selection. Change the output-dvi viewer.
Plain LaTeX mode
Browser to Emacs > Wp > Tex > Tex View > Tex Dvi View Command.
Also, instead of directly hardcoding evince I would suggest putting xdg-open there and configuring your preferred dvi-viewer in your desktop environment. Then you need to worry about only one place to configure this in the future.
I had the same problem even with the correct settings for view commands. I had started the Emacs daemon from a shell inside screen. I then connected to the server with emacsclient using an X window. AucTeX checks two settings to see if you're using a window system and both are nil or undefined (the $DISPLAY variable and (window-system)) inside screen where I started the server.
So in my case, starting the Emacs daemon from a shell running in an X window solved the problem.
I guess it would help if AucTeX checked the variables for each Emacs frame separately because it shouldn't matter where the server was started but what kind of client (tty or X) you use AucTeX in.

Emacs 23.1 and Mac OS X problem with files drag and drop

I've just compiled and installed emacs 23.1 on my mac. It's running Leopard 10.5.8. And I've noticed that dragging and dropping does not work correctly (as it used to work with emacs 22). Now when dragging a file to the emacs icon on the dock, Emacs will start with two windows (frames in its terminology), one showing the startup screen and the other with the contents of the file. I've tried to get rid of this behaviour and I've set 'inhibit-startup-screen' option to t. But that only helped with this problem.
The other problem that I have is that when dragging a file onto a running emacs window, it justs shows the contents of the file in the existing buffer, instead of opening a new buffer (named the same as the file).
Any help with that?
I've compiled emacs myself using guidlines from this page:
link text
Also I've noticed that this version of Emacs has been rather flaky - it crashed a few times. I do not remember such situations when using previous versions. Any help will be highly appreciated.
Just to have the information regarding this problem more complete - there's a whole page in emacs info dedicated to Mac OS X builds.
Here's the link to web version: emacs info about ns events
Also I've found that when using Emacs 23 as an external editor for XCode, each file gets opened in a different frame (window). To fix this, just add:
(setq ns-pop-up-frames nil)
to your .emacs file
Putting the following in your .emacs file will help. You will either have to restart Emacs or evaluate the code.
(define-key global-map [ns-drag-file] 'my-ns-open-files)
(defun my-ns-open-files ()
"Open files in the list `ns-input-file'."
(interactive)
(mapc 'find-file ns-input-file)
(setq ns-input-file nil))