0

Emacs は、水平に分離された 2 つのウィンドウを上下に開く傾向があります (windows は適切な emacs 用語だと思います)。私はワイドスクリーンで作業しているので、emacs フレーム内に並べて配置された 2 つの垂直に分離されたウィンドウで作業する方が簡単で優れていることがわかります。

を使用して垂直に分割された新しいウィンドウを開く方法は知ってC-x 3いますが、emacs 自体が開くウィンドウをどのように再配置しますか (たとえばM-x compile、コンパイル/デバッグ ウィンドウを開いて呼び出されたとき)、水平から垂直に変更するにはどうすればよいですか?

4

3 に答える 3

1

split-height-threshold変数と変数を見てくださいsplit-height-threshold。どちらもカス​​タマイズ可能です。

それらが取る値の詳細については、C-h f split-window-sensibly RET. この Emacs Lispは、トピックに表面的に触れています。

display-bufferこれは、おそらくcompile他の多くのコマンドが使用する動作に影響します。

于 2012-11-03T23:42:19.653 に答える
1

私は同じ問題を抱えていました。これは私が現在使用しているものです。それを Emacs の init ファイルにドロップするだけです:

;; The default behaviour of `display-buffer' is to always create a new
;; window. As I normally use a large display sporting a number of
;; side-by-side windows, this is a bit obnoxious.
;;
;; The code below will make Emacs reuse existing windows, with the
;; exception that if have a single window open in a large display, it
;; will be split horisontally.

(setq pop-up-windows nil)

(defun my-display-buffer-function (buf not-this-window)
  (if (and (not pop-up-frames)
           (one-window-p)
           (or not-this-window
               (not (eq (window-buffer (selected-window)) buf)))
           (> (frame-width) 162))
      (split-window-horizontally))
  ;; Note: Some modules sets `pop-up-windows' to t before calling
  ;; `display-buffer' -- Why, oh, why!
  (let ((display-buffer-function nil)
        (pop-up-windows nil))
    (display-buffer buf not-this-window)))

(setq display-buffer-function 'my-display-buffer-function)
于 2012-11-03T23:07:22.187 に答える
0

これが私の解決策です:

(defun split-window-prefer-side-by-side (&optional window)
  (let ((split-height-threshold (and (< (window-width window)
                                        split-width-threshold)
                                     split-height-threshold)))
    (split-window-sensibly window)))

(setq split-window-preferred-function 'split-window-prefer-side-by-side)

これは依然としてsplit-*-threshold変数値を参照しますが、両方の分割方向が許容される場合は、ウィンドウを並べて表示することを優先します。

于 2012-11-08T02:51:24.233 に答える