2

我正在使用 Emacs 在 python 中编码。我已经修改了“.emacs”以满足我的需要。但是,我不知道在执行当前缓冲区时如何更改窗口的默认垂直拆分行为。

我知道:

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

一般工作。但是当我第一次使用执行缓冲区时它不起作用C-c C-c

尽管在我的 ~/.emacs 中有上述代码,但以下情况发生在C-c C-c垂直分割:(

我希望我的问题很清楚,如果您对此有任何想法,请告诉我。

4

1 回答 1

1

I use the following. It fixes your problem (I hope) as well as preventing Emacs from splitting windows in the first place.

;;; ------------------------------------------------------------------
;;; 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)
于 2012-12-16T18:44:18.737 回答