2

如果我在这里使用了不正确的术语,我深表歉意,我只使用 emacs 几个月。

我刚刚在我重新格式化的 Macbook 上重新安装了 Aquamacs,但遇到了最奇怪的问题。

我打开一个 .py 文件,然后使用 Cc !打开一个python shell。所以我有(如预期的那样),顶部窗口中的 .py 文件和底部窗口中的 python shell。

如果我在 .py 文件中运行 Cc Cc (py-execute-buffer),两个窗口交换位置。我的意思是,.py 文件缓冲区在新缓冲区的底部窗口中打开,而 python shell 在新缓冲区的顶部窗口中打开。所以基本上,他们交换位置。反复使用 Cc Cc 将窗口再次交换回来......所以他们正在洗牌。此外,两个窗口(顶部和底部)在选项卡中都有缓冲区(.py 文件和 python shell)。

我还没有对默认设置进行任何修改,并且我遇到了 2.3a 和 2.3 的问题(2.3 之前在机器上并且没有这个问题,所以我尝试回滚......徒劳无功)。

有谁知道如何阻止这种行为?提前致谢!

4

3 回答 3

2

将以下内容添加到 Aquamacs 中的 Emacs 初始化文件中,以防止它交换缓冲区:

(defadvice py-execute-buffer
  (around keep-buffers-same activate)
  "Don't swap buffers in Aquamacs."
  (save-window-excursion 
    ad-do-it))
于 2011-08-10T22:40:20.923 回答
1

您还可以尝试将以下内容添加到您的 emacs 初始化文件中:

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

这将防止在您运行任何 py-execute-* 后当前窗口分裂。(这也意味着如果 python shell 尚未在您的一个窗口中,则不会显示它。)

于 2012-07-20T23:05:36.873 回答
0

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

将代码添加到您的“.emacs”,然后“标记”(选择)区域“S-< key-down >”,然后“Mx 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)))))))
于 2011-08-10T22:17:23.960 回答