1

在 haskell 模式下,C-c C-b打开一个 GHC REPL 进行测试等。然而,它总是在一个与我正在编码的那个大小相等的框架中打开。有一个模式挂钩,inferior-haskell-mode-hook但是我尝试添加一些类似的东西

(add-hook 'inferior-haskell-mode-hook 
    (lambda () (shrink-window 4)))

导致无效或错误消息Cannot resize the root window of a frame。任何建议将不胜感激。

编辑:haskell-mode 的最新更新完全破坏了 REPL 功能,所以这个问题没有实际意义,或者至少在我修复它之前我无法测试答案......

4

2 回答 2

1

Your error says it all, you cannot resize a window if it is the only window in a frame, it doesn't make sense to do so.

If what you want is to actually change the frame height, just use set-frame-height, you could use it in conjunction with frame-height to shrink the frame by 4 lines.

(set-frame-height (current-frame) (- (frame-height (current-frame)) 4)

It could be the case you are not always creating a new frame, in which case you could check if you should actually shrink the window by checking if (window-size-fixed-p (current-window) nil) is 1. Then do shrink-window else shrink the frame.

于 2014-08-27T23:47:08.480 回答
1

正如@Jordan 所说,您可以明确指定创建的框架的大小。

此外,要将框架适合其(通常是唯一的)窗口中显示的缓冲区,您可以使用 library fit-frame.el。我将它绑定到C-x C-_. 如果你还使用库autofit-frame.el,那么你可以让帧自动适应它们的缓冲区。

例如,如果C-c C-b创建一个显示已填充文本的缓冲区的框架(我不知道是否是这种情况),autofit-frame.el则可用于让新框架自动收缩适应缓冲区。

如果不是 - 如果新框架本质上显示一个空缓冲区(例如,用于测试)并且您想要一个更大的框架来输入您要输入的内容,您可以放弃自动拟合并随时手动拟合框架。

或者您可以将命令fit-frame放在钩子上,以根据某些状态或事件将帧适合其缓冲区。

更多信息

于 2014-08-28T02:33:24.720 回答