diff options
author | jao <jao@gnu.org> | 2021-06-12 00:27:47 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-06-12 00:27:47 +0100 |
commit | fda1607760a996cb6fa3cbd860312bc3d43fb7f4 (patch) | |
tree | e286d0f6ee02de04842f3347bfc801f2d695b049 | |
parent | b07dfdd2c5b67ee28cbe967ea5d2ebcb5081e35a (diff) | |
download | elibs-fda1607760a996cb6fa3cbd860312bc3d43fb7f4.tar.gz elibs-fda1607760a996cb6fa3cbd860312bc3d43fb7f4.tar.bz2 |
rouding up vterm -> ansi-term
-rw-r--r-- | init.org | 31 |
1 files changed, 18 insertions, 13 deletions
@@ -1633,7 +1633,11 @@ (defun jao-exec-in-term (cmd &optional name) (ansi-term "bash" name) - (term-send-string nil (concat cmd "\n"))) + (set-process-sentinel (get-buffer-process (current-buffer)) + (lambda (process event) + (when (string= event "finished\n") + (kill-buffer (process-buffer process))))) + (term-send-string nil (concat cmd ";exit\n"))) (defmacro jao-def-exec-in-term (name cmd &rest prelude) `(defun ,(intern (format "jao-term-%s" name)) () @@ -1641,13 +1645,13 @@ ,@prelude (if-let ((b (jao-term--find ,cmd))) (pop-to-buffer b) - (ansi-term ,cmd ,(format "*%s*" name)) + (jao-exec-in-term ,cmd ,(format "*%s*" name)) (setq-local jao-term--cmd ,cmd)))) (jao-def-exec-in-term "aptitude" "aptitude" (jao-afio--goto-scratch)) (jao-def-exec-in-term "htop" "htop" (jao-afio--goto-scratch)) #+end_src -*** Eshell +*** eshell ***** Basic custom #+begin_src emacs-lisp (use-package eshell @@ -1802,7 +1806,7 @@ (jao-eshell--kbds) (add-hook 'eshell-mode-hook #'jao-eshell--kbds)) #+end_src -*** Shell here +*** shell here #+begin_src emacs-lisp (defun jao-shell-here--find-window (b) (when-let ((w (car (cl-remove-if-not @@ -1818,6 +1822,15 @@ 'jao-eshell-buffer))) (if b (set-frame-parameter nil p b) (frame-parameter nil p)))) + (defun jao-shell--cd-here (dir) + (if jao-shell-here-use-term + (progn (term-send-raw-string "\C-a\C-k") + (term-send-string (format "cd %s\n" dir))) + (eshell-kill-input) + (eshell/cd dir) + (insert "\n") + (eshell-send-input))) + (defun jao-shell-here (&optional stay) (interactive) (let* ((dir default-directory) @@ -1833,15 +1846,7 @@ (jao-shell-frame-buffer (current-buffer)))) (when (not jao-shell-here-use-term) (eshell-save-some-history)) - (when (not stay) - (if jao-shell-here-use-term - (progn (term-send-raw-string "\C-a") - (term-send-raw-string "\C-k") - (term-send-string (format "cd %s\n" dir))) - (eshell-kill-input) - (eshell/cd dir) - (insert "\n") - (eshell-send-input))))) + (unless stay (jao-shell--cd-here dir)))) (defun eshell/x () (when (derived-mode-p 'eshell-mode) |