2012-12-16 51 views
2

我在使用Emacs的python编码。我修改了“.emacs”以适应我的需求。但是,我不知道如何在执行当前缓冲区时更改窗口的默认垂直拆分行为。如何在执行当前缓冲区时在emacs中水平分割窗口?

我知道:

(setq split-height-threshold nil) 
(setq split-width-threshold 0) 

的作品一般。但是,当我使用C-c C-c

首次执行缓冲尽管有在我的〜/的.emacs上面的代码中这是行不通的,下面发生在C-c C-cvertical split :(

我希望我的问题是清楚的,让我知道你是否有任何想法。

+0

有趣的是,当我的Emacs框架的宽度大于它是高,Emacs的由defualt打开的窗口并排侧... – lukstafi

+0

我现在做'CX 3',但我敢肯定,必须有一个方式使它在Emacs默认为Python-IDE – Chirag

+0

@lukstafi ...这不是我所观察到的。 – Chirag

回答

1

我使用以下内容。它修复了你的问题(我希望),以及防止Emacs首先分裂窗口。

;;; ------------------------------------------------------------------ 
;;; display-buffer 

;; 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) 
+0

我试过了,它没有工作。我认为这可能是因为我使用某个dot-el文件打开了其他一些设置。 – Chirag

+0

你的画幅宽度是否低于162?因为这是上面代码片段中的硬编码值。 – Dmitry

+0

无论窗口大小如何,它都不会水平分割。 – Chirag

相关问题