aquamacs:C-C-C上的windows交换(python模式)

aquamacs:C-C-C上的windows交换(python模式),python,emacs,aquamacs,Python,Emacs,Aquamacs,如果我在这里使用了不正确的术语,我很抱歉,我只使用了几个月的emacs 我刚刚把Aquamacs重新安装在一个我重新格式化的macbook上,遇到了最奇怪的问题 我打开一个.py文件,然后使用C-C!打开python shell。因此,正如预期的那样,顶部窗口中有.py文件,底部窗口中有pythonshell 如果然后在.py文件中运行C-C-C py execute buffer,则两个windows交换位置。我的意思是,.py文件缓冲区在新缓冲区的底部窗口中打开,而python shell在

如果我在这里使用了不正确的术语,我很抱歉,我只使用了几个月的emacs

我刚刚把Aquamacs重新安装在一个我重新格式化的macbook上,遇到了最奇怪的问题

我打开一个.py文件,然后使用C-C!打开python shell。因此,正如预期的那样,顶部窗口中有.py文件,底部窗口中有pythonshell

如果然后在.py文件中运行C-C-C py execute buffer,则两个windows交换位置。我的意思是,.py文件缓冲区在新缓冲区的底部窗口中打开,而python shell在新缓冲区的顶部窗口中打开。所以基本上,他们交换位置。反复使用C-C C-C将再次交换窗口。。。所以他们在调整位置。此外,windows顶部和底部的选项卡中都有buffers.py文件和python shell

我还没有对默认设置进行任何修改,我发现2.3a和2.3都有问题。2.3以前在机器上,没有这个问题,所以我尝试回滚。。。无济于事


有人知道如何阻止这种行为吗?提前谢谢

我不使用Aquamacs,也无法重现您描述的行为,但是,请尝试使用此代码将任一窗口切换为“专用”。在启动和运行emacs时,我想做的第一件事就是将窗口锁定到缓冲区。也许这对你有帮助

将代码添加到“.emacs”中,然后“标记”选择区域的-,然后选择“M-x eval region”对其求值..或者保存并重新启动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)))))))

将以下内容添加到Aquamacs中的Emacs init文件中,以防止其交换缓冲区:

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

您还可以尝试将以下内容添加到emacs init文件中:

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

这将防止在运行任何py execute-*后拆分当前窗口。这也意味着,如果python shell尚未出现在您的某个窗口中,它将不会出现。

请注意;我阅读了GNU Emacs中包含的python.el,它的C-C-C不能做到这一点。所以它一定是由aquamacs引入的。@jrockway:py-*函数来自python-mode.el,python-*函数来自python.el旧的或新的。当我调用C-C-C时,仍然有一些诡计。。。窗口/缓冲区快速交换。。。。但不到半秒钟,最终结果就是我想要的。谢谢