
為了防止混淆,我只運行 emacs 的一個“視窗”,因此我在 emacs 意義上使用 window 。我正在尋找一個視窗分割,假設寬度為 70,當我啟動 emacs 時,它包含新分割上的完成緩衝區。我想我需要有一個專門的窗口。我基本上想要實現的目標如下。
+-----+---+
| | A |
| |---|
| C | B |
+-----+---+
C = 我平常工作的地方。 A = 完成緩衝區(我也希望有訊息以及 emacs 向我拋出的所有內容) B = 一個 shell。
為此,我現在在 .emacs 中添加了以下內容:
(split-window-horizontally) ;; want two windows at startup
(other-window 1) ;; move to other window
(shell) ;; start a shell
(other-window 1) ;; move back to first window
我想再次垂直分割右側窗口,並且希望能夠指定每個窗口的尺寸。另外,我希望完成、訊息、...視窗 (A) 的專用屬性為 true,以便 emacs 不會取代它。
我聽說很多人都使用這個設置,但我似乎無法在任何地方找到它。
答案1
最終我能夠透過 .emacs 檔案中的以下內容獲得我想要的內容。
(progn
(interactive)
(split-window-horizontally)
(other-window 1)
(split-window)
(other-window 1)
(eshell)
(other-window 1)) ;; finally change back to scratch window
;; open temporary buffers in a dedicated window split
(setq special-display-regexps
'("^\\*Completions\\*$"
"^\\*Help\\*$"
"^\\*grep\\*$"
"^\\*Apropos\\*$"
"^\\*elisp macroexpansion\\*$"
"^\\*local variables\\*$"
"^\\*Compile-Log\\*$"
"^\\*Quail Completions\\*$"
"^\\*Occur\\*$"
"^\\*frequencies\\*$"
"^\\*compilation\\*$"
"^\\*Locate\\*$"
"^\\*Colors\\*$"
"^\\*tumme-display-image\\*$"
"^\\*SLIME Description\\*$"
"^\\*.* output\\*$" ; tex compilation buffer
"^\\*TeX Help\\*$"
"^\\*Shell Command Output\\*$"
"^\\*Async Shell Command\\*$"
"^\\*Backtrace\\*$"))
(setq grb-temporary-window (nth 1 (window-list)))
(defun grb-special-display (buffer &optional data)
(let ((window grb-temporary-window))
(with-selected-window window
(switch-to-buffer buffer)
window)))
(setq special-display-function #'grb-special-display)
我在 github 上的這個 .emacs 檔案中找到了我需要的東西。
https://github.com/garybernhardt/dotfiles/blob/master/.emacs