From f6afa5aa16056d6edec34a03363b1703c4df480c Mon Sep 17 00:00:00 2001 From: Crazazy Date: Tue, 20 Sep 2022 09:54:24 +0200 Subject: add multiple terminals --- emacs.org | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'emacs.org') diff --git a/emacs.org b/emacs.org index abea15b..807ff84 100644 --- a/emacs.org +++ b/emacs.org @@ -36,6 +36,24 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto #+begin_src emacs-lisp :mkdirp yes :tangle emacsconfig/base.el (use-package better-defaults) #+end_src +*** Multiple terminals + By default, =term= only supports 1 terminal. This version supports multiple terminals + #+begin_src emacs-lisp :tangle emacsconfig/base.el + (defun new-term (program) + "start a new terminal emulator in a new buffer" + (interactive (list (read-from-minibuffer "Run program: " + (or explicit-shell-file-name + (getenv "ESHELL") + shell-file-name)))) + (let* ((term-list (seq-filter + (lambda (s) (string-match-p "terminal" (buffer-name s))) + (buffer-list))) + (term-num (number-to-string (length term-list)))) + (set-buffer (make-term (concat "terminal-" term-num) program)) + (term-mode) + (term-char-mode) + (switch-to-buffer (concat "*terminal-" term-num "*")))) + #+end_src ** Generally nice emacs tools *** Magit Simple. Nice. default config. (almost) -- cgit 1.4.1-2-gfad0