summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Oosting2022-09-20 10:00:35 +0200
committerErik Oosting2022-09-20 10:10:46 +0200
commit812caeb3143a2c4e413c060425518a28df17b2ab (patch)
tree75892d73fa8756f2a8256c1e26756bf23d1b369d
initial commit HEAD master
-rw-r--r--LICENSE21
-rw-r--r--new-term.el35
2 files changed, 56 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..6c79682
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 Erik Oosting
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/new-term.el b/new-term.el
new file mode 100644
index 0000000..53bb154
--- /dev/null
+++ b/new-term.el
@@ -0,0 +1,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