Make emacsclient split window on open
This commit is contained in:
parent
c9f3658050
commit
c21bb4a9f5
1 changed files with 24 additions and 0 deletions
|
|
@ -288,3 +288,27 @@ they line up with the line containing the corresponding opening bracket."
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(auto-fill-mode 1)
|
(auto-fill-mode 1)
|
||||||
(search-forward-regexp "^$")))
|
(search-forward-regexp "^$")))
|
||||||
|
|
||||||
|
|
||||||
|
;; emacsclient should split window when opening multiple files.
|
||||||
|
;; Based on http://emacs.stackexchange.com/questions/3283/
|
||||||
|
(defvar server-visit-files-custom-find:buffer-count)
|
||||||
|
(defadvice server-visit-files
|
||||||
|
(around server-visit-files-custom-find
|
||||||
|
activate compile)
|
||||||
|
"Maintain a counter of visited files from a single client call."
|
||||||
|
(let ((server-visit-files-custom-find:buffer-count 0))
|
||||||
|
ad-do-it))
|
||||||
|
(defun server-visit-hook-custom-find ()
|
||||||
|
"Arrange to visit the files from a client call in separate windows."
|
||||||
|
(if (zerop server-visit-files-custom-find:buffer-count)
|
||||||
|
(progn
|
||||||
|
(delete-other-windows)
|
||||||
|
(switch-to-buffer (current-buffer)))
|
||||||
|
(let ((buffer (current-buffer))
|
||||||
|
(window (split-window-sensibly)))
|
||||||
|
(switch-to-buffer buffer)
|
||||||
|
(balance-windows)))
|
||||||
|
(setq server-visit-files-custom-find:buffer-count
|
||||||
|
(1+ server-visit-files-custom-find:buffer-count)))
|
||||||
|
(add-hook 'server-visit-hook 'server-visit-hook-custom-find)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue