开发者

aquamacs: windows swapping on C-c C-c (python mode)

I apologize if I use the incorrect terminology here, I've only been using emacs for a few months.

I just reinstalled Aquamacs on a macbook that I reformatted and am having the oddest problem.

I open a .py file, and use C-c ! to open a python shell. So I have (as expected), the .py file in the top window and the python shell in the bottom window.

If I then run C-c C-c (py-execute-buffer) in the .py file, the two windows swap positions. I mean, the .py file buffer opens in the bottom window in a new buffer, while the python shell opens in the top window in a new buffer. So basically, they swap positions. Repeatedly using C-c C-开发者_StackOverflowc swaps the windows back again... so they're shuffling positions. Also, both windows (top and bottom) have both buffers (.py file and python shell) in tabs.

I've not made any modifications to the default settings yet, and I've gotten the problem with both 2.3a and 2.3 (2.3 was on the machine previously and didn't have this problem, so I tried rolling back... to no avail).

Does anyone know how to stop this behavior? Thanks in advance!


Add the following to your Emacs init file in Aquamacs to prevent it from swapping the buffers around:

(defadvice py-execute-buffer
  (around keep-buffers-same activate)
  "Don't swap buffers in Aquamacs."
  (save-window-excursion 
    ad-do-it))


You can also try adding the following to your emacs init file:

(setq py-split-windows-on-execute-p nil)

This will prevent the current window from splitting after you run any py-execute-*. (This also means that the python shell won't show up if it isn't already in one of your windows.)


i don't use Aquamacs and couldn't reproduce your described behaviour, however, try this code to toggle either of the windows as 'dedicated'. locking windows to buffers was the first thing i wanted to do when getting up and running with emacs. maybe this will help you here.

add the code to your '.emacs', then either 'mark' (select) the region 'S-< key-down >' and then 'M-x eval-region' to evaluate it ..or save and restart emacs.

(global-set-key [pause] 'window-dedication-toggle)

(defun window-dedication-toggle (&optional window force quiet)
  "toggle or ensure the 'dedicated' state for a window"
  (interactive)
    (let* ((toggle t) (window (if window window (selected-window))) (dedicated (window-dedicated-p window)))
      (cond ((equal force "on") (setq toggle (eq dedicated nil))) 
            ((equal force "off") (setq toggle (eq dedicated t))))
      (if toggle (progn
        (setq dedicated (not dedicated))
        (set-window-dedicated-p window dedicated)
        (if (not quiet)
        (message "window %sdedicated to %s" (if (not dedicated) "no longer " "") (buffer-name)))))))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜