blob: 53bb15438f368aa4b6aff5b186a3e047929fc2da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
;;; new-term.el --- A way to spawn multiple emacs terminals -*- lexical-binding: t; -*-
;; Copyright © 2022 Erik Oosting
;; Author: Erik Oosting <crazazy@tilde.cafe>
;; Keywords: application-launcher, misc
;; URL: https://crazazy.tilde.cafe/emenu.git/log.html
;;; License:
;; This file comes with the MIT license, and without any warranty whatsoever
;; You can do with this stuff whatever you want to, but just remember
;; to put me in the footnote :D. Would be nice at least
;;; Commentary:
;; A simple way to have multiple terminals in emacs. just type "M-x new-term"
;; to start a new session
;;; Code:
;;;###autoload
(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 "*"))))
;;; new-term.el ends here
|