LoginSignup
12
11

More than 5 years have passed since last update.

Emacs の window が横に分割されるのを防ぐ

Last updated at Posted at 2016-08-18

問題点: window が横に分割されると見づらい

Emacs で何か処理を実行して出力が別の window に表示されるとき、 split-window-sensibly が内部で実行されている。これは window に合わせて自動的に最適に window を分割してくれる関数。つまり横幅が長いなら垂直に分割して、縦が長いなら水平に分割する。

最近のPCは横長のディスプレイが多いので横に分割される事が多いが、行の長い出力を読む時は折り返されてしまうので私は 常に水平に分割して欲しい。

解決策: split-width-threshold に nil を設定する

split-width-threshold のヘルプを見ると、

If this is nil, ‘split-window-sensibly’ is not allowed to split a window horizontally.

との事。

つまり下記で解決した。

(setq split-width-threshold nil)

参考

挙動がいまいち不明だったので、ついでにもう少し調べる。

How display-buffer works(GNU Emacs Manual) によると

If split-height-threshold is smaller than the selected window’s height, the split puts the new window below.

split-height-threshold の値が選択したウィンドウより小さい場合は、下側にウィンドウが分割されます。

Otherwise, if split-width-threshold is smaller than the window’s width, the split puts the new window on the right.

そうでない場合、 split-width-threshold がウィンドウの横幅より小さい場合は、右側に分割されます。

If neither condition holds, Emacs tries to split so that the new window is below—but only if the window was not split before

どちらも満たさず、既にウィンドウが分割されてない場合は、下側にウィンドウを表示します。

先に split-height-threshold が評価されるらしい。

12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11