From 28d8f463f73de9db3d8a240f08bfaf2d31b21198 Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Tue, 28 Nov 2017 00:17:57 +0100 Subject: [PATCH] Emacs: more advanced ansi-term / term configuration --- emacs/emacs.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/emacs/emacs.el b/emacs/emacs.el index d9af471..5292520 100644 --- a/emacs/emacs.el +++ b/emacs/emacs.el @@ -889,3 +889,28 @@ :config (setq company-quickhelp-delay 0.5)) +;; term / ansi-term +;; terminal in emacs +(use-package term + :defer t + :init (defalias 'sh 'ansi-term) + :config + ;; set default shell + ;; from https://ogbe.net/emacsconfig.html + (defvar my-term-shell "/usr/bin/fish") + (defadvice ansi-term (before force-bash) + (interactive (list my-term-shell))) + (ad-activate 'ansi-term) + + ;; close ansi-term, when shell session exists + ;; from https://ogbe.net/emacsconfig.html + (defadvice term-sentinel (around my-advice-term-sentinel (proc msg)) + (if (memq (process-status proc) '(signal exit)) + (let ((buffer (process-buffer proc))) + ad-do-it + (kill-buffer buffer)) + ad-do-it)) + (ad-activate 'term-sentinel) + + ;; disable nlinum in shell + (add-hook 'term-mode-hook (lambda () (nlinum-mode -1))))