emacs swaps windows

Harry George harry.g.george at boeing.com
Wed Nov 10 09:30:22 EST 2004


tschulz <thomas.schulz at esands.com> writes:

> In emacs' python-mode, a file can be executed by pressing Ctrl-C
> Ctrl-C. If the code execution terminates with an Exception, emacs
> swaps the source code window and the python output window.
> Is there a way to stop that annoying behavior?
> 
> Tom

Personally I spit windows, open a shell, and run a script called "go"
(typically by doing alt-p to get previous commandline), which sets
paths and other variables before calling the program.  So ^C^C never
is an issues.

However, a similar behavior with emacs's dired is solved with:

;;;----------------------------------------------------------------------
;;; Change C-x C-b buffer listing so that the current window is used
;;; if more than one window is displayed, otherwise splits the window.
;;; 
(defun my-list-buffers (&rest args)
  (interactive)
  (let ((buff-window (get-buffer-window "*Buffer List*")))
    (if (and (not buff-window)		; Not visible.
	     (not (one-window-p 'no-mini))) ; Multiple windows.
	;; Attach "*Buffer List*" to current window.
	(switch-to-buffer "*Buffer List*")))
  (apply 'list-buffers args)
  (pop-to-buffer "*Buffer List*")	; Go there.
  (forward-line 3))			; Skip usually uninteresting stuff.

(global-set-key "\C-x\C-b" 'my-list-buffers)

;;;----------------------------------------------------------------------
;;; Modified from original in buff-menu.el, this one buries the
;;; menu buffer after selecting a buffer.
;;; 
(defun Buffer-menu-this-window ()
  "Select this line's buffer in this window, and bury menu buffer."
  (interactive)
  (let ((menu-buffer (current-buffer)))
    (switch-to-buffer (Buffer-menu-buffer t))
    (bury-buffer menu-buffer)))


-- 
harry.g.george at boeing.com
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718



More information about the Python-list mailing list