reasonable term windows
This commit is contained in:
parent
d14f72a188
commit
903067e0ef
1 changed files with 25 additions and 49 deletions
74
emacs/.emacs
74
emacs/.emacs
|
@ -37,6 +37,13 @@
|
|||
(quote
|
||||
(swiper neotree centered-cursor-mode ivy avy heroku-theme auto-complete use-package yasnippet evil-surround org evil-magit magit makefile-runner evil)))
|
||||
'(scroll-bar-mode nil)
|
||||
'(shell-pop-shell-type
|
||||
(quote
|
||||
("ansi-term" "*ansi-term*"
|
||||
(lambda nil
|
||||
(ansi-term shell-pop-term-shell)))))
|
||||
'(shell-pop-window-position "top")
|
||||
'(shell-pop-window-size 20)
|
||||
'(tool-bar-mode nil))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
|
@ -190,33 +197,11 @@
|
|||
;; Easy terminal
|
||||
(setq my/default-shell (or (executable-find "zsh") (executable-find "bash")))
|
||||
|
||||
(defun term-split ()
|
||||
"creates terminal window below"
|
||||
(interactive)
|
||||
(let ((window (split-window-below -7)))
|
||||
(select-window window)
|
||||
(term my/default-shell)
|
||||
(set-window-dedicated-p window t)))
|
||||
;
|
||||
;(use-package term
|
||||
; :bind ("C-x t" . term-split))
|
||||
;
|
||||
;(defun term-handle-exit--close-buffer (&rest args)
|
||||
; (let ((term-window (get-buffer-window "*terminal*")))
|
||||
; (when (and term-window (window-dedicated-p term-window))
|
||||
; (delete-window term-window))))
|
||||
|
||||
;(advice-add 'term-handle-exit :after #'term-handle-exit--close-buffer)
|
||||
|
||||
;(add-to-list 'display-buffer-alist
|
||||
; '("\\*terminal\\*" display-buffer-pop-up-window))
|
||||
|
||||
(defun my/term ()
|
||||
(interactive)
|
||||
(term my/default-shell))
|
||||
|
||||
(use-package term
|
||||
:bind ("C-x t" . my/term))
|
||||
(use-package shell-pop
|
||||
:ensure t
|
||||
:bind ("C-x t" . shell-pop)
|
||||
:config
|
||||
(setq-default shell-pop-term-shell my/default-shell))
|
||||
|
||||
;; tabbing (doesn't really work yet)
|
||||
(setq-default indent-tabs-mode t)
|
||||
|
@ -229,28 +214,19 @@
|
|||
;; compilation buffer
|
||||
; Set buffer scrolling
|
||||
(setq compilation-scroll-output 'first-error)
|
||||
|
||||
; kill window if successfull
|
||||
;(defun bury-compile-buffer-if-successful (buffer string)
|
||||
; "Bury a compilation buffer if succeeded without warnings "
|
||||
; (when (and
|
||||
; (buffer-live-p buffer)
|
||||
; (string-match "compilation" (buffer-name buffer))
|
||||
; (string-match "finished" string)
|
||||
; (not
|
||||
; (with-current-buffer buffer
|
||||
; (goto-char (point-min))
|
||||
; (search-forward "warning" nil t))))
|
||||
; (run-with-timer 1 nil
|
||||
; (lambda (buf)
|
||||
; (bury-buffer buf)
|
||||
; (switch-to-prev-buffer (get-buffer-window buf) 'kill))
|
||||
; buffer)))
|
||||
;(add-hook 'compilation-finish-functions 'bury-compile-buffer-if-successful)
|
||||
; set window height
|
||||
(setq compilation-window-height 10)
|
||||
|
||||
(defun my-compilation-hook ()
|
||||
(defun my/compilation-bury-buffer-without-error (buffer string)
|
||||
(cond ((string-match "finished" string)
|
||||
(message "Build maybe successful: closing window.")
|
||||
(run-with-timer 3 nil
|
||||
'delete-window
|
||||
(get-buffer-window buffer t)))
|
||||
(t (message "Compilation exited abnormaly: %s" string))))
|
||||
|
||||
(setq compilation-finish-function 'my/compilation-bury-buffer-without-error)
|
||||
|
||||
(defun my/setup-compilation-window ()
|
||||
(when (not (get-buffer-window "*compilation*"))
|
||||
(save-selected-window
|
||||
(save-excursion
|
||||
|
@ -259,7 +235,7 @@
|
|||
(select-window w)
|
||||
(switch-to-buffer "*compilation*")
|
||||
(shrink-window (- h compilation-window-height)))))))
|
||||
(add-hook 'compilation-mode-hook 'my-compilation-hook)
|
||||
(add-hook 'compilation-mode-hook 'my/setup-compilation-window)
|
||||
|
||||
;; Window movement
|
||||
; Old keys
|
||||
|
@ -314,7 +290,7 @@
|
|||
(add-to-list 'display-buffer-alist
|
||||
'("*Apropos*" display-buffer-same-window))
|
||||
(add-to-list 'display-buffer-alist
|
||||
'("*Help*" display-buffer-same-window))
|
||||
'("*Help*" display-buffer-in-side-window))
|
||||
|
||||
;; Change all prompts to y or n
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
|
|
Loading…
Reference in a new issue