summaryrefslogtreecommitdiffstats
path: root/.emacs.d/jd
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/jd')
-rwxr-xr-x.emacs.d/jd/jd-apps.el87
-rwxr-xr-x.emacs.d/jd/jd-custom.el31
-rwxr-xr-x.emacs.d/jd/jd-dev.el173
-rwxr-xr-x.emacs.d/jd/jd-exwm.el171
-rwxr-xr-x.emacs.d/jd/jd-gym.el120
-rwxr-xr-x.emacs.d/jd/jd-keys.el115
-rwxr-xr-x.emacs.d/jd/jd-mu4e.el79
-rwxr-xr-x.emacs.d/jd/jd-org.el198
-rwxr-xr-x.emacs.d/jd/jd-ui.el102
9 files changed, 1076 insertions, 0 deletions
diff --git a/.emacs.d/jd/jd-apps.el b/.emacs.d/jd/jd-apps.el
new file mode 100755
index 0000000..5064ff9
--- /dev/null
+++ b/.emacs.d/jd/jd-apps.el
@@ -0,0 +1,87 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6;; (defun jd/open-new-vterm (&optional jd/vterm-buffer-name)
7;; (interactive)
8;; (let ((buffer-name (generate-new-buffer-name vterm-buffer-name)))
9;; (when jd/vterm-buffer-name
10;; (setq buffer-name jd/vterm-buffer-name))
11;; (switch-to-buffer buffer-name)
12;; (vterm-mode)))
13
14
15(jd/use-package vterm "emacs-vterm"
16 :init
17 (add-to-list 'project-switch-commands '(project-vterm "Vterm") t)
18 (add-to-list 'project-kill-buffer-conditions '(major-mode . vterm-mode))
19 (setq vterm-copy-exclude-prompt t)
20 :config
21 (setq vterm-buffer-name "vterm")
22 ;; (evil-set-initial-state 'vterm-mode 'emacs)
23 (setq vterm-tramp-shells (append '(("ssh" "/bin/bash")) vterm-tramp-shells))
24
25 (jd/leader-key-def "ot" '(jd/open-new-vterm :which-key "Open terminal in current window")))
26
27(jd/use-package all-the-icons-dired "emacs-all-the-icons-dired"
28 :hook (dired-mode . all-the-icons-dired-mode))
29
30;; (jd/use-package dired-ranger nil)
31
32(jd/use-package dired nil
33 :ensure nil
34 :commands (dired dired-jump)
35 :custom ((dired-listing-switches "-agho --group-directories-first"))
36 :config
37 ;; (evil-collection-define-key 'normal 'dired-mode-map
38 ;; "y" 'dired-ranger-copy
39 ;; "p" 'dired-ranger-paste
40 ;; "X" 'dired-ranger-move
41 ;; "h" 'dired-up-directory
42 ;; "t" 'dired-create-empty-file
43 ;; "T" 'dired-toggle-marks
44 ;; "l" 'dired-find-file)
45 (setq dired-kill-when-opening-new-dired-buffer t)
46 ;; (evil-define-key 'normal dired-mode-map (kbd "q") 'kill-current-buffer)
47 )
48
49;; (jd/use-package emms "emacs-emms"
50;; :config
51;; (require 'emms-setup)
52;; (emms-all)
53;; (emms-standard)
54;; (emms-default-players)
55;; (emms-mode-line-disable)
56;; (setq emms-browser-covers 'emms-browser-cache-thumbnail-async)
57;; (emms-add-directory-tree "~/Documents/Music/"))
58
59(jd/use-package pdf-tools "emacs-pdf-tools")
60
61(jd/use-package elfeed "emacs-elfeed"
62 :config
63 (setq elfeed-feeds
64 '(("https://www.reddit.com/r/emacs.rss" emacs)
65 ("https://www.reddit.com/r/gnu.rss" gnu)
66 ("https://stallman.org/rss/rss.xml" stallman)
67 ("https://news.ycombinator.com/rss" hacker-news))))
68
69;; (jd/use-package langtool
70;; :config
71;; (setq langtool-language-tool-jar "/home/jakub/Documents/LanguageTool-6.0/languagetool-commandline.jar")
72;; (setq langtool-default-language "pl-PL"))
73
74;; (jd/leader-key-def
75;; "l" '(:ignore t :which-key "langtool")
76;; "lc" 'langtool-check-buffer
77;; "ld" 'langtool-check-done
78;; "li" 'langtool-interactive-correction)
79
80(jd/use-package mastodon "emacs-mastodon"
81 :config
82 (setq mastodon-active-user "jdlugosz963"
83 mastodon-instance-url "https://fosstodon.org/"))
84
85(provide 'jd-apps)
86
87;;; jd-apps.el ends here
diff --git a/.emacs.d/jd/jd-custom.el b/.emacs.d/jd/jd-custom.el
new file mode 100755
index 0000000..96d13c6
--- /dev/null
+++ b/.emacs.d/jd/jd-custom.el
@@ -0,0 +1,31 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(defun jd/generete-qr-from-clipboard ()
7 (interactive)
8 (let ((clipboard-value (x-get-clipboard))
9 (clipboard-file-path "/tmp/clipboard_value.txt")
10 (clipboard-out-image "/tmp/qr.png"))
11 (with-temp-file clipboard-file-path
12 (insert clipboard-value))
13 (shell-command (concat
14 "qrencode -o "
15 clipboard-out-image
16 " < "
17 clipboard-file-path))
18 (find-file clipboard-out-image)))
19
20(setq erc-nick "bobbma"
21 erc-user-full-name "Jakub Dlugosz"
22 erc-notify-list '("akuleszaa"))
23
24(defun hipis-znc ()
25 (interactive)
26 (erc :server "195.74.91.18"
27 :port "6697"))
28
29(provide 'jd-custom)
30
31;;; jd-custom.el ends here
diff --git a/.emacs.d/jd/jd-dev.el b/.emacs.d/jd/jd-dev.el
new file mode 100755
index 0000000..d69313e
--- /dev/null
+++ b/.emacs.d/jd/jd-dev.el
@@ -0,0 +1,173 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6(setq c-default-style "linux"
7 c-basic-offset 8)
8
9(setq gdb-many-windows t)
10
11(jd/use-package lsp-mode "emacs-lsp-mode"
12 :commands (lsp lsp-deferred)
13 :init
14 (setq lsp-headerline-breadcrumb-enable nil)
15 (setq lsp-diagnostics-provider :none)
16 (setq lsp-modeline-diagnostics-enable nil)
17 (setq lsp-keymap-prefix "C-c l")
18 :config
19 (lsp-enable-which-key-integration t))
20
21(jd/use-package lsp-ivy "emacs-lsp-ivy"
22 :after lsp)
23
24(jd/use-package paredit "emacs-paredit")
25;; (jd/use-package evil-paredit "emacs-evil-paredit"
26;; :config
27;; (defun jd/lisp-mode-setup ()
28;; (rainbow-delimiters-mode)
29;; (evil-paredit-mode)
30;; (paredit-mode))
31;; (add-hook 'emacs-startup-hook
32;; (lambda ()
33;; (add-hook 'scheme-mode-hook 'jd/lisp-mode-setup)
34;; (add-hook 'emacs-lisp-mode-hook 'jd/lisp-mode-setup)
35;; (add-hook 'clojure-mode-hook 'jd/lisp-mode-setup)
36;; (add-hook 'lisp-mode-hook 'jd/lisp-mode-setup)))
37;; (evil-define-key 'normal paredit-mode-map (kbd "g h") 'paredit-forward-barf-sexp)
38;; (evil-define-key 'normal paredit-mode-map (kbd "g l") 'paredit-forward-slurp-sexp)
39;; (evil-define-key 'normal paredit-mode-map (kbd "g H") 'paredit-backward-slurp-sexp)
40;; (evil-define-key 'normal paredit-mode-map (kbd "g L") 'paredit-backward-barf-sexp))
41(jd/use-package rainbow-delimiters "emacs-rainbow-delimiters")
42
43(jd/use-package geiser "emacs-geiser")
44(jd/use-package geiser-guile "emacs-geiser-guile")
45
46;; (defun jd/python-mode-setup ()
47;; (let ((project-venv-path (concat (projectile-project-root) "venv/")))
48;; (when (projectile--directory-p project-venv-path)
49;; (pyvenv-activate project-venv-path)
50;; (pyvenv-mode))))
51
52;; (jd/use-package python-mode ;;TODO: find alternative
53;; :hook (python-mode . lsp-deferred)
54;; :hook (python-mode . jd/python-mode-setup)
55;; :config
56;; (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode)))
57
58(jd/use-package pyvenv "emacs-pyvenv"
59 :after python-mode)
60
61(jd/use-package typescript-mode "emacs-typescript-mode"
62 :mode ("\\.ts\\'")
63 :config
64 (setq typescript-indent-level 2))
65
66;; (defun jd/activate-tide-mode ()
67;; (when (and (stringp buffer-file-name)
68;; (string-match "\\.[tj]sx?\\'" buffer-file-name))
69;; (tide-setup)
70;; (tide-hl-identifier-mode)))
71
72(jd/use-package tide "emacs-tide"
73 :after (typescript-mode company web-mode))
74
75(jd/use-package flycheck "emacs-flycheck"
76 :hook ((after-init . global-flycheck-mode)))
77
78(jd/use-package web-mode "emacs-web-mode"
79 :hook ((web-mode . jd/activate-tide-mode))
80 :mode
81 ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'")
82 :config
83 (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'")))
84 (setq web-mode-markup-indent-offset 2)
85 (setq web-mode-css-indent-offset 2)
86 (setq web-mode-code-indent-offset 2)
87 (setq web-mode-script-padding 2)
88 (setq web-mode-block-padding 2)
89 (setq web-mode-style-padding 2)
90 (setq web-mode-enable-auto-pairing t)
91 (setq web-mode-enable-auto-closing t)
92 (setq web-mode-enable-current-element-highlight t))
93
94(jd/use-package yaml-mode "emacs-yaml-mode")
95
96(jd/use-package docker "emacs-docker"
97 :config
98 (jd/leader-key-def
99 "d" '(:ignore t :which-key "Docker")
100 "dc" '(docker-containers :which-key "Docker containers")
101 "dd" '(docker :which-key "Docker")))
102
103(jd/use-package company "emacs-company"
104 :after lsp-mode
105 :hook (lsp-mode . company-mode)
106 :bind (:map company-active-map
107 ("<tab>" . company-complete-selection))
108 (:map lsp-mode-map
109 ("<tab>" . company-indent-or-complete-common))
110 :custom
111 (company-minimum-prefix-length 1)
112 (company-idle-delay 0.0)
113 :config
114 (global-company-mode))
115
116(jd/use-package company-box "emacs-company-box"
117 :hook (company-mode . company-box-mode))
118
119(jd/use-package projectile "emacs-projectile"
120 :diminish projectile-mode
121 :init
122 (when (file-directory-p "~/Documents/code")
123 (setq projectile-project-search-path '("~/Documents/code/")))
124 :custom ((projectile-Completion-system 'ivy))
125 :config
126 (setq projectile-switch-project-action #'projectile-dired)
127 (projectile-mode)
128
129 (jd/leader-key-def
130 "p" '(projectile-command-map :which-key "Project")
131 "p <ESC>" '()
132 "SPC" '(projectile-find-file :which-key "Find file in project")))
133
134(jd/use-package neotree "emacs-neotree"
135 :init
136 (setq neo-theme 'icons)
137 :config
138
139 ;; (evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
140 ;; (evil-define-key 'normal neotree-mode-map (kbd "C-RET") 'neotree-quick-look)
141 ;; (evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
142 ;; (evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
143 ;; (evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh)
144 ;; (evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle)
145 ;; (evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle)
146
147 (jd/leader-key-def
148 "op" '(jd/neotree-project-dir :which-key "Open neotree"))
149
150 (defun jd/neotree-project-dir ()
151 "Open NeoTree using the git root."
152 (interactive)
153 (let ((project-dir (projectile-project-root))
154 (file-name (buffer-file-name)))
155 (neotree-toggle)
156 (if project-dir
157 (if (neo-global--window-exists-p)
158 (progn
159 (neotree-dir project-dir)
160 (neotree-find file-name)))
161 (message "Could not find git project root.")))))
162
163(jd/use-package magit "emacs-magit"
164 :custom
165 (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
166
167 (jd/leader-key-def
168 "g" '(:ignore t :which-key "Git")
169 "gg" '(magit-status-here :which-key "Magit status")))
170
171(provide 'jd-dev)
172
173;;; jd-dev.el ends here
diff --git a/.emacs.d/jd/jd-exwm.el b/.emacs.d/jd/jd-exwm.el
new file mode 100755
index 0000000..5e95a63
--- /dev/null
+++ b/.emacs.d/jd/jd-exwm.el
@@ -0,0 +1,171 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6
7(jd/use-package exwm "emacs-exwm"
8 :config
9 (defun jd/exwm-update-class ()
10 (exwm-workspace-rename-buffer exwm-class-name))
11
12 (defun jd-exwm/run-in-background (command)
13 (let ((command-parts (split-string command "[ ]+")))
14 (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
15
16 (defun jd-exwm/restart-process (program-name)
17 (call-process "killall" nil nil nil program-name)
18 (jd-exwm/run-in-background program-name))
19
20 (defun jd-exwm/exwm-init-hook ()
21 (jd-exwm/run-in-background "nitrogen --restore")
22 (start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1")
23 (start-process-shell-command "syndaemon" nil "syndaemon -i 0.8 -K -R -d")
24
25 (jd-exwm/restart-process "polybar")
26 (jd-exwm/restart-process "nm-applet")
27 (jd-exwm/restart-process "redshift-gtk -l 54.37:18.6")
28 (jd-exwm/restart-process "blueman-applet"))
29
30 (defun jd-exwm/exwm-update-title ()
31 (exwm-workspace-rename-buffer exwm-title))
32
33 (defun jd-exwm/configure-window-by-class ()
34 (interactive)
35 (pcase exwm-class-name
36 ("firefox" (exwm-workspace-move-window 2))
37 ("Brave" (exwm-workspace-move-window 2))
38 ("qutebrowser" (exwm-workspace-move-window 2))
39 ("discord" (exwm-workspace-move-window 5))
40 ("obs" (exwm-workspace-move-window 5))
41 ("Virt-manager" (exwm-workspace-move-window 4))))
42
43 (setq exwm-workspace-number 10)
44
45 ;; (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook)
46 (add-hook 'exwm-update-class-hook #'jd/exwm-update-class)
47 (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title)
48 (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class)
49
50 (require 'exwm-randr)
51 (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1"))
52 (exwm-randr-enable)
53
54 (setq exwm-input-simulation-keys
55 '(([?\C-b] . [left])
56 ([?\C-f] . [right])
57 ([?\C-p] . [up])
58 ([?\C-n] . [down])
59 ([?\C-a] . [home])
60 ([?\C-e] . [end])
61 ([?\C-k] . [S-end delete])
62 ([?\M-w] . [C-c])
63 ([?\C-y] . [C-v])
64 ([?\C-v] . [next])
65 ([?\C-\M-v] . [prior])
66 ))
67
68 (setq exwm-input-prefix-keys
69 '(?\C-x
70 ?\C-u
71 ?\C-h
72 ?\M-x
73 ?\M-`
74 ?\M-&
75 ?\M-:
76 ?\C-\M-j
77 ?\C-\ ))
78
79 (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
80 (exwm-input-set-key (kbd "s-p") 'counsel-linux-app)
81
82 (setq exwm-input-global-keys
83 `(([?\s-R] . exwm-reset)
84
85
86 ([?\s-r] . (lambda (command)
87 (interactive (list (read-shell-command "$ ")))
88 (start-process-shell-command command nil command)))
89
90 ([?\s-W] . exwm-workspace-move-window)
91 ([?\s-w] . exwm-workspace-switch)
92
93 ,@(mapcar (lambda (i)
94 `(,(kbd (format "s-%d" i)) .
95 (lambda ()
96 (interactive)
97 (exwm-workspace-switch-create ,i))))
98 (number-sequence 0 9))))
99
100 (exwm-enable))
101
102(jd/use-package desktop-environment "emacs-desktop-environment"
103 :after exwm
104 :custom
105 (desktop-environment-brightness-small-increment "2%+")
106 (desktop-environment-brightness-small-decrement "2%-")
107 (desktop-environment-brightness-normal-increment "5%+")
108 (desktop-environment-brightness-normal-decrement "5%-")
109
110 :config
111 (defun jd/dunst-show-history ()
112 (interactive)
113 (start-process-shell-command "dunstctl" nil "dunstctl history-pop"))
114
115 (defun jd/dunst-close ()
116 (interactive)
117 (start-process-shell-command "dunstctl" nil "dunstctl close"))
118
119 (defun jd/dunst-close-all ()
120 (interactive)
121 (start-process-shell-command "dunstctl" nil "dunstctl close-all"))
122
123 (jd/leader-key-def
124 "d" '(nil :which-key "dunst")
125 "dh" '(jd/dunst-show-history :which-key "show history")
126 "dc" '(jd/dunst-close :which-key "close")
127 "da" '(jd/dunst-close-all :which-key "close all"))
128
129 (desktop-environment-mode))
130
131(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
132(add-to-list 'default-frame-alist `(alpha . (90 . 90)))
133(set-frame-parameter (selected-frame) 'fullscreen 'maximized)
134(add-to-list 'default-frame-alist '(fullscreen . maximized))
135
136(defun jd-exwm/get-color (ATTRIBUTE)
137 (face-attribute 'default ATTRIBUTE))
138
139(defun theme-to-xresources ()
140 (interactive)
141 (require 'term)
142 (with-temp-buffer
143 (insert "! Generated by theme-to-xresources\n")
144 (dolist (spec
145 '(("emacs.background" :background "E6")
146 ("emacs.foreground" :foreground "")))
147 (let ((color (jd-exwm/get-color (cadr spec))))
148 (insert (format "%s: #%s%s\n"
149 (car spec)
150 (caddr spec)
151 (string-remove-prefix "#" color))))
152 jd
153 (write-region (point-min) (point-max) "~/.Xresources")))
154 (call-process "xrdb" nil nil nil "-merge" (expand-file-name "~/.Xresources")))
155
156(defun jd/theme-sync ()
157 (interactive)
158 (theme-to-xresources)
159 (setq org-confirm-babel-evaluate nil)
160 (org-babel-tangle-file "~/dotfiles/Desktop.org")
161 (setq org-confirm-babel-evaluate 't)
162 (call-process "killall" nil nil nil "dunst") ;; TODO: prevent clear notification history
163 (jd-exwm/restart-process "polybar"))
164
165;; (add-hook 'jd/load-theme-hook #'jd/theme-sync)
166;; (add-hook 'exwm-init-hook #'jd/theme-sync)
167
168(provide 'jd-exwm)
169
170;;; jd-exwm.el ends here
171
diff --git a/.emacs.d/jd/jd-gym.el b/.emacs.d/jd/jd-gym.el
new file mode 100755
index 0000000..2602e3e
--- /dev/null
+++ b/.emacs.d/jd/jd-gym.el
@@ -0,0 +1,120 @@
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
new file mode 100755
index 0000000..7c0d6b2
--- /dev/null
+++ b/.emacs.d/jd/jd-keys.el
@@ -0,0 +1,115 @@
1;;; Dotfiles --- Jakub Dlugosz emacs config
2;;; Commentary:
3
4;;; Code:
5
6;; (jd/use-package evil "emacs-evil"
7;; :init
8;; (setq evil-want-integration t)
9;; (setq evil-want-keybinding nil)
10;; (setq evil-want-C-u-scroll t)
11;; (setq evil-want-Y-yank-to-eol t)
12;; (setq evil-want-C-i-jump nil)
13;; (setq evil-undo-system 'undo-tree)
14;; (setq evil-kill-on-visual-paste nil)
15;; :config
16;; (evil-set-initial-state 'exwm-mode 'emacs)
17;; (evil-mode 1))
18
19(jd/use-package general "emacs-general"
20 :config
21 (general-create-definer jd/leader-key-def
22 :keymaps '(normal insert visual emacs)
23 :prefix "SPC"
24 :global-prefix "C-z")
25
26 (general-create-definer jd/ctrl-c-keys
27 :prefix "C-c")
28
29 ;; (jd/leader-key-def
30 ;; "w" 'evil-window-map
31 ;; "wr" '(hydra-resize-window/body :which-key "Rezize window")
32 ;; "wd" '(evil-window-delete :which-key "Window delete"))
33
34 (jd/leader-key-def
35 "ou" '(undo-tree-visualize :which-key "Open"))
36
37 ;; remove . key
38 ;; (define-key evil-normal-state-map (kbd ".") '())
39 (jd/leader-key-def
40 "f" '(:ignore t :which-key "Files")
41 "fs" '(save-buffer :which-key "File save")
42 "." '(find-file :which-key "Find file")
43 "ff" '(find-file :which-key "Find file"))
44
45 (jd/leader-key-def
46 "e" '(:ignore t :which-key "Eval")
47 "eb" '(eval-buffer :which-key "Eval buffer")
48 "ee" '(eval-defun :which-key "Eval defun"))
49
50 (jd/leader-key-def
51 :keymaps '(visual)
52 "er" '(eval-region :which-key "Eval region"))
53
54 (defun jd/kill-other-buffers ()
55 (interactive)
56 (mapc 'kill-buffer (cdr (buffer-list (current-buffer)))))
57
58 (jd/leader-key-def
59 "bK" '(jd/kill-other-buffers :which-key "Kill other buffers")
60 "bk" '(kill-current-buffer :which-key "Kill buffer")
61 "bB" '(ibuffer :which-key "Open ibuffer")))
62
63
64(jd/use-package hydra "emacs-hydra"
65 ;; :defer t
66 :config
67 (defun jd/text-scale-increase ()
68 (interactive)
69 (let ((old-face-attribute (face-attribute 'default :height)))
70 (set-face-attribute 'default nil :height (+ old-face-attribute 10))))
71
72 (defun jd/text-scale-decrease ()
73 (interactive)
74 (let ((old-face-attribute (face-attribute 'default :height)))
75 (set-face-attribute 'default nil :height (- old-face-attribute 10))))
76
77 ;; (defhydra hydra-resize-window (:timeout 4)
78 ;; ("h" evil-window-decrease-width "<")
79 ;; ("l" evil-window-increase-width ">")
80 ;; ("k" evil-window-decrease-height "^")
81 ;; ("j" evil-window-increase-height "v")
82 ;; ("q" nil "finished" :exit t))
83
84 (defhydra hydra-text-scale-global (:timeout 4)
85 "scale text"
86 ("j" jd/text-scale-increase "in")
87 ("k" jd/text-scale-decrease "out")
88 ("q" nil "finished" :exit t))
89
90 (defhydra hydra-text-scale (:timeout 4)
91 "scale text"
92 ("j" text-scale-increase "in")
93 ("k" text-scale-decrease "out")
94 ("q" nil "finished" :exit t))
95
96 (jd/leader-key-def
97 "tS" '(hydra-text-scale-global/body :which-key "Scale text")
98 "ts" '(hydra-text-scale/body :which-key "Scale text")))
99
100
101(jd/use-package undo-tree "emacs-undo-tree"
102 :diminish
103 :config
104 (setq undo-tree-auto-save-history nil)
105 (global-undo-tree-mode 1))
106
107;; (jd/use-package evil-collection "emacs-evil-collection"
108;; :after evil
109;; :config
110;; (evil-collection-init))
111
112
113(provide 'jd-keys)
114
115;;; jd-keys.el ends here
diff --git a/.emacs.d/jd/jd-mu4e.el b/.emacs.d/jd/jd-mu4e.el
new file mode 100755
index 0000000..e97c4fc
--- /dev/null
+++ b/.emacs.d/jd/jd-mu4e.el
@@ -0,0 +1,79 @@
1(when (not jd/guix-p)
2 (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e"))
3
4(jd/use-package htmlize "emacs-htmlize")
5
6; (jd/add-package-to-manifest "mbsync") ;; TODO: Define guix mbsync package?
7
8(jd/use-package mu4e "mu"
9 :defer 10
10 :ensure nil
11 :config
12 (require 'org-mu4e)
13
14 (setq mu4e-mu-binary "/usr/local/bin/mu")
15 (setq mu4e-update-interval (* 10 60))
16 (setq mu4e-get-mail-command "mbsync -a")
17 (setq mu4e-maildir "~/Mail")
18
19 (setq mu4e-completing-read-function #'ivy-completing-read)
20
21 (setq mu4e-change-filenames-when-moving t)
22
23 (setq mu4e-contexts
24 `(,(make-mu4e-context
25 :name "Abaks"
26 :match-func (lambda (msg) (when msg
27 (string-prefix-p "/abaks" (mu4e-message-field msg :maildir))))
28 :vars '(
29 (user-full-name . "Jakub Dlugosz")
30 (user-mail-address . "jakub@abaks.pl")
31 (mu4e-sent-folder . "/abaks/Sent Items")
32 (mu4e-trash-folder . "/abaks/Trash")
33 (mu4e-drafts-folder . "/abaks/Drafts")
34 (mu4e-refile-folder . "/abaks/Archive")
35 (smtpmail-local-domain . "pl")
36 (smtpmail-smtp-server . "smtp.abaks.pl")
37 (mu4e-sent-messages-behavior . sent)
38 ))
39 ,(make-mu4e-context
40 :name "Gmail"
41 :match-func (lambda (msg) (when msg
42 (string-prefix-p "/gmail" (mu4e-message-field msg :maildir))))
43 :vars '(
44 (user-full-name . "Jakub Dlugosz")
45 (user-mail-address . "jdlugosz963@gmail.com")
46 (mu4e-sent-folder . "/gmail/\[Gmail\]/Wys\&AUI-ane")
47 (mu4e-trash-folder . "/gmail/\[Gmail\]/Kosz")
48 (mu4e-drafts-folder . "/gmail/\[Gmail\]/Wersje\ robocze")
49 (mu4e-refile-folder . "/gmail/Archive")
50 (smtpmail-local-domain . "com")
51 (smtpmail-smtp-server . "smtp.gmail.com")
52 (mu4e-sent-messages-behavior . sent)
53 ))))
54
55 (setq mail-user-agent 'mu4e-user-agent
56 mail-host-address nil
57 message-send-mail-function 'smtpmail-send-it
58 smtpmail-smtp-service 465
59 smtpmail-stream-type 'ssl)
60
61 (setq mu4e-compose-signature (concat
62 "Pozdrawiam,\n"
63 "Jakub Długosz"))
64
65 (mu4e t))
66
67(jd/use-package mu4e-alert "emacs-mu4e-alert"
68 :defer 20
69 :config
70 (mu4e-alert-set-default-style 'libnotify)
71 (mu4e-alert-enable-mode-line-display)
72 (mu4e-alert-enable-notifications)
73
74 (jd/leader-key-def
75 "m" '(:ignore t :which-key "mail")
76 "mm" 'mu4e
77 "mc" 'mu4e-compose-new))
78
79(provide 'jd-mu4e)
diff --git a/.emacs.d/jd/jd-org.el b/.emacs.d/jd/jd-org.el
new file mode 100755
index 0000000..cd05d72
--- /dev/null
+++ b/.emacs.d/jd/jd-org.el
@@ -0,0 +1,198 @@
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-daily-home (concat jd/org-home "/roam/daily"))
9
10(defun jd/org-mode-init ()
11 (org-indent-mode)
12 (variable-pitch-mode 1)
13 (visual-line-mode 1))
14
15(defun jd-emacs/org-insert-date (&optional date)
16 (let ((d (or date "+0d")))
17 (org-insert-time-stamp (org-read-date nil t d))))
18
19(jd/use-package org "emacs-org"
20 :pin org
21 :commands (org-capture org-agenda)
22 :hook (org-mode . jd/org-mode-init)
23 :config
24 (setq org-directory (file-truename "~/Documents/Org/"))
25 (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org"))
26 (setq org-mobile-directory "~/Dropbox/Apps/MobileOrg")
27 (setq org-agenda-files
28 '("Tasks.org"))
29 (setq org-ellipsis " ▾")
30 (setq org-agenda-start-with-log-mode t)
31 (setq org-log-done 'time)
32 (setq org-log-into-drawer t)
33 (setq org-return-follows-link t)
34 (setq org-capture-templates
35 `(("t" "Tasks / Projects")
36 ("tt" "Task" entry (file+olp "Tasks.org" "Inbox")
37 "* TODO %?\n %t\n %a\n %i" :empty-lines 1)
38 ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox")
39 "* TODO %?\n %t\n SCHEDULED: %(jd-emacs/org-insert-date \"+1d\")>\n %a\n %i" :empty-lines 1)
40
41 ("m" "Metrics Capture")
42 ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics")
43 "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t)
44 ("sh" "School Homework" entry (file+olp "school/todo(jd-emacs/org-insert-date \"1\").org"))))
45
46 (setq org-latex-listings 'minted
47 org-latex-packages-alist '(("" "minted"))
48 org-latex-pdf-process
49 '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
50 "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
51 (require 'org-tempo)
52
53 (jd/leader-key-def
54 "o" '(:ignore t :which-key "Open/Org")
55 "oc" '(org-capture :which-key "Open org-capture")
56 "oop" '(org-mobile-pull :which-key "Org mobile pull")
57 "ooP" '(org-mobile-push :which-key "Org mobile push")
58 "oa" '(org-agenda :which-key "Open org-agenda"))
59
60 (defun jd/org-font-setup ()
61 ;; Replace list hyphen with dot
62 (font-lock-add-keywords 'org-mode
63 '(("^ *\\([-]\\) "
64 (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-"))))))
65
66 ;; Set faces for heading levels
67 (dolist (face '((org-level-1 . 1.3)
68 (org-level-2 . 1.2)
69 (org-level-3 . 1.1)
70 (org-level-4 . 1.0)
71 (org-level-5 . 1.0)
72 (org-level-6 . 1.0)
73 (org-level-7 . 1.0)
74 (org-level-8 . 1.0)))
75 (set-face-attribute (car face) nil :font "Terminus" :weight 'Bold :height (cdr face)))
76
77 ;; Ensure that anything that should be fixed-pitch in Org files appears that way
78 (set-face-attribute 'org-block nil :font "Terminus" :inherit 'fixed-pitch :height 100)
79 (set-face-attribute 'org-table nil :inherit 'fixed-pitch)
80 (set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
81 (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
82 (set-face-attribute 'org-table nil :font "Terminus" :inherit '(shadow fixed-pitch))
83 (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
84 (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
85 (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
86 (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
87 (set-face-attribute 'line-number nil :inherit 'fixed-pitch)
88 (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
89
90 (with-eval-after-load 'org (jd/org-font-setup))
91
92 (defun jd-emacs/org-timer-stop ()
93 (start-process-shell-command "notify-send" nil "notify-send Zakonczono odliczanie"))
94
95
96 (add-hook 'org-timer-stop-hook #'jd-emacs/org-timer-stop)
97
98 (defun jd/org-tempo-setup ()
99 (add-to-list 'org-structure-template-alist '("s" . "src"))
100 (add-to-list 'org-structure-template-alist '("sql" . "src sql"))
101 (add-to-list 'org-structure-template-alist '("sh" . "src sh"))
102 (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
103 (add-to-list 'org-structure-template-alist '("li" . "src lisp"))
104 (add-to-list 'org-structure-template-alist '("sc" . "src scheme"))
105 (add-to-list 'org-structure-template-alist '("ts" . "src typescript"))
106 (add-to-list 'org-structure-template-alist '("py" . "src python"))
107 (add-to-list 'org-structure-template-alist '("go" . "src go"))
108 (add-to-list 'org-structure-template-alist '("yaml" . "src yaml")))
109
110 (with-eval-after-load 'org-tempo (jd/org-tempo-setup))
111
112 (org-babel-do-load-languages
113 'org-babel-load-languages
114 '((emacs-lisp . t)
115 (python . t)))
116
117 (defun jd/org-babel-tangle-config ()
118 (when (string-equal (file-name-directory (buffer-file-name))
119 (expand-file-name "~/dotfiles/"))
120 ;; Dynamic scoping to the rescue
121 (let ((org-confirm-babel-evaluate nil))
122 (org-babel-tangle))))
123
124 (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config)))
125
126 (defun jd/org-mode-visual-fill ()
127 (setq visual-fill-column-width 100
128 visual-fill-column-center-text t)
129 (visual-fill-column-mode 1)))
130
131;; (jd/use-package evil-org "emacs-evil-org"
132;; :after org
133;; :hook (org-mode . (lambda () evil-org-mode))
134;; :config
135;; (require 'evil-org-agenda)
136;; (evil-org-agenda-set-keys))
137
138(jd/use-package visual-fill-column "emacs-visual-fill-column"
139 :hook (org-mode . jd/org-mode-visual-fill))
140
141(jd/use-package org-superstar "emacs-org-superstar"
142 :hook (org-mode . org-superstar-mode)
143 :init
144 (setq org-superstar-special-todo-items t)
145 (setq org-superstar-remove-leading-stars t)
146 (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●")))
147
148; (jd/add-package-to-manifest "emacs-emacsql-sqlite3")
149(jd/use-package org-roam "emacs-org-roam"
150 :custom
151 (org-roam-directory (file-truename jd/org-roam-home))
152 :bind (("C-c n l" . org-roam-buffer-toggle)
153 ("C-c n f" . org-roam-node-find)
154 ("C-c n g" . org-roam-graph)
155 ("C-c n i" . org-roam-node-insert)
156 ("C-c n c" . org-roam-capture)
157 ;; Dailies
158 ("C-c n j" . org-roam-dailies-capture-today))
159 :bind-keymap
160 ("C-c n d" . org-roam-dailies-map)
161 :config
162 (defun jd/org-roam-filter-by-tag (tag-name)
163 (lambda (node)
164 (member tag-name (org-roam-node-tags node))))
165
166 (defun jd/org-roam-list-notes-by-tag (tag-name)
167 (mapcar #'org-roam-node-file
168 (seq-filter
169 (jd/org-roam-filter-by-tag tag-name)
170 (org-roam-node-list))))
171
172 (defun jd/org-roam-refreshagenda-list ()
173 (interactive)
174 (setq org-agenda-files (org-roam-list-files)))
175
176 (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
177 (setq org-roam-capture-templates
178 '(("a" "workstuff" plain (file (concat org-roam-directory "/work"))
179 :target (file+head "work/%<%Y%m%d%H%M%S>-${slug}.org"
180 "#+title: ${title}\n") :unnarrowed t)
181 ("b" "research" plain (file "~/Documents/roam/study/templates/research.org")
182 :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org"
183 "#+title: ${title}\n") :unnarrowed t)
184 ("s" "School" plain nil
185 :target (file+head
186 "school/%<%Y%m%d%H%M%S>-${slug}.org"
187 "#+title: ${title}\n")
188 :unnarrowed t)
189 ("d" "default" plain nil
190 :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
191 "#+title: ${title}\n") :unnarrowed t)
192 ))
193
194 (org-roam-db-autosync-mode))
195
196(provide 'jd-org)
197
198;;; jd-org.el ends here
diff --git a/.emacs.d/jd/jd-ui.el b/.emacs.d/jd/jd-ui.el
new file mode 100755
index 0000000..4c8e04b
--- /dev/null
+++ b/.emacs.d/jd/jd-ui.el
@@ -0,0 +1,102 @@
1
2;; Dotfiles --- Jakub Dlugosz emacs config
3;;; Commentary:
4
5;;; Code:
6
7(setq inhibit-startup-message t)
8(setq visible-bell t)
9(scroll-bar-mode -1)
10(tool-bar-mode -1)
11(tooltip-mode -1)
12(menu-bar-mode -1)
13(set-fringe-mode 10)
14
15(set-face-attribute 'default nil :font "Terminus" :height 100)
16
17(add-hook 'prog-mode-hook 'menu-bar--display-line-numbers-mode-relative)
18
19(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
20
21(global-prettify-symbols-mode 1)
22
23(defalias 'yes-or-no-p 'y-or-n-p)
24
25(jd/use-package doom-themes "emacs-doom-themes"
26 :config
27 ;; (load-theme 'manoj-black t)
28 )
29
30(load-theme 'manoj-dark t)
31
32(jd/use-package diminish "emacs-diminish")
33
34(jd/use-package hl-todo "emacs-hl-todo"
35 :init
36 (setq hl-todo-keyword-faces
37 '(("TODO" . "#FF0000")
38 ("FIXME" . "#FF0000")
39 ("DEBUG" . "#A020F0")))
40 :config
41 (global-hl-todo-mode 1))
42
43(defun jd/switch-buffer ()
44 (interactive)
45 (let ((completion-regexp-list '("\\`[^*]"
46 "\\`\\([^T]\\|T\\($\\|[^A]\\|A\\($\\|[^G]\\|G\\($\\|[^S]\\|S.\\)\\)\\)\\).*")))
47 (call-interactively 'counsel-switch-buffer)))
48
49(defvar jd/load-theme-hook nil)
50(defun jd/load-theme ()
51 (interactive)
52 (counsel-load-theme)
53 (run-hooks 'jd/load-theme-hook))
54
55(jd/use-package ivy "emacs-ivy"
56 :diminish
57 :bind
58 (("C-s" . swiper)
59 ;; :map ivy-minibuffer-map
60 ;; ("C-k" . ivy-previous-line)
61 ;; ("C-j" . ivy-next-line)
62 ;; :map ivy-switch-buffer-map
63 ;; ("C-k" . ivy-previous-line)
64 )
65 :config
66 (ivy-mode 1))
67
68(jd/use-package counsel "emacs-counsel"
69 :config
70 (counsel-mode 1)
71
72 (jd/leader-key-def
73 "t" '(:ignore t :which-key "Toggle")
74 "tT" '(toggle-truncate-lines :which-key "Toggle truncate lines")
75 "tt" '(jd/load-theme :which-key "Choose theme"))
76
77 (jd/leader-key-def
78 "bb" '(jd/switch-buffer :which-key "Buffer switch")
79 "ba" '(counsel-switch-buffer :which-key "Buffer switch")
80 "b" '(:ignore t :which-key "Buffer")
81 "," '(counsel-switch-buffer :which-key "Buffer switch")))
82
83(jd/use-package which-key "emacs-which-key"
84 :diminish
85 :config
86 (which-key-mode)
87 (setq which-key-idle-delay 0.3))
88
89(jd/use-package all-the-icons "emacs-all-the-icons")
90
91(jd/use-package doom-modeline "emacs-doom-modeline"
92 ; :init (doom-modeline-mode 0)
93 :custom ((doom-modeline-height 15)))
94
95(jd/use-package beacon "emacs-beacon"
96 :config
97 (beacon-mode 1))
98
99
100(provide 'jd-ui)
101
102;;; jd-ui.el ends here