From 6156f86dd5797de5ea4f912b70d38963c6cf4ad4 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sun, 2 Jul 2023 15:07:07 +0200 Subject: New Emacs config and change location of Emacs home dir. --- .config/emacs/jd/jd-gym.el | 120 -------------------------------------------- .config/emacs/jd/jd-mu4e.el | 76 ---------------------------- 2 files changed, 196 deletions(-) delete mode 100644 .config/emacs/jd/jd-gym.el delete mode 100644 .config/emacs/jd/jd-mu4e.el (limited to '.config/emacs/jd') diff --git a/.config/emacs/jd/jd-gym.el b/.config/emacs/jd/jd-gym.el deleted file mode 100644 index 2602e3e..0000000 --- a/.config/emacs/jd/jd-gym.el +++ /dev/null @@ -1,120 +0,0 @@ -;;; jd-gym.el --- Gym workout manager. -;;; Commentary: -;; It will be a gym workout manager in the future. -;;; code: - -(require 'emacsql-sqlite) - -(defconst jd-gym/db--tables-schema - '((workout-plans - [(id integer :primary-key :autoincrement) - (name text)]) - - (workouts - [(id integer :primary-key :autoincrement) - (workout-plan-id integer :not-null) - (day integer :not-null) - (month integer :not-null) - (year integer :not-null)] - (:foreign-key [workout-plan-id] :references workout-plans [id] :on-delete :cascade)) - - (muscle-part - [(id integer :primary-key :autoincrement) - (name text :not-null)]) - - (exercises - [(id integer :primary-key :autoincrement) - (name text :not-null) - (muscle-part-id integer :not-null)] - (:foreign-key [muscle-part-id] :references muscle-part [id] :on-delete :cascade)) - - (workout-plan-exercise-map - [(id integer :primary-key :autoincrement) - (week-day integer :not-null) - (workout-plan-id integer :not-null) - (exercise-id integer :not-null)] - (:foreign-key [workout-plan-id] :references workout-plans [id] :on-delete :cascade) - (:foreign-key [exercise-id] :references exercises [id] :on-delete :cascade)) - - (workout-sets - [(id integer :primary-key :autoincrement) - (reps integer :not-null) - (weight integer :not-null) - (workout-plan-exercise-map-id integer :not-null) - (comment text)] - (:foreign-key [workout-plan-exercise-map-id] :references workout-plan-exercise-map [id] :on-delete :cascade)))) - -(defconst jd-gym/db--test-data - '((workout-plans - ([nil "Push pull"])) - (workouts - ([nil 1 3 1 2023])) - (muscle-part - ([nil "glutes"] - [nil "chest"])) - (exercises - ([nil "Bench press" 2] - [nil "RDL" 1])) - (workout-plan-exercise-map - ([nil 0 1 1] ; Monday, Push pull, Bench press - [nil 1 1 2] ; Tuesday, Push pull, RDL - [nil 3 1 1] ; Thursday, Push pull, Bench press - [nil 4 1 2] ; Friday, Push pull, RDL - )) - (workout-sets - ([nil 7 70 1 "New PR!"] - [nil 8 110 2 "It was hard!"])))) - -(defun jd-gym/db--test-data-insert () - "Insert test data to jd-gym database." - (mapc (lambda (table) - (let ((table-name (car table)) - (table-data (cdr table))) - (emacsql jd-gym/db--conn [:insert :into $i1 - :values $v2] - table-name table-data))) - jd-gym/db--test-data)) - -(defvar jd-gym/db-path "~/Documents/Gym/gym.sqlite" - "Path can be relative or absolute.") - -(defvar jd-gym/db--conn nil - "Store connection to jd-gym database.") - -(defun jd-gym/db--conn-p () - "Check if jd-gym is connected to db." - (and (emacsql-sqlite-connection-p jd-gym/db--conn) - (emacsql-live-p jd-gym/db--conn))) - -(defun jd-gym/db--connect () - "Connect to db if there is no connection yet." - (unless (jd-gym/db--conn-p) - (setq jd-gym/db--conn (emacsql-sqlite jd-gym/db-path)))) - -(defun jd-gym/db--close () - "Close db connection." - (when (jd-gym/db--conn-p) - (emacsql-close jd-gym/db--conn))) - -(defun jd-gym/db--init () - "Initialize database structure." - (when (jd-gym/db--conn-p) - (emacsql jd-gym/db--conn [:pragma (= foreign_keys ON)]) - (emacsql jd-gym/db--conn "PRAGMA foreign_keys=ON") - (mapc (lambda (table) - (let ((table-name (car table)) - (table-schema (cdr table))) - (emacsql jd-gym/db--conn [:create-table $i1 $S2] table-name table-schema))) - jd-gym/db--tables-schema))) - -(defun jd-gym/db () - "Entrypoint to jd-gym db." - (unless (file-exists-p jd-gym/db-path) - (jd-gym/db--close) - (jd-gym/db--connect) ; Restart connection - (jd-gym/db--init))) - - -(provide 'jd-gym) - -;;; jd-gym.el ends here diff --git a/.config/emacs/jd/jd-mu4e.el b/.config/emacs/jd/jd-mu4e.el deleted file mode 100644 index 0f45f15..0000000 --- a/.config/emacs/jd/jd-mu4e.el +++ /dev/null @@ -1,76 +0,0 @@ -(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e") - -(use-package org-msg) - -(use-package mu4e - :defer 10 - :ensure nil - :config - (require 'org-mu4e) - - (setq mu4e-mu-binary "/usr/local/bin/mu") - (setq mu4e-update-interval (* 10 60)) - (setq mu4e-get-mail-command "mbsync -a") - (setq mu4e-maildir "~/Mail") - - (setq mu4e-completing-read-function #'ivy-completing-read) - - (setq mu4e-change-filenames-when-moving t) - - (setq mu4e-contexts - `(,(make-mu4e-context - :name "Abaks" - :match-func (lambda (msg) (when msg - (string-prefix-p "/abaks" (mu4e-message-field msg :maildir)))) - :vars '( - (user-full-name . "Jakub Dlugosz") - (user-mail-address . "jakub@abaks.pl") - (mu4e-sent-folder . "/abaks/Sent Items") - (mu4e-trash-folder . "/abaks/Trash") - (mu4e-drafts-folder . "/abaks/Drafts") - (mu4e-refile-folder . "/abaks/Archive") - (smtpmail-local-domain . "pl") - (smtpmail-smtp-server . "smtp.abaks.pl") - (mu4e-sent-messages-behavior . sent) - )) - ,(make-mu4e-context - :name "Gmail" - :match-func (lambda (msg) (when msg - (string-prefix-p "/gmail" (mu4e-message-field msg :maildir)))) - :vars '( - (user-full-name . "Jakub Dlugosz") - (user-mail-address . "jdlugosz963@gmail.com") - (mu4e-sent-folder . "/gmail/\[Gmail\]/Wys\&AUI-ane") - (mu4e-trash-folder . "/gmail/\[Gmail\]/Kosz") - (mu4e-drafts-folder . "/gmail/\[Gmail\]/Wersje\ robocze") - (mu4e-refile-folder . "/gmail/Archive") - (smtpmail-local-domain . "com") - (smtpmail-smtp-server . "smtp.gmail.com") - (mu4e-sent-messages-behavior . sent) - )))) - - (setq mail-user-agent 'mu4e-user-agent - mail-host-address nil - message-send-mail-function 'smtpmail-send-it - smtpmail-smtp-service 465 - smtpmail-stream-type 'ssl) - - (setq mu4e-compose-signature (concat - "Pozdrawiam,\n" - "Jakub Długosz")) - - (mu4e t)) - -(use-package mu4e-alert - :defer 20 - :config - (mu4e-alert-set-default-style 'libnotify) - (mu4e-alert-enable-mode-line-display) - (mu4e-alert-enable-notifications)) - -(jd/leader-key-def - "m" '(:ignore t :which-key "mail") - "mm" 'mu4e - "mc" 'mu4e-compose-new) - -(provide 'jd-mu4e) -- cgit v1.2.3