7

(ターミナル) Emacs で作業していて、水平分割を使用して画面に 2 つのバッファーがある場合:

+--------------------------+
|                          |
|                          |
|                          |
|                          |
+--------------------------+
|                          |
|                          |
|                          |
|                          |
+--------------------------+

次に、スライム repl を開くことにします。Emacs は、これらの水平ペインの 1 つを垂直に分割します。

+--------------------------+
|                          |
|                          |
|                          |
|                          |
+-------------+------------+
|             |            |
|             |  slime     |
|             |            |
|             |            |
+-------------+------------+

しかし、私が望むのは、ウィンドウの高さ全体を使用して、右側にスライムを配置することです:

+-------------+------------+
|             |            |
|             |            |
|             |            |
|             |            |
+-------------+  slime     |
|             |            |
|             |            |
|             |            |
|             |            |
+-------------+------------+

Emacs が自動的に私に与えた配置から、私が望むもの (回転配置など) に到達する簡単な方法はありますか、それともウィンドウを自分で明示的に閉じて再分割する必要がありますか?

編集 | また、現在完全な水平分割を使用している場合、完全な垂直分割を直接開くことができるかどうか、または事実上不可能であるかどうかにも興味があります.

4

3 に答える 3

4

事前に設定されたウィンドウ構成が好きな場合は、「ワークスペース管理」パッケージをご覧ください。

  • パースペクティブは、名前付きのワークスペースを提供します
  • Equilibrium Emacs Window Managerは似ていますが、より洗練されたツールで、ポップアップの配置、ウィンドウの構成、バッファー、フォント、およびキーバインドを構成できます。

EmacsWiki のプロジェクト管理ページに詳細があります。

2番目の質問に対して、水平/垂直分割を反転するために私の構成にあるものは次のとおりです(クレジット: https://github.com/yyr/emacs.d ):

(defun split-window-func-with-other-buffer (split-function)
  (lexical-let ((s-f split-function))
    (lambda ()
      (interactive)
      (funcall s-f)
      (set-window-buffer (next-window) (other-buffer)))))

(defun split-window-horizontally-instead ()
  (interactive)
  (save-excursion
    (delete-other-windows)
    (funcall (split-window-func-with-other-buffer 'split-window-horizontally))))

(defun split-window-vertically-instead ()
  (interactive)
  (save-excursion
    (delete-other-windows)
    (funcall (split-window-func-with-other-buffer 'split-window-vertically))))

(global-set-key "\C-x|" 'split-window-horizontally-instead)
(global-set-key "\C-x_" 'split-window-vertically-instead)
于 2013-07-02T13:50:11.587 に答える
3

フレームのウィンドウ構成 (反転、回転など) を変換するためのライブラリや、利用可能なウィンドウを介して可視バッファを回転させるための他のライブラリが確かに存在します。それらを組み合わせると、目的が達成されます。

私は前者のTransposeFrameが好きで、後者には少なくともいくつかのオプションがあります。

一般に、Wiki のCategoryWindowsは役に立つはずです。

ウィンドウ構成の変換では、分割を削除して再作成する必要があることに注意してくださいそのため、元のウィンドウ オブジェクトのすべてがプロセスを生き残るわけではありません。その点で、あなたが求めていることを実際に行うことはできませんしかし、ほとんどの場合、「偽装」で十分です。

于 2013-07-01T23:58:27.843 に答える
1

これがあなたが望むことをする関数です。emacsにロードした後、再配置したいバッファを選択してM-x my-shift-window-right. でキーにバインドすることもできますglobal-set-key

(defun my-shift-window-right (&optional start-window)
  "Reset the current window configuration with START-WINDOW
on the right and the rest of the windows on the left. START-WINDOW defaults to
the selected window. Return START-WINDOW, or nil if START-WINDOW isn't live or
if there is only one visible window."
  (interactive (list (selected-window)))
  (if (or (one-window-p)
          (and start-window
               (not (window-live-p start-window)))) nil
    (let ((other-buffers '())
          (start-window (or start-window (selected-window))))
      ;; add all visible buffers other than the current one to other-buffers list
      (walk-windows #'(lambda (window)
                        (when (not (eq window start-window))
                          (add-to-list 'other-buffers (window-buffer window)))))
      (delete-other-windows)
      ;; pop the first "other buffer" into a split window on the left
      (set-window-buffer (select-window (split-window start-window nil 'left))
                         (pop other-buffers))
      ;; make a split window for each buffer in the "other-buffers" list
      ;; select the start-window and return it when finished
      (dolist (buffer other-buffers (select-window start-window))
        (set-window-buffer (split-window (selected-window) nil 'above) buffer)))))

この関数は、他の可視ウィンドウを循環し、それぞれのバッファを というリストに格納しますother-buffers。次に、リストを反復処理することにより、説明した方法でウィンドウを再配置しますother-buffers

于 2013-07-02T16:44:07.850 に答える