summaryrefslogtreecommitdiffstats
path: root/.emacs.d
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2024-09-20 14:16:56 +0200
committerjdlugosz963 <jdlugosz963@gmail.com>2024-09-20 14:16:56 +0200
commit45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a (patch)
treeb564c1c43920def6641cd482a7b4dca453dbc043 /.emacs.d
parent07dd8e37eb767c3dd6abf63e5e4a720cd778da15 (diff)
downloaddotfiles-45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a.tar.gz
dotfiles-45bb0d11161b1c5077a1415eed6dbd0fd25ccb6a.zip
Change dotfiles structure, and add guix-channels declaration.
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/.gitignore3
-rwxr-xr-x.emacs.d/init.el146
-rwxr-xr-x.emacs.d/jd/jd-apps.el49
-rwxr-xr-x.emacs.d/jd/jd-custom.el33
-rwxr-xr-x.emacs.d/jd/jd-dev.el155
-rwxr-xr-x.emacs.d/jd/jd-exwm.el177
-rwxr-xr-x.emacs.d/jd/jd-gym.el120
-rwxr-xr-x.emacs.d/jd/jd-keys.el50
-rwxr-xr-x.emacs.d/jd/jd-mu4e.el84
-rwxr-xr-x.emacs.d/jd/jd-org.el217
-rwxr-xr-x.emacs.d/jd/jd-ui.el100
11 files changed, 0 insertions, 1134 deletions
diff --git a/.emacs.d/.gitignore b/.emacs.d/.gitignore
deleted file mode 100644
index f51c6b4..0000000
--- a/.emacs.d/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1*
2!init.el
3!jd/ \ No newline at end of file
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
deleted file mode 100755
index 090592f..0000000
--- a/.emacs.d/init.el
+++ /dev/null
@@ -1,146 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6;; Minimize garbage collection during startup
7(setq gc-cons-threshold most-positive-fixnum)
8
9;; Lower threshold back to 8 MiB (default is 800kB)
10(add-hook 'emacs-startup-hook
11 (lambda ()
12 (setq gc-cons-threshold (expt 2 23))))
13
14(defvar jd/manifest-list
15 nil
16 "List that contain Emacs packages for GNU/Guix." )
17
18(defvar jd/exwm-p
19 (or (not (null (getenv "JD_EXWM")))
20 (and (seq-contains command-line-args "exwm" #'string-match)
21 t))
22 "Is non-nil when Emacs is run as a window manager.")
23
24(defvar jd/guix-p
25 (and (eq system-type 'gnu/linux)
26 (file-exists-p "/etc/os-release")
27 (with-temp-buffer
28 (insert-file-contents "/etc/os-release")
29 (search-forward "ID=guix" nil t))
30 t)
31 "Is non-nil when Emacs packages are installed by GNU/Guix package manager.")
32
33(defun jd/add-package-to-manifest (guix-package-name)
34 "Add GUIX-PACKAGE-NAME to jd/manifest-list."
35 (unless (member guix-package-name jd/manifest-list)
36 (setq jd/manifest-list
37 (cons guix-package-name jd/manifest-list))))
38
39(add-to-list 'load-path (concat user-emacs-directory "/jd"))
40
41(defun jd/display-startup-time ()
42 (message "Emacs loaded in %s with %d garbage collections."
43 (format "%.2f seconds"
44 (float-time
45 (time-subtract after-init-time before-init-time)))
46 gcs-done))
47
48(defun jd-emacs/startup ()
49 "This procedure will run after Emacs startup."
50 (electric-pair-mode 1)
51 (global-company-mode 1)
52 (jd/display-startup-time))
53
54(add-hook 'emacs-startup-hook #'jd-emacs/startup)
55
56(setq user-full-name "Jakub Dlugosz"
57 user-mail-address "jdlugosz963@gmail.com")
58
59(setq backup-directory-alist '(("." . "~/.cache/emacs/backup"))
60 backup-by-copying t
61 version-control t
62 delete-old-versions t
63 kept-new-versions 20
64 kept-old-versions 5
65 custom-file (concat user-emacs-directory
66 "custom.el"))
67
68;; (setq user-emacs-directory "~/.cache/emacs")
69
70(require 'package)
71(setq package-archives '(("melpa" . "https://melpa.org/packages/")
72 ("org" . "https://orgmode.org/elpa/")
73 ("gnu-devel" . "https://elpa.gnu.org/devel/")
74 ("elpa" . "https://elpa.gnu.org/packages/")))
75(package-initialize)
76
77(unless package-archive-contents
78 (package-refresh-contents))
79
80(jd/add-package-to-manifest "emacs-use-package")
81(unless jd/guix-p
82 (unless (package-installed-p 'use-package)
83 (package-install 'use-package)))
84
85(require 'use-package)
86
87(setq use-package-always-ensure (not jd/guix-p))
88
89(defun jd/generate-manifest ()
90 "Generate GNU/Guix Emacs manifest to temp-buffer."
91 (interactive)
92 (with-output-to-temp-buffer "*guix-emacs-packages-manifest.scm*"
93 (princ (concat ";; This file is auto-generated by Emacs "
94 "function: jd/manifest-generate-to-file \n"))
95 (princ `(specifications->manifest
96 '(,@(mapcar #'(lambda (guix-package-name)
97 (concat "\""
98 guix-package-name
99 "\"\n"))
100 jd/manifest-list))))))
101
102(defun use-package-normalize/:guix-package (name keyword args)
103 (use-package-as-one (symbol-name keyword) args
104 #'(lambda (_label arg)
105 (cond
106 ((consp arg) arg)
107 ((stringp arg) (list arg))
108 ((use-package-non-nil-symbolp arg) (symbol-name arg))
109 (t
110 (use-package-error
111 ":pin wants an archive name (a string)"))))))
112
113(defun use-package-handler/:guix-package
114 (name _keyword args rest state)
115 (let ((body (use-package-process-keywords name rest state)))
116 (use-package-concat
117 (when (consp args)
118 (mapcar #'(lambda (arg)
119 `(jd/add-package-to-manifest ,arg))
120 args))
121 body)))
122
123(add-to-list 'use-package-keywords ':guix-package)
124
125(jd/add-package-to-manifest "emacs")
126(jd/add-package-to-manifest "emacs-guix")
127
128(require 'jd-keys)
129(require 'jd-ui)
130(require 'jd-org)
131(require 'jd-dev)
132(require 'jd-apps)
133(require 'jd-custom)
134(require 'jd-mu4e)
135(require 'jd-misc)
136(require 'jd-sway)
137
138(when jd/exwm-p
139 (require 'jd-exwm))
140
141;; (setq gc-cons-threshold (* 2 1000 1000))
142
143;;; init.el ends here
144(put 'upcase-region 'disabled nil)
145(put 'downcase-region 'disabled nil)
146(put 'set-goal-column 'disabled nil)
diff --git a/.emacs.d/jd/jd-apps.el b/.emacs.d/jd/jd-apps.el
deleted file mode 100755
index f06430b..0000000
--- a/.emacs.d/jd/jd-apps.el
+++ /dev/null
@@ -1,49 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(use-package vterm
7 :guix-package "emacs-vterm"
8 :init
9 (add-to-list 'project-switch-commands '(project-vterm "Vterm") t)
10 (add-to-list 'project-kill-buffer-conditions
11 '(major-mode . vterm-mode))
12 (setq vterm-copy-exclude-prompt t)
13 :config
14 (setq vterm-buffer-name "vterm")
15 ;; (evil-set-initial-state 'vterm-mode 'emacs)
16 (setq vterm-tramp-shells
17 (append '(("ssh" "/bin/bash")) vterm-tramp-shells))
18
19 )
20
21(use-package all-the-icons-dired
22 :guix-package "emacs-all-the-icons-dired"
23 :hook (dired-mode . all-the-icons-dired-mode))
24
25(use-package dired
26 :ensure nil
27 :commands (dired dired-jump)
28 :custom ((dired-listing-switches "-agho --group-directories-first"))
29 :config
30 (setq dired-kill-when-opening-new-dired-buffer t))
31
32(use-package pdf-tools
33 :guix-package
34 "emacs-pdf-tools")
35
36(use-package password-store
37 :guix-package "emacs-password-store"
38 :bind
39 ("C-c P p" . password-store-copy)
40 ("C-c P i" . password-store-insert)
41 ("C-c P g" . password-store-generate))
42
43(use-package shell
44 :bind
45 ("C-c C-<return>" . shell))
46
47(provide 'jd-apps)
48
49;;; jd-apps.el ends here
diff --git a/.emacs.d/jd/jd-custom.el b/.emacs.d/jd/jd-custom.el
deleted file mode 100755
index a634baa..0000000
--- a/.emacs.d/jd/jd-custom.el
+++ /dev/null
@@ -1,33 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(setq erc-nick "bobbma"
7 erc-user-full-name "Jakub Dlugosz"
8 erc-notify-list '("akuleszaa"))
9
10(defun hipis-znc ()
11 (interactive)
12 (erc :server "195.74.91.18"
13 :port "6697"))
14
15
16;; Repair load paths when tramp try to connect to guix instances
17(require 'tramp)
18
19(connection-local-set-profile-variables
20 'guix-system
21 '((tramp-remote-path . (tramp-own-remote-path))))
22
23(connection-local-set-profiles
24 '(:application tramp :protocol "sudo" :machine "localhost")
25 'guix-system)
26
27(connection-local-set-profiles
28 '(:application tramp :protocol "ssh" :machine "jdlugosz.com")
29 'guix-system)
30
31(provide 'jd-custom)
32
33;;; jd-custom.el ends here
diff --git a/.emacs.d/jd/jd-dev.el b/.emacs.d/jd/jd-dev.el
deleted file mode 100755
index 569b12f..0000000
--- a/.emacs.d/jd/jd-dev.el
+++ /dev/null
@@ -1,155 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(setq c-default-style "linux"
7 c-basic-offset 8
8 gdb-many-windows t)
9
10(use-package lsp-mode
11 :guix-package "emacs-lsp-mode"
12 :diminish t
13 :commands (lsp lsp-deferred)
14 :init
15 (setq lsp-headerline-breadcrumb-enable nil)
16 (setq lsp-diagnostics-provider :none)
17 (setq lsp-modeline-diagnostics-enable nil)
18 (setq lsp-keymap-prefix "C-c l")
19 :config
20 (lsp-enable-which-key-integration t))
21
22(use-package lsp-ivy
23 :guix-package "emacs-lsp-ivy"
24 :after lsp)
25
26
27(use-package paredit
28 :guix-package "emacs-paredit")
29
30(defun jd/lisp-mode-setup ()
31 (rainbow-delimiters-mode)
32 (paredit-mode))
33
34(add-hook 'emacs-startup-hook
35 (lambda ()
36 (add-hook 'scheme-mode-hook 'jd/lisp-mode-setup)
37 (add-hook 'emacs-lisp-mode-hook 'jd/lisp-mode-setup)
38 (add-hook 'clojure-mode-hook 'jd/lisp-mode-setup)
39 (add-hook 'lisp-mode-hook 'jd/lisp-mode-setup)))
40
41(use-package rainbow-delimiters
42 :guix-package "emacs-rainbow-delimiters")
43
44(use-package sly
45 :guix-package "emacs-sly")
46
47(use-package geiser
48 :guix-package "emacs-geiser")
49
50(use-package geiser-racket
51 :guix-package "emacs-geiser-racket")
52
53(use-package racket-mode
54 :guix-package "emacs-racket-mode")
55
56(use-package geiser-guile
57 :guix-package "emacs-geiser-guile"
58 :config
59 (when jd/guix-p
60 (defun jd/guix-repl ()
61 (interactive)
62 (let ((geiser-guile-binary '("guix" "repl"))
63 (geiser-guile-load-path (cons "~/dotfiles/guix" geiser-guile-load-path)))
64 (geiser 'guile)))))
65
66(use-package pyvenv
67 :guix-package "emacs-pyvenv"
68 :after python-mode)
69
70(use-package typescript-mode
71 :guix-package "emacs-typescript-mode"
72 :mode ("\\.ts\\'")
73 :config
74 (setq typescript-indent-level 2))
75
76(use-package cider
77 :guix-package "emacs-cider")
78
79(use-package tide
80 :guix-package "emacs-tide"
81 :after (typescript-mode company web-mode))
82
83(use-package flycheck
84 :guix-package "emacs-flycheck"
85 :hook ((after-init . global-flycheck-mode)))
86
87(use-package web-mode
88 :guix-package "emacs-web-mode"
89 :mode
90 ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'")
91 :config
92 (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'")))
93 (setq web-mode-markup-indent-offset 2)
94 (setq web-mode-css-indent-offset 2)
95 (setq web-mode-code-indent-offset 2)
96 (setq web-mode-script-padding 2)
97 (setq web-mode-block-padding 2)
98 (setq web-mode-style-padding 2)
99 (setq web-mode-enable-auto-pairing t)
100 (setq web-mode-enable-auto-closing t)
101 (setq web-mode-enable-current-element-highlight t))
102
103(use-package yaml-mode
104 :guix-package "emacs-yaml-mode")
105
106(use-package docker
107 :guix-package "emacs-docker"
108 :bind
109 ("C-c D d" . docker-containers)
110 ("C-c D D" . docker))
111
112(use-package company
113 :guix-package "emacs-company"
114 :diminish t
115 :after lsp-mode
116 :hook (lsp-mode . company-mode)
117 :bind (:map company-active-map
118 ("<tab>" . company-complete-selection))
119 (:map lsp-mode-map
120 ("<tab>" . company-indent-or-complete-common))
121 :custom
122 (company-minimum-prefix-length 1)
123 (company-idle-delay 0.0)
124 :config
125 (global-company-mode))
126
127(use-package projectile
128 :guix-package "emacs-projectile"
129 :diminish projectile-mode
130 :init
131 (when (file-directory-p "~/Documents/code")
132 (setq projectile-project-search-path '("~/Documents/code/")))
133 :custom ((projectile-Completion-system 'ivy))
134 :config
135 (setq projectile-switch-project-action #'projectile-dired)
136 (projectile-mode))
137
138(use-package magit
139 :guix-package "emacs-magit"
140 :custom
141 (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
142
143(use-package restclient
144 :guix-package "emacs-restclient")
145
146(setq sql-connection-alist
147 '(("net47-abaks"
148 (sql-product 'postgres)
149 (sql-user "kuba")
150 (sql-database "net47")
151 (sql-server "net47.abaks.pl"))))
152
153(provide 'jd-dev)
154
155;;; jd-dev.el ends here
diff --git a/.emacs.d/jd/jd-exwm.el b/.emacs.d/jd/jd-exwm.el
deleted file mode 100755
index 7731b01..0000000
--- a/.emacs.d/jd/jd-exwm.el
+++ /dev/null
@@ -1,177 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6
7(use-package perspective
8 :guix-package "emacs-perspective")
9
10(use-package exwm
11 :guix-package "emacs-exwm"
12 :config
13 (defun jd/exwm-update-class ()
14 (exwm-workspace-rename-buffer exwm-class-name))
15
16 (defun jd-exwm/run-in-background (command)
17 (let ((command-parts (split-string command "[ ]+")))
18 (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
19
20 (defun jd-exwm/restart-process (program-name)
21 (call-process "killall" nil nil nil program-name)
22 (jd-exwm/run-in-background program-name))
23
24 (defun jd-exwm/exwm-init-hook ()
25 (jd-exwm/run-in-background "nitrogen --restore")
26 (start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1")
27 (start-process-shell-command "syndaemon" nil "syndaemon -i 0.8 -K -R -d")
28
29 (jd-exwm/restart-process "polybar")
30 (jd-exwm/restart-process "nm-applet")
31 (jd-exwm/restart-process "redshift-gtk -l 54.37:18.6")
32 (jd-exwm/restart-process "blueman-applet"))
33
34 (defun jd-exwm/exwm-update-title ()
35 (exwm-workspace-rename-buffer exwm-title))
36
37 (defun jd-exwm/configure-window-by-class ()
38 (interactive)
39 (pcase exwm-class-name
40 ("firefox" (exwm-workspace-move-window 2))
41 ("Brave" (exwm-workspace-move-window 2))
42 ("qutebrowser" (exwm-workspace-move-window 2))
43 ("discord" (exwm-workspace-move-window 5))
44 ("obs" (exwm-workspace-move-window 5))
45 ("Virt-manager" (exwm-workspace-move-window 4))))
46
47 (setq exwm-workspace-number 10)
48
49 ;; (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook)
50 (add-hook 'exwm-update-class-hook #'jd/exwm-update-class)
51 (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title)
52 (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class)
53
54 (require 'exwm-randr)
55 (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1"))
56 (exwm-randr-enable)
57
58 (setq exwm-input-simulation-keys
59 '(([?\C-b] . [left])
60 ([?\C-f] . [right])
61 ([?\C-p] . [up])
62 ([?\C-n] . [down])
63 ([?\C-a] . [home])
64 ([?\C-e] . [end])
65 ([?\C-k] . [S-end delete])
66 ([?\M-w] . [C-c])
67 ([?\C-y] . [C-v])
68 ([?\C-v] . [next])
69 ([?\M-v] . [prior])
70 ))
71
72 (setq exwm-input-prefix-keys
73 '(?\C-x
74 ?\C-u
75 ?\C-h
76 ?\M-x
77 ?\M-`
78 ?\M-&
79 ?\M-!
80 ?\C-g
81 ?\M-:
82 ?\C-\M-j
83 ?\C-\ ))
84
85 (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
86 (exwm-input-set-key (kbd "s-p") 'counsel-linux-app)
87
88 (setq exwm-input-global-keys
89 `(([?\s-R] . exwm-reset)
90
91
92 ([?\s-r] . (lambda (command)
93 (interactive (list (read-shell-command "$ ")))
94 (start-process-shell-command command nil command)))
95
96 ([?\s-W] . exwm-workspace-move-window)
97 ([?\s-w] . exwm-workspace-switch)
98
99 ,@(mapcar (lambda (i)
100 `(,(kbd (format "s-%d" i)) .
101 (lambda ()
102 (interactive)
103 (exwm-workspace-switch-create ,i))))
104 (number-sequence 0 9))))
105
106 (exwm-enable)
107 (require 'exwm-systemtray)
108 (exwm-systemtray-enable))
109
110(use-package desktop-environment
111 :guix-package "emacs-desktop-environment"
112 :after exwm
113 :custom
114 (desktop-environment-brightness-small-increment "2%+")
115 (desktop-environment-brightness-small-decrement "2%-")
116 (desktop-environment-brightness-normal-increment "5%+")
117 (desktop-environment-brightness-normal-decrement "5%-")
118
119 :config
120 (defun jd/dunst-show-history ()
121 (interactive)
122 (start-process-shell-command "dunstctl" nil "dunstctl history-pop"))
123 (global-set-key (kbd "C-c N h") #'jd/dunst-show-history)
124
125 (defun jd/dunst-close ()
126 (interactive)
127 (start-process-shell-command "dunstctl" nil "dunstctl close"))
128 (global-set-key (kbd "C-c N c") #'jd/dunst-close)
129
130 (defun jd/dunst-close-all ()
131 (interactive)
132 (start-process-shell-command "dunstctl" nil "dunstctl close-all"))
133 (global-set-key (kbd "C-c N a") #'jd/dunst-close-all)
134
135 (desktop-environment-mode))
136
137;; (set-frame-parameter (selected-frame) 'alpha '(90 . 90))
138;; (add-to-list 'default-frame-alist `(alpha . (90 . 90)))
139;; (set-frame-parameter (selected-frame) 'fullscreen 'maximized)
140;; (add-to-list 'default-frame-alist '(fullscreen . maximized))
141
142(defun jd-exwm/get-color (ATTRIBUTE)
143 (face-attribute 'default ATTRIBUTE))
144
145(defun theme-to-xresources ()
146 (interactive)
147 (require 'term)
148 (with-temp-buffer
149 (insert "! Generated by theme-to-xresources\n")
150 (dolist (spec
151 '(("emacs.background" :background "E6")
152 ("emacs.foreground" :foreground "")))
153 (let ((color (jd-exwm/get-color (cadr spec))))
154 (insert (format "%s: #%s%s\n"
155 (car spec)
156 (caddr spec)
157 (string-remove-prefix "#" color))))
158 jd
159 (write-region (point-min) (point-max) "~/.Xresources")))
160 (call-process "xrdb" nil nil nil "-merge" (expand-file-name "~/.Xresources")))
161
162(defun jd/theme-sync ()
163 (interactive)
164 (theme-to-xresources)
165 (setq org-confirm-babel-evaluate nil)
166 (org-babel-tangle-file "~/dotfiles/Desktop.org")
167 (setq org-confirm-babel-evaluate 't)
168 (call-process "killall" nil nil nil "dunst") ;; TODO: prevent clear notification history
169 (jd-exwm/restart-process "polybar"))
170
171;; (add-hook 'jd/load-theme-hook #'jd/theme-sync)
172;; (add-hook 'exwm-init-hook #'jd/theme-sync)
173
174(provide 'jd-exwm)
175
176;;; jd-exwm.el ends here
177
diff --git a/.emacs.d/jd/jd-gym.el b/.emacs.d/jd/jd-gym.el
deleted file mode 100755
index 581bf65..0000000
--- a/.emacs.d/jd/jd-gym.el
+++ /dev/null
@@ -1,120 +0,0 @@
1;;; jd-gym.el --- Gym workout manager.
2;;; Commentary:
3;; It will be a gym workout manager in the future.
4;;; code:
5
6(require 'emacsql-sqlite)
7
8(defconst jd-gym/db--tables-schema
9 '((workout-plans
10 [(id integer :primary-key :autoincrement)
11 (name text)])
12
13 (workouts
14 [(id integer :primary-key :autoincrement)
15 (workout-plan-id integer :not-null)
16 (day integer :not-null)
17 (month integer :not-null)
18 (year integer :not-null)]
19 (:foreign-key [workout-plan-id] :references workout-plans [id] :on-delete :cascade))
20
21 (muscle-part
22 [(id integer :primary-key :autoincrement)
23 (name text :not-null)])
24
25 (exercises
26 [(id integer :primary-key :autoincrement)
27 (name text :not-null)
28 (muscle-part-id integer :not-null)]
29 (:foreign-key [muscle-part-id] :references muscle-part [id] :on-delete :cascade))
30
31 (workout-plan-exercise-map
32 [(id integer :primary-key :autoincrement)
33 (week-day integer :not-null)
34 (workout-plan-id integer :not-null)
35 (exercise-id integer :not-null)]
36 (:foreign-key [workout-plan-id] :references workout-plans [id] :on-delete :cascade)
37 (:foreign-key [exercise-id] :references exercises [id] :on-delete :cascade))
38
39 (workout-sets
40 [(id integer :primary-key :autoincrement)
41 (reps integer :not-null)
42 (weight integer :not-null)
43 (workout-plan-exercise-map-id integer :not-null)
44 (comment text)]
45 (:foreign-key [workout-plan-exercise-map-id] :references workout-plan-exercise-map [id] :on-delete :cascade))))
46
47(defconst jd-gym/db--test-data
48 '((workout-plans
49 ([nil "Push pull"]))
50 (workouts
51 ([nil 1 3 1 2023]))
52 (muscle-part
53 ([nil "glutes"]
54 [nil "chest"]))
55 (exercises
56 ([nil "Bench press" 2]
57 [nil "RDL" 1]))
58 (workout-plan-exercise-map
59 ([nil 0 1 1] ; Monday, Push pull, Bench press
60 [nil 1 1 2] ; Tuesday, Push pull, RDL
61 [nil 3 1 1] ; Thursday, Push pull, Bench press
62 [nil 4 1 2] ; Friday, Push pull, RDL
63 ))
64 (workout-sets
65 ([nil 7 70 1 "New PR!"]
66 [nil 8 110 2 "It was hard!"]))))
67
68(defun jd-gym/db--test-data-insert ()
69 "Insert test data to jd-gym database."
70 (mapc (lambda (table)
71 (let ((table-name (car table))
72 (table-data (cdr table)))
73 (emacsql jd-gym/db--conn [:insert :into $i1
74 :values $v2]
75 table-name table-data)))
76 jd-gym/db--test-data))
77
78(defvar jd-gym/db-path "~/Documents/Gym/gym.sqlite"
79 "Path can be relative or absolute.")
80
81(defvar jd-gym/db--conn nil
82 "Store connection to jd-gym database.")
83
84(defun jd-gym/db--conn-p ()
85 "Check if jd-gym is connected to db."
86 (and (emacsql-sqlite-connection-p jd-gym/db--conn)
87 (emacsql-live-p jd-gym/db--conn)))
88
89(defun jd-gym/db--connect ()
90 "Connect to db if there is no connection yet."
91 (unless (jd-gym/db--conn-p)
92 (setq jd-gym/db--conn (emacsql-sqlite jd-gym/db-path))))
93
94(defun jd-gym/db--close ()
95 "Close db connection."
96 (when (jd-gym/db--conn-p)
97 (emacsql-close jd-gym/db--conn)))
98
99(defun jd-gym/db--init ()
100 "Initialize database structure."
101 (when (jd-gym/db--conn-p)
102 (emacsql jd-gym/db--conn [:pragma (= foreign_keys ON)])
103 (emacsql jd-gym/db--conn "PRAGMA foreign_keys=ON")
104 (mapc (lambda (table)
105 (let ((table-name (car table))
106 (table-schema (cdr table)))
107 (emacsql jd-gym/db--conn [:create-table $i1 $S2] table-name table-schema)))
108 jd-gym/db--tables-schema)))
109
110(defun jd-gym/db ()
111 "Entrypoint to jd-gym db."
112 (unless (file-exists-p jd-gym/db-path)
113 (jd-gym/db--close)
114 (jd-gym/db--connect) ; Restart connection
115 (jd-gym/db--init)))
116
117
118(provide 'jd-gym)
119
120;;; jd-gym.el ends here
diff --git a/.emacs.d/jd/jd-keys.el b/.emacs.d/jd/jd-keys.el
deleted file mode 100755
index a5b828b..0000000
--- a/.emacs.d/jd/jd-keys.el
+++ /dev/null
@@ -1,50 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3;; Custom keysets used in my emacs
4;;; Code:
5
6(use-package multiple-cursors
7 :guix-package "emacs-multiple-cursors"
8 :config
9 (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
10 (global-set-key (kbd "C->") 'mc/mark-next-like-this)
11 (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
12 (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this))
13
14
15(use-package hydra
16 :guix-package "emacs-hydra"
17 ;; :defer t
18 :config
19 (defun jd/text-scale-increase ()
20 (interactive)
21 (let ((old-face-attribute (face-attribute 'default :height)))
22 (set-face-attribute 'default nil :height (+ old-face-attribute 10))))
23
24 (defun jd/text-scale-decrease ()
25 (interactive)
26 (let ((old-face-attribute (face-attribute 'default :height)))
27 (set-face-attribute 'default nil :height (- old-face-attribute 10))))
28
29 (defhydra hydra-text-scale-global (:timeout 4)
30 "scale text"
31 ("j" jd/text-scale-increase "in")
32 ("k" jd/text-scale-decrease "out")
33 ("q" nil "finished" :exit t)) ;; TODO not working
34
35 (defhydra hydra-text-scale (:timeout 4)
36 "scale text"
37 ("j" text-scale-increase "in")
38 ("k" text-scale-decrease "out")
39 ("q" nil "finished" :exit t)))
40
41(use-package undo-tree
42 :guix-package "emacs-undo-tree"
43 :diminish
44 :config
45 (setq undo-tree-auto-save-history nil)
46 (global-undo-tree-mode 1))
47
48(provide 'jd-keys)
49
50;;; jd-keys.el ends here
diff --git a/.emacs.d/jd/jd-mu4e.el b/.emacs.d/jd/jd-mu4e.el
deleted file mode 100755
index b388201..0000000
--- a/.emacs.d/jd/jd-mu4e.el
+++ /dev/null
@@ -1,84 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(use-package htmlize
7 :guix-package "emacs-htmlize")
8
9(use-package mu4e
10 :guix-package ("mu" "isync")
11 :defer 10
12 :ensure nil
13 :bind
14 ("C-c M" . mu4e)
15 :config
16 ;a (require 'org-mu4e)
17
18 (unless jd/guix-p
19 (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
20 (setq mu4e-mu-binary "/usr/local/bin/mu"))
21
22 (setq mu4e-update-interval (* 10 60))
23 (setq mu4e-get-mail-command "mbsync -a")
24 (setq mu4e-maildir "~/Mail")
25
26 (setq mu4e-completing-read-function #'ivy-completing-read)
27
28 (setq mu4e-change-filenames-when-moving t)
29
30 (setq mu4e-contexts
31 `(,(make-mu4e-context
32 :name "Abaks"
33 :match-func (lambda (msg) (when msg
34 (string-prefix-p "/abaks" (mu4e-message-field msg :maildir))))
35 :vars '(
36 (user-full-name . "Jakub Dlugosz")
37 (user-mail-address . "jakub@abaks.pl")
38 (mu4e-sent-folder . "/abaks/Sent Items")
39 (mu4e-trash-folder . "/abaks/Trash")
40 (mu4e-drafts-folder . "/abaks/Drafts")
41 (mu4e-refile-folder . "/abaks/Archive")
42 (mu4e-sent-messages-behavior . sent)
43 (smtpmail-local-domain . "pl")
44 (smtpmail-smtp-server . "smtp.abaks.pl")
45 (smtpmail-smtp-user . "jakub@abaks.pl")))
46 ,(make-mu4e-context
47 :name "Gmail"
48 :match-func (lambda (msg) (when msg
49 (string-prefix-p "/gmail" (mu4e-message-field msg :maildir))))
50 :vars '(
51 (user-full-name . "Jakub Dlugosz")
52 (user-mail-address . "jdlugosz963@gmail.com")
53 (mu4e-sent-folder . "/gmail/\[Gmail\]/Wys\&AUI-ane")
54 (mu4e-trash-folder . "/gmail/\[Gmail\]/Kosz")
55 (mu4e-drafts-folder . "/gmail/\[Gmail\]/Wersje\ robocze")
56 (mu4e-refile-folder . "/gmail/Archive")
57 (smtpmail-local-domain . "com")
58 (smtpmail-smtp-server . "smtp.gmail.com")
59 (smtpmail-smtp-user . "jdlugosz963@gmail.com")
60 (mu4e-sent-messages-behavior . sent)))))
61
62 (setq mail-user-agent 'mu4e-user-agent
63 mail-host-address nil
64 message-send-mail-function 'smtpmail-send-it
65 smtpmail-smtp-service 465
66 smtpmail-stream-type 'ssl
67 smtpmail-servers-requiring-authorization ".*")
68
69 (setq mu4e-compose-signature (concat
70 "Pozdrawiam,\n"
71 "Jakub Długosz"))
72
73 (mu4e t)
74 (mu4e-modeline-mode nil))
75
76(use-package mu4e-alert
77 :guix-package "emacs-mu4e-alert"
78 :defer 20
79 :config
80 (mu4e-alert-set-default-style 'libnotify)
81 (mu4e-alert-enable-mode-line-display)
82 (mu4e-alert-enable-notifications))
83
84(provide 'jd-mu4e)
diff --git a/.emacs.d/jd/jd-org.el b/.emacs.d/jd/jd-org.el
deleted file mode 100755
index 1126155..0000000
--- a/.emacs.d/jd/jd-org.el
+++ /dev/null
@@ -1,217 +0,0 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(defvar jd/org-home "~/Documents/Org")
7(defvar jd/org-roam-home (concat jd/org-home "/roam"))
8(defvar jd/org-roam-agenda (concat jd/org-home "/agenda"))
9(defvar jd/org-roam-daily-home (concat jd/org-roam-home "/daily"))
10
11(defun jd/org-mode-init ()
12 (org-indent-mode)
13 (variable-pitch-mode 1)
14 (visual-line-mode 1))
15
16(defun jd-emacs/org-insert-date (&optional date)
17 (org-insert-time-stamp (org-read-date nil t (or date "+0d"))))
18
19(use-package org-pomodoro
20 :guix-package "emacs-org-pomodoro")
21
22(use-package org-caldav
23 :guix-package "emacs-org-caldav"
24 :config
25 (setq org-caldav-url "http://jdlugosz.com:5232/jdlugosz"
26 org-caldav-calendar-id "841a6259-8fe5-a178-e326-ddbb7c767e22"
27 org-caldav-inbox (concat jd/org-roam-agenda
28 "/main.org")
29 org-caldav-files nil
30 org-icalendar-timezone "Europe/Warsaw"))
31
32(use-package org
33 :guix-package "emacs-org"
34 :pin org
35 :commands (org-capture org-agenda)
36 :hook (org-mode . jd/org-mode-init)
37 :bind
38 ("C-c o c" . #'org-capture)
39 ("C-c o p" . #'org-mobile-pull)
40 ("C-c o P" . #'org-mobile-push)
41 ("C-c o a" . #'org-agenda)
42 :config
43 (setq org-directory (file-truename "~/Documents/Org/"))
44 (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org"))
45 (setq org-mobile-directory "~/Documents/Org/Mobile/")
46 (setq org-agenda-files '("Tasks.org" "Inbox.org" "Habits.org"))
47 (setq org-ellipsis " ▾")
48 (setq org-agenda-start-with-log-mode t)
49 (setq org-log-done 'time)
50 (setq org-log-into-drawer t)
51 (setq org-return-follows-link t)
52 (setq org-capture-templates
53 `(("t" "Tasks / Projects")
54 ("tt" "Task" entry (file+olp "Tasks.org" "Inbox")
55 "* TODO %?\n %t\n %a\n %i" :empty-lines 1)
56 ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox")
57 "* TODO %?\n %t\n SCHEDULED: %(jd-emacs/org-insert-date \"+1d\")>\n %a\n %i" :empty-lines 1)
58
59 ("m" "Metrics Capture")
60 ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics")
61 "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t)
62 ("sh" "School Homework" entry (file+olp "school/todo(jd-emacs/org-insert-date \"1\").org"))))
63
64 (setq org-latex-listings 'minted
65 org-latex-packages-alist '(("" "minted"))
66 org-latex-pdf-process
67 '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
68 "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
69 (require 'org-tempo)
70
71 (defun jd/org-font-setup ()
72 ;; Replace list hyphen with dot
73 (font-lock-add-keywords 'org-mode
74 '(("^ *\\([-]\\) "
75 (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-"))))))
76
77 ;; Set faces for heading levels
78 (dolist (face '((org-level-1 . 1.3)
79 (org-level-2 . 1.2)
80 (org-level-3 . 1.1)
81 (org-level-4 . 1.0)
82 (org-level-5 . 1.0)
83 (org-level-6 . 1.0)
84 (org-level-7 . 1.0)
85 (org-level-8 . 1.0)))
86 (set-face-attribute (car face) nil :font "Terminus" :weight 'Bold :height (cdr face)))
87
88 ;; Ensure that anything that should be fixed-pitch in Org files appears that way
89 (set-face-attribute 'org-block nil :font "Terminus" :inherit 'fixed-pitch :height 100)
90 (set-face-attribute 'org-table nil :inherit 'fixed-pitch)
91 (set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
92 (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
93 (set-face-attribute 'org-table nil :font "Terminus" :inherit '(shadow fixed-pitch))
94 (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
95 (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
96 (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
97 (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
98 (set-face-attribute 'line-number nil :inherit 'fixed-pitch)
99 (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
100
101 (with-eval-after-load 'org (jd/org-font-setup))
102
103 (defun jd-emacs/org-timer-stop ()
104 (start-process-shell-command "notify-send" nil "notify-send Zakonczono odliczanie"))
105
106
107 (add-hook 'org-timer-stop-hook #'jd-emacs/org-timer-stop)
108
109 (defun jd/org-tempo-setup ()
110 (dolist (template '(("s" . "src")
111 ("sql" . "src sql")
112 ("sh" . "src sh")
113 ("el" . "src emacs-lisp")
114 ("li" . "src lisp")
115 ("sc" . "src scheme")
116 ("ts" . "src typescript")
117 ("py" . "src python")
118 ("go" . "src go")
119 ("yaml" . "src yaml")))
120 (add-to-list 'org-structure-template-alist template)))
121
122 (with-eval-after-load 'org-tempo (jd/org-tempo-setup))
123
124 (org-babel-do-load-languages
125 'org-babel-load-languages
126 '((emacs-lisp . t)
127 (python . t)))
128
129 (defun jd/org-babel-tangle-config ()
130 (when (string-equal (file-name-directory (buffer-file-name))
131 (expand-file-name "~/dotfiles/"))
132 ;; Dynamic scoping to the rescue
133 (let ((org-confirm-babel-evaluate nil))
134 (org-babel-tangle))))
135
136 (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config))))
137
138(use-package org-superstar
139 :guix-package "emacs-org-superstar"
140 :hook (org-mode . org-superstar-mode)
141 :init
142 (setq org-superstar-special-todo-items t)
143 (setq org-superstar-remove-leading-stars t)
144 (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●")))
145
146(use-package org-roam
147 :guix-package "emacs-org-roam"
148 :custom
149 (org-roam-directory (file-truename jd/org-roam-home))
150 :bind (("C-c n l" . org-roam-buffer-toggle)
151 ("C-c n f" . org-roam-node-find)
152 ("C-c n g" . org-roam-graph)
153 ("C-c n i" . org-roam-node-insert)
154 ("C-c n c" . org-roam-capture)
155 ;; Dailies
156 ("C-c n j" . org-roam-dailies-capture-today))
157 :bind-keymap
158 ("C-c n d" . org-roam-dailies-map)
159 :config
160 (defun jd/org-roam-filter-by-tag (tag-name)
161 (lambda (node)
162 (member tag-name (org-roam-node-tags node))))
163
164 (defun jd/org-roam-list-notes-by-tag (tag-name)
165 (mapcar #'org-roam-node-file
166 (seq-filter
167 (jd/org-roam-filter-by-tag tag-name)
168 (org-roam-node-list))))
169
170 (defun jd/org-roam-refreshagenda-list ()
171 (interactive)
172 (setq org-agenda-files (org-roam-list-files)))
173
174 (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
175 (setq org-roam-capture-templates
176 '(("a" "workstuff" plain (file (concat org-roam-directory "/work"))
177 :target (file+head "work/%<%Y%m%d%H%M%S>-${slug}.org"
178 "#+title: ${title}\n")
179 :unnarrowed t)
180 ("b" "research" plain (file "~/Documents/roam/study/templates/research.org")
181 :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org"
182 "#+title: ${title}\n")
183 :unnarrowed t)
184 ("s" "School")
185 ("ss" "School General" plain nil
186 :target (file+head
187 "school/%<%Y%m%d%H%M%S>-${slug}.org"
188 "#+title: ${title}\n")
189 :unnarrowed t)
190 ("sp" "Polish Lesson" plain nil
191 :target (file+head
192 "school/polish/%<%Y%m%d%H%M%S>-${slug}.org"
193 "#+title: ${title}\n")
194 :unnarrowed t)
195 ("sw" "Wos Lesson" plain nil
196 :target (file+head
197 "school/wos/%<%Y%m%d%H%M%S>-${slug}.org"
198 "#+title: ${title}\n")
199 :unnarrowed t)
200 ("g" "Guitar" plain nil
201 :target (file+head
202 "guitar/%<%Y%m%d%H%M%S>-${slug}.org"
203 "#+title: ${title}\n")
204 :unnarrowed t)
205 ("d" "default" plain nil
206 :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
207 "#+title: ${title}\n")
208 :unnarrowed t)))
209
210 (org-roam-db-autosync-mode))
211
212(use-package ox-pandoc
213 :guix-package "emacs-ox-pandoc")
214
215(provide 'jd-org)
216
217;;; jd-org.el ends here
diff --git a/.emacs.d/jd/jd-ui.el b/.emacs.d/jd/jd-ui.el
deleted file mode 100755
index 992ba17..0000000
--- a/.emacs.d/jd/jd-ui.el
+++ /dev/null
@@ -1,100 +0,0 @@
1;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(setq inhibit-startup-message t)
7(setq visible-bell t)
8(scroll-bar-mode -1)
9(tool-bar-mode -1)
10(tooltip-mode -1)
11(menu-bar-mode -1)
12(set-fringe-mode 10)
13
14(set-frame-parameter (selected-frame) 'alpha '(92 . 92))
15(add-to-list 'default-frame-alist '(alpha . (92 . 92)))
16
17(custom-set-faces
18 '(default ((t (:inherit nil :height 125 :family "Terminus"))))
19 '(line-number ((t (:inherit nil :height 125 :family "Terminus"))))
20 '(line-number-current-line ((t (:inherit nil :height 125 :family "Terminus")))))
21
22(add-hook 'prog-mode-hook 'menu-bar--display-line-numbers-mode-relative)
23
24(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
25
26(global-prettify-symbols-mode 1)
27
28(defalias 'yes-or-no-p 'y-or-n-p)
29
30(require 'diminish)
31
32(use-package doom-modeline
33 :guix-package "emacs-doom-modeline"
34 :config
35 (doom-modeline-mode))
36
37(use-package solarized-theme
38 :guix-package "emacs-solarized-theme"
39 :config
40 (load-theme 'solarized-dark-high-contrast t))
41
42
43(use-package diminish
44 :guix-package "emacs-diminish")
45
46(use-package hl-todo
47 :guix-package "emacs-hl-todo"
48 :init
49 (setq hl-todo-keyword-faces
50 '(("TODO" . "#FF0000")
51 ("FIXME" . "#FF0000")
52 ("DEBUG" . "#A020F0")))
53 :config
54 (global-hl-todo-mode 1))
55
56(defvar jd/load-theme-hook nil)
57(defun jd/load-theme ()
58 (interactive)
59 (counsel-load-theme)
60 (run-hooks 'jd/load-theme-hook))
61
62(use-package ivy
63 :guix-package "emacs-ivy"
64 :diminish
65 :bind
66 (("C-s" . swiper))
67 :config
68 (ivy-mode 1))
69
70(use-package counsel
71 :guix-package "emacs-counsel"
72 :diminish t
73 :config
74 (counsel-mode 1))
75
76(use-package which-key
77 :guix-package "emacs-which-key"
78 :diminish
79 :config
80 (which-key-mode)
81 (setq which-key-idle-delay 0.3))
82
83(use-package all-the-icons
84 :guix-package "emacs-all-the-icons")
85
86(use-package beacon
87 :guix-package "emacs-beacon"
88 :config
89 (beacon-mode 1))
90
91(setq display-time-string-forms
92 '(" " 24-hours ":" minutes " "))
93
94(when jd/exwm-p
95 (display-battery-mode)
96 (display-time-mode))
97
98(provide 'jd-ui)
99
100;;; jd-ui.el ends here