aboutsummaryrefslogtreecommitdiff
path: root/modules/home-manager/emacs/config/lisp/my-functions.el
blob: 52bb72dd226828f87cd3f568936b762b6fe92f4c (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
;;; my-functions.el --- My random functions
;;; Commentary:
;;; Some random functions

;;; Code:

;;; Karate
(defun karate-new (timestamp)
  "Creates new document for karate lesson plans based on a template."
  (interactive
   (list (org-read-date nil t)))
  (let ((date (format-time-string "%d-%m-%Y" timestamp)))
  (copy-file "~/Documents/karate/lessonPlans/default.org"
			 (concat "~/Documents/karate/lessonPlans/" date ".org") 1)
  (switch-to-buffer (find-file-noselect (concat "~/Documents/karate/lessonPlans/" date ".org")))
  (replace-string "DATEHERE" date)
  (goto-char (point-min))
  (forward-line 5)
  (end-of-line)))

;;; Scratch
(defun start-scratch ()
  "Function to call when starting the scratch window, or to enter scratchpad mode."
  (interactive)
  ;; Make window not transparent
  (set-frame-parameter (selected-frame) 'alpha '(100 100))
  ;; Make change WM_NAME to "scratch-emacs"
  (set-frame-parameter (selected-frame) 'name "scratch-emacs")
  (org-agenda nil "n")
  (delete-other-windows)
  )
(defun stop-scratch ()
  "Function to call to stop the scratch window."
  (interactive)
  ;; Make window transparent
  (set-frame-parameter (selected-frame) 'alpha '(80 80))
  (set-frame-parameter (selected-frame) 'name nil))

;;; Terminal
(require 'multi-vterm)
(defun start-terminal ()
  "Function to call to start a terminal and switch to insert mode, usually used for the keybind $mod+Shift+Return."
  (interactive)
  (multi-vterm))

(provide 'my-functions)

;;; my-functions.el ends here