From 06e0a80f7b509fc2a565aff9ec8311caf4bf6aae Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sat, 27 Apr 2024 20:09:08 +0200 Subject: Remove trash and change name from jd/use-package to use-package! --- .emacs.d/init.el | 9 +- .emacs.d/jd/jd-apps.el | 113 ++++---------- .emacs.d/jd/jd-custom.el | 27 ---- .emacs.d/jd/jd-dev.el | 232 +++++++++++++---------------- .emacs.d/jd/jd-exwm.el | 252 +++++++++++++++---------------- .emacs.d/jd/jd-gym.el | 2 +- .emacs.d/jd/jd-keys.el | 156 +++++--------------- .emacs.d/jd/jd-mu4e.el | 137 +++++++++-------- .emacs.d/jd/jd-org.el | 375 +++++++++++++++++++++++------------------------ .emacs.d/jd/jd-ui.el | 88 +++++------ 10 files changed, 580 insertions(+), 811 deletions(-) (limited to '.emacs.d') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index a0cb8a0..d9183a1 100755 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -86,9 +86,10 @@ (setq use-package-always-ensure (not jd/guix-p)) -(defmacro jd/use-package (package-name - guix-package-name - &rest body) +(defmacro use-package! (package-name + guix-package-name + &rest body) + (declare (indent defun)) `(progn ,(when guix-package-name `(jd/add-package-to-manifest ,guix-package-name)) @@ -121,6 +122,8 @@ (require 'jd-apps) (require 'jd-custom) (require 'jd-mu4e) +(require 'jd-misc) +(require 'jd-sway) (when jd/exwm-p (require 'jd-exwm)) diff --git a/.emacs.d/jd/jd-apps.el b/.emacs.d/jd/jd-apps.el index 2163435..a831d8d 100755 --- a/.emacs.d/jd/jd-apps.el +++ b/.emacs.d/jd/jd-apps.el @@ -3,100 +3,39 @@ ;;; Code: -;; (defun jd/open-new-vterm (&optional jd/vterm-buffer-name) -;; (interactive) -;; (let ((buffer-name (generate-new-buffer-name vterm-buffer-name))) -;; (when jd/vterm-buffer-name -;; (setq buffer-name jd/vterm-buffer-name)) -;; (switch-to-buffer buffer-name) -;; (vterm-mode))) - - -(jd/use-package vterm "emacs-vterm" - :init - (add-to-list 'project-switch-commands '(project-vterm "Vterm") t) - (add-to-list 'project-kill-buffer-conditions '(major-mode . vterm-mode)) - (setq vterm-copy-exclude-prompt t) - :config - (setq vterm-buffer-name "vterm") - ;; (evil-set-initial-state 'vterm-mode 'emacs) - (setq vterm-tramp-shells (append '(("ssh" "/bin/bash")) vterm-tramp-shells)) - - (jd/leader-key-def "ot" '(jd/open-new-vterm :which-key "Open terminal in current window"))) - -(jd/use-package all-the-icons-dired "emacs-all-the-icons-dired" - :hook (dired-mode . all-the-icons-dired-mode)) - -;; (jd/use-package dired-ranger nil) - -(jd/use-package dired nil - :ensure nil - :commands (dired dired-jump) - :custom ((dired-listing-switches "-agho --group-directories-first")) - :config - ;; (evil-collection-define-key 'normal 'dired-mode-map - ;; "y" 'dired-ranger-copy - ;; "p" 'dired-ranger-paste - ;; "X" 'dired-ranger-move - ;; "h" 'dired-up-directory - ;; "t" 'dired-create-empty-file - ;; "T" 'dired-toggle-marks - ;; "l" 'dired-find-file) - (setq dired-kill-when-opening-new-dired-buffer t) - ;; (evil-define-key 'normal dired-mode-map (kbd "q") 'kill-current-buffer) - ) - -(jd/use-package emms "emacs-emms" +(use-package! vterm "emacs-vterm" + :init + (add-to-list 'project-switch-commands '(project-vterm "Vterm") t) + (add-to-list 'project-kill-buffer-conditions '(major-mode . vterm-mode)) + (setq vterm-copy-exclude-prompt t) :config - (require 'emms-setup) - (emms-all) - (emms-standard) - (emms-default-players) - (emms-mode-line-disable) - (setq emms-browser-covers 'emms-browser-cache-thumbnail-async) - (emms-add-directory-tree "~/Documents/Music/")) - -(jd/use-package pdf-tools "emacs-pdf-tools") - -(jd/use-package elfeed "emacs-elfeed" - :config - (setq elfeed-feeds - '(("https://www.reddit.com/r/emacs.rss" emacs) - ("https://www.reddit.com/r/gnu.rss" gnu) - ("https://stallman.org/rss/rss.xml" stallman) - ("https://news.ycombinator.com/rss" hacker-news)))) + (setq vterm-buffer-name "vterm") + ;; (evil-set-initial-state 'vterm-mode 'emacs) + (setq vterm-tramp-shells (append '(("ssh" "/bin/bash")) vterm-tramp-shells)) -;; (jd/use-package langtool -;; :config -;; (setq langtool-language-tool-jar "/home/jakub/Documents/LanguageTool-6.0/languagetool-commandline.jar") -;; (setq langtool-default-language "pl-PL")) + ) -;; (jd/leader-key-def -;; "l" '(:ignore t :which-key "langtool") -;; "lc" 'langtool-check-buffer -;; "ld" 'langtool-check-done -;; "li" 'langtool-interactive-correction) +(use-package! all-the-icons-dired "emacs-all-the-icons-dired" + :hook (dired-mode . all-the-icons-dired-mode)) -(jd/use-package mastodon "emacs-mastodon" - :config - (setq mastodon-active-user "jdlugosz963" - mastodon-instance-url "https://fosstodon.org/")) - -(jd/use-package password-store "emacs-password-store" - :bind - ("C-c P p" . password-store-copy) - ("C-c P i" . password-store-insert) - ("C-c P g" . password-store-generate)) +(use-package! dired nil + :ensure nil + :commands (dired dired-jump) + :custom ((dired-listing-switches "-agho --group-directories-first")) + :config + (setq dired-kill-when-opening-new-dired-buffer t)) -(jd/use-package bluetooth "emacs-bluetooth" - :bind - ("C-c B" . bluetooth-list-devices)) +(use-package! pdf-tools "emacs-pdf-tools") -(jd/use-package shell nil - :bind - ("C-c C-" . shell)) +(use-package! password-store "emacs-password-store" + :bind + ("C-c P p" . password-store-copy) + ("C-c P i" . password-store-insert) + ("C-c P g" . password-store-generate)) -(jd/use-package nov-el "emacs-nov-el") +(use-package! shell nil + :bind + ("C-c C-" . shell)) (provide 'jd-apps) diff --git a/.emacs.d/jd/jd-custom.el b/.emacs.d/jd/jd-custom.el index 8383e41..a634baa 100755 --- a/.emacs.d/jd/jd-custom.el +++ b/.emacs.d/jd/jd-custom.el @@ -3,33 +3,6 @@ ;;; Code: -(defun jd/generete-qr-from-clipboard () - (interactive) - (let ((clipboard-value (x-get-clipboard)) - (clipboard-file-path "/tmp/clipboard_value.txt") - (clipboard-out-image "/tmp/qr.png")) - (with-temp-file clipboard-file-path - (insert clipboard-value)) - (shell-command (concat - "qrencode -o " - clipboard-out-image - " < " - clipboard-file-path)) - (find-file clipboard-out-image))) - -(defun jd/dired-open-file-in-kill-ring () - (interactive) - (let* ((last-killed (car kill-ring)) - (exists-p (file-exists-p last-killed)) - (dir-p (file-directory-p last-killed))) - (cond - ((not exists-p) (message "File doesn't exists!")) - (dir-p (dired last-killed)) - ((not dir-p) (find-file last-killed))))) - -(global-set-key (kbd "C-c O") #'jd/dired-open-file-in-kill-ring) - - (setq erc-nick "bobbma" erc-user-full-name "Jakub Dlugosz" erc-notify-list '("akuleszaa")) diff --git a/.emacs.d/jd/jd-dev.el b/.emacs.d/jd/jd-dev.el index 1e602d6..4cd3f0c 100755 --- a/.emacs.d/jd/jd-dev.el +++ b/.emacs.d/jd/jd-dev.el @@ -4,25 +4,24 @@ ;;; Code: (setq c-default-style "linux" - c-basic-offset 8) + c-basic-offset 8 + gdb-many-windows t) -(setq gdb-many-windows t) +(use-package! lsp-mode "emacs-lsp-mode" + :diminish t + :commands (lsp lsp-deferred) + :init + (setq lsp-headerline-breadcrumb-enable nil) + (setq lsp-diagnostics-provider :none) + (setq lsp-modeline-diagnostics-enable nil) + (setq lsp-keymap-prefix "C-c l") + :config + (lsp-enable-which-key-integration t)) -(jd/use-package lsp-mode "emacs-lsp-mode" - :diminish t - :commands (lsp lsp-deferred) - :init - (setq lsp-headerline-breadcrumb-enable nil) - (setq lsp-diagnostics-provider :none) - (setq lsp-modeline-diagnostics-enable nil) - (setq lsp-keymap-prefix "C-c l") - :config - (lsp-enable-which-key-integration t)) +(use-package! lsp-ivy "emacs-lsp-ivy" + :after lsp) -(jd/use-package lsp-ivy "emacs-lsp-ivy" - :after lsp) - -(jd/use-package paredit "emacs-paredit") +(use-package! paredit "emacs-paredit") (defun jd/lisp-mode-setup () (rainbow-delimiters-mode) @@ -35,124 +34,89 @@ (add-hook 'clojure-mode-hook 'jd/lisp-mode-setup) (add-hook 'lisp-mode-hook 'jd/lisp-mode-setup))) -(jd/use-package rainbow-delimiters "emacs-rainbow-delimiters") - -(jd/use-package sly "emacs-sly") - -(jd/use-package geiser "emacs-geiser") -(jd/use-package geiser-racket "emacs-geiser-racket") -(jd/use-package racket-mode "emacs-racket-mode") -(jd/use-package geiser-guile "emacs-geiser-guile" - :config - (when jd/guix-p - (defun jd/guix-repl () - (interactive) - (let ((geiser-guile-binary '("guix" "repl")) - (geiser-guile-load-path (cons "~/dotfiles/guix" geiser-guile-load-path))) - (geiser 'guile))))) - -(jd/use-package pyvenv "emacs-pyvenv" - :after python-mode) - -(jd/use-package typescript-mode "emacs-typescript-mode" - :mode ("\\.ts\\'") - :config - (setq typescript-indent-level 2)) - -(jd/use-package cider "emacs-cider") - -(jd/use-package tide "emacs-tide" - :after (typescript-mode company web-mode)) - -(jd/use-package flycheck "emacs-flycheck" - :hook ((after-init . global-flycheck-mode))) - -(jd/use-package web-mode "emacs-web-mode" - ;; :hook ((web-mode . jd/activate-tide-mode)) - :mode - ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'") - :config - (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'"))) - (setq web-mode-markup-indent-offset 2) - (setq web-mode-css-indent-offset 2) - (setq web-mode-code-indent-offset 2) - (setq web-mode-script-padding 2) - (setq web-mode-block-padding 2) - (setq web-mode-style-padding 2) - (setq web-mode-enable-auto-pairing t) - (setq web-mode-enable-auto-closing t) - (setq web-mode-enable-current-element-highlight t)) - -(jd/use-package yaml-mode "emacs-yaml-mode") - -(jd/use-package docker "emacs-docker" - :bind - ("C-c D d" . docker-containers) - ("C-c D D" . docker) - :config - (jd/leader-key-def - "d" '(:ignore t :which-key "Docker") - "dc" '(docker-containers :which-key "Docker containers") - "dd" '(docker :which-key "Docker"))) - -(jd/use-package company "emacs-company" - :diminish t - :after lsp-mode - :hook (lsp-mode . company-mode) - :bind (:map company-active-map - ("" . company-complete-selection)) - (:map lsp-mode-map - ("" . company-indent-or-complete-common)) - :custom - (company-minimum-prefix-length 1) - (company-idle-delay 0.0) - :config - (global-company-mode)) - -;; (jd/use-package company-box "emacs-company-box" -;; :diminish t -;; :hook (company-mode . company-box-mode)) - -(jd/use-package projectile "emacs-projectile" - :diminish projectile-mode - :init - (when (file-directory-p "~/Documents/code") - (setq projectile-project-search-path '("~/Documents/code/"))) - :custom ((projectile-Completion-system 'ivy)) - :config - (setq projectile-switch-project-action #'projectile-dired) - (projectile-mode) - - (jd/leader-key-def - "p" '(projectile-command-map :which-key "Project") - "p " '() - "SPC" '(projectile-find-file :which-key "Find file in project"))) - -(jd/use-package neotree "emacs-neotree" - :init - (setq neo-theme 'icons) - :config - (jd/leader-key-def - "op" '(jd/neotree-project-dir :which-key "Open neotree")) - - (defun jd/neotree-project-dir () - "Open NeoTree using the git root." - (interactive) - (let ((project-dir (projectile-project-root)) - (file-name (buffer-file-name))) - (neotree-toggle) - (if project-dir - (if (neo-global--window-exists-p) - (progn - (neotree-dir project-dir) - (neotree-find file-name))) - (message "Could not find git project root."))))) - -(jd/use-package magit "emacs-magit" - :custom - (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) - -(jd/use-package restclient "emacs-restclient") +(use-package! rainbow-delimiters "emacs-rainbow-delimiters") + +(use-package! sly "emacs-sly") + +(use-package! geiser "emacs-geiser") +(use-package! geiser-racket "emacs-geiser-racket") +(use-package! racket-mode "emacs-racket-mode") +(use-package! geiser-guile "emacs-geiser-guile" + :config + (when jd/guix-p + (defun jd/guix-repl () + (interactive) + (let ((geiser-guile-binary '("guix" "repl")) + (geiser-guile-load-path (cons "~/dotfiles/guix" geiser-guile-load-path))) + (geiser 'guile))))) + +(use-package! pyvenv "emacs-pyvenv" + :after python-mode) + +(use-package! typescript-mode "emacs-typescript-mode" + :mode ("\\.ts\\'") + :config + (setq typescript-indent-level 2)) + +(use-package! cider "emacs-cider") + +(use-package! tide "emacs-tide" + :after (typescript-mode company web-mode)) + +(use-package! flycheck "emacs-flycheck" + :hook ((after-init . global-flycheck-mode))) + +(use-package! web-mode "emacs-web-mode" + :mode + ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'") + :config + (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'"))) + (setq web-mode-markup-indent-offset 2) + (setq web-mode-css-indent-offset 2) + (setq web-mode-code-indent-offset 2) + (setq web-mode-script-padding 2) + (setq web-mode-block-padding 2) + (setq web-mode-style-padding 2) + (setq web-mode-enable-auto-pairing t) + (setq web-mode-enable-auto-closing t) + (setq web-mode-enable-current-element-highlight t)) + +(use-package! yaml-mode "emacs-yaml-mode") + +(use-package! docker "emacs-docker" + :bind + ("C-c D d" . docker-containers) + ("C-c D D" . docker)) + +(use-package! company "emacs-company" + :diminish t + :after lsp-mode + :hook (lsp-mode . company-mode) + :bind (:map company-active-map + ("" . company-complete-selection)) + (:map lsp-mode-map + ("" . company-indent-or-complete-common)) + :custom + (company-minimum-prefix-length 1) + (company-idle-delay 0.0) + :config + (global-company-mode)) + +(use-package! projectile "emacs-projectile" + :diminish projectile-mode + :init + (when (file-directory-p "~/Documents/code") + (setq projectile-project-search-path '("~/Documents/code/"))) + :custom ((projectile-Completion-system 'ivy)) + :config + (setq projectile-switch-project-action #'projectile-dired) + (projectile-mode)) + +(use-package! magit "emacs-magit" + :custom + (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) + +(use-package! restclient "emacs-restclient") (setq sql-connection-alist '(("net47-abaks" diff --git a/.emacs.d/jd/jd-exwm.el b/.emacs.d/jd/jd-exwm.el index f083c44..98b5e89 100755 --- a/.emacs.d/jd/jd-exwm.el +++ b/.emacs.d/jd/jd-exwm.el @@ -4,132 +4,132 @@ ;;; Code: -(jd/use-package perspective "emacs-perspective") - -(jd/use-package exwm "emacs-exwm" - :config - (defun jd/exwm-update-class () - (exwm-workspace-rename-buffer exwm-class-name)) - - (defun jd-exwm/run-in-background (command) - (let ((command-parts (split-string command "[ ]+"))) - (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) - - (defun jd-exwm/restart-process (program-name) - (call-process "killall" nil nil nil program-name) - (jd-exwm/run-in-background program-name)) - - (defun jd-exwm/exwm-init-hook () - (jd-exwm/run-in-background "nitrogen --restore") - (start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1") - (start-process-shell-command "syndaemon" nil "syndaemon -i 0.8 -K -R -d") - - (jd-exwm/restart-process "polybar") - (jd-exwm/restart-process "nm-applet") - (jd-exwm/restart-process "redshift-gtk -l 54.37:18.6") - (jd-exwm/restart-process "blueman-applet")) - - (defun jd-exwm/exwm-update-title () - (exwm-workspace-rename-buffer exwm-title)) - - (defun jd-exwm/configure-window-by-class () - (interactive) - (pcase exwm-class-name - ("firefox" (exwm-workspace-move-window 2)) - ("Brave" (exwm-workspace-move-window 2)) - ("qutebrowser" (exwm-workspace-move-window 2)) - ("discord" (exwm-workspace-move-window 5)) - ("obs" (exwm-workspace-move-window 5)) - ("Virt-manager" (exwm-workspace-move-window 4)))) - - (setq exwm-workspace-number 10) - - ;; (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook) - (add-hook 'exwm-update-class-hook #'jd/exwm-update-class) - (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title) - (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class) - - (require 'exwm-randr) - (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1")) - (exwm-randr-enable) - - (setq exwm-input-simulation-keys - '(([?\C-b] . [left]) - ([?\C-f] . [right]) - ([?\C-p] . [up]) - ([?\C-n] . [down]) - ([?\C-a] . [home]) - ([?\C-e] . [end]) - ([?\C-k] . [S-end delete]) - ([?\M-w] . [C-c]) - ([?\C-y] . [C-v]) - ([?\C-v] . [next]) - ([?\M-v] . [prior]) - )) - - (setq exwm-input-prefix-keys - '(?\C-x - ?\C-u - ?\C-h - ?\M-x - ?\M-` - ?\M-& - ?\M-! - ?\C-g - ?\M-: - ?\C-\M-j - ?\C-\ )) - - (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) - (exwm-input-set-key (kbd "s-p") 'counsel-linux-app) - - (setq exwm-input-global-keys - `(([?\s-R] . exwm-reset) - - - ([?\s-r] . (lambda (command) - (interactive (list (read-shell-command "$ "))) - (start-process-shell-command command nil command))) - - ([?\s-W] . exwm-workspace-move-window) - ([?\s-w] . exwm-workspace-switch) - - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 9)))) - - (exwm-enable) - (require 'exwm-systemtray) - (exwm-systemtray-enable)) - -(jd/use-package desktop-environment "emacs-desktop-environment" - :after exwm - :custom - (desktop-environment-brightness-small-increment "2%+") - (desktop-environment-brightness-small-decrement "2%-") - (desktop-environment-brightness-normal-increment "5%+") - (desktop-environment-brightness-normal-decrement "5%-") - - :config - (defun jd/dunst-show-history () - (interactive) - (start-process-shell-command "dunstctl" nil "dunstctl history-pop")) - (global-set-key (kbd "C-c N h") #'jd/dunst-show-history) - - (defun jd/dunst-close () - (interactive) - (start-process-shell-command "dunstctl" nil "dunstctl close")) - (global-set-key (kbd "C-c N c") #'jd/dunst-close) - - (defun jd/dunst-close-all () - (interactive) - (start-process-shell-command "dunstctl" nil "dunstctl close-all")) - (global-set-key (kbd "C-c N a") #'jd/dunst-close-all) - - (desktop-environment-mode)) +(use-package! perspective "emacs-perspective") + +(use-package! exwm "emacs-exwm" + :config + (defun jd/exwm-update-class () + (exwm-workspace-rename-buffer exwm-class-name)) + + (defun jd-exwm/run-in-background (command) + (let ((command-parts (split-string command "[ ]+"))) + (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) + + (defun jd-exwm/restart-process (program-name) + (call-process "killall" nil nil nil program-name) + (jd-exwm/run-in-background program-name)) + + (defun jd-exwm/exwm-init-hook () + (jd-exwm/run-in-background "nitrogen --restore") + (start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1") + (start-process-shell-command "syndaemon" nil "syndaemon -i 0.8 -K -R -d") + + (jd-exwm/restart-process "polybar") + (jd-exwm/restart-process "nm-applet") + (jd-exwm/restart-process "redshift-gtk -l 54.37:18.6") + (jd-exwm/restart-process "blueman-applet")) + + (defun jd-exwm/exwm-update-title () + (exwm-workspace-rename-buffer exwm-title)) + + (defun jd-exwm/configure-window-by-class () + (interactive) + (pcase exwm-class-name + ("firefox" (exwm-workspace-move-window 2)) + ("Brave" (exwm-workspace-move-window 2)) + ("qutebrowser" (exwm-workspace-move-window 2)) + ("discord" (exwm-workspace-move-window 5)) + ("obs" (exwm-workspace-move-window 5)) + ("Virt-manager" (exwm-workspace-move-window 4)))) + + (setq exwm-workspace-number 10) + + ;; (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook) + (add-hook 'exwm-update-class-hook #'jd/exwm-update-class) + (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title) + (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class) + + (require 'exwm-randr) + (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1")) + (exwm-randr-enable) + + (setq exwm-input-simulation-keys + '(([?\C-b] . [left]) + ([?\C-f] . [right]) + ([?\C-p] . [up]) + ([?\C-n] . [down]) + ([?\C-a] . [home]) + ([?\C-e] . [end]) + ([?\C-k] . [S-end delete]) + ([?\M-w] . [C-c]) + ([?\C-y] . [C-v]) + ([?\C-v] . [next]) + ([?\M-v] . [prior]) + )) + + (setq exwm-input-prefix-keys + '(?\C-x + ?\C-u + ?\C-h + ?\M-x + ?\M-` + ?\M-& + ?\M-! + ?\C-g + ?\M-: + ?\C-\M-j + ?\C-\ )) + + (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) + (exwm-input-set-key (kbd "s-p") 'counsel-linux-app) + + (setq exwm-input-global-keys + `(([?\s-R] . exwm-reset) + + + ([?\s-r] . (lambda (command) + (interactive (list (read-shell-command "$ "))) + (start-process-shell-command command nil command))) + + ([?\s-W] . exwm-workspace-move-window) + ([?\s-w] . exwm-workspace-switch) + + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 9)))) + + (exwm-enable) + (require 'exwm-systemtray) + (exwm-systemtray-enable)) + +(use-package! desktop-environment "emacs-desktop-environment" + :after exwm + :custom + (desktop-environment-brightness-small-increment "2%+") + (desktop-environment-brightness-small-decrement "2%-") + (desktop-environment-brightness-normal-increment "5%+") + (desktop-environment-brightness-normal-decrement "5%-") + + :config + (defun jd/dunst-show-history () + (interactive) + (start-process-shell-command "dunstctl" nil "dunstctl history-pop")) + (global-set-key (kbd "C-c N h") #'jd/dunst-show-history) + + (defun jd/dunst-close () + (interactive) + (start-process-shell-command "dunstctl" nil "dunstctl close")) + (global-set-key (kbd "C-c N c") #'jd/dunst-close) + + (defun jd/dunst-close-all () + (interactive) + (start-process-shell-command "dunstctl" nil "dunstctl close-all")) + (global-set-key (kbd "C-c N a") #'jd/dunst-close-all) + + (desktop-environment-mode)) ;; (set-frame-parameter (selected-frame) 'alpha '(90 . 90)) ;; (add-to-list 'default-frame-alist `(alpha . (90 . 90))) diff --git a/.emacs.d/jd/jd-gym.el b/.emacs.d/jd/jd-gym.el index 2602e3e..581bf65 100755 --- a/.emacs.d/jd/jd-gym.el +++ b/.emacs.d/jd/jd-gym.el @@ -71,7 +71,7 @@ (let ((table-name (car table)) (table-data (cdr table))) (emacsql jd-gym/db--conn [:insert :into $i1 - :values $v2] + :values $v2] table-name table-data))) jd-gym/db--test-data)) diff --git a/.emacs.d/jd/jd-keys.el b/.emacs.d/jd/jd-keys.el index 26a6445..108c70c 100755 --- a/.emacs.d/jd/jd-keys.el +++ b/.emacs.d/jd/jd-keys.el @@ -1,124 +1,46 @@ ;;; Dotfiles --- Jakub Dlugosz emacs config ;;; Commentary: - +;; Custom keysets used in my emacs ;;; Code: -;; (jd/use-package evil "emacs-evil" -;; :init -;; (setq evil-want-integration t) -;; (setq evil-want-keybinding nil) -;; (setq evil-want-C-u-scroll t) -;; (setq evil-want-Y-yank-to-eol t) -;; (setq evil-want-C-i-jump nil) -;; (setq evil-undo-system 'undo-tree) -;; (setq evil-kill-on-visual-paste nil) -;; :config -;; (evil-set-initial-state 'exwm-mode 'emacs) -;; (evil-mode 1)) - -(jd/use-package multiple-cursors "emacs-multiple-cursors" - :config - (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) - (global-set-key (kbd "C->") 'mc/mark-next-like-this) - (global-set-key (kbd "C-<") 'mc/mark-previous-like-this) - (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)) - -(jd/use-package shackle "emacs-shackle") -(jd/use-package sway "emacs-sway") - -(jd/use-package general "emacs-general" - :config - (general-create-definer jd/leader-key-def - :keymaps '(normal insert visual emacs) - :prefix "SPC" - :global-prefix "C-z") - - (general-create-definer jd/ctrl-c-keys - :prefix "C-c") - - ;; (jd/leader-key-def - ;; "w" 'evil-window-map - ;; "wr" '(hydra-resize-window/body :which-key "Rezize window") - ;; "wd" '(evil-window-delete :which-key "Window delete")) - - (jd/leader-key-def - "ou" '(undo-tree-visualize :which-key "Open")) - - ;; remove . key - ;; (define-key evil-normal-state-map (kbd ".") '()) - (jd/leader-key-def - "f" '(:ignore t :which-key "Files") - "fs" '(save-buffer :which-key "File save") - "." '(find-file :which-key "Find file") - "ff" '(find-file :which-key "Find file")) - - (jd/leader-key-def - "e" '(:ignore t :which-key "Eval") - "eb" '(eval-buffer :which-key "Eval buffer") - "ee" '(eval-defun :which-key "Eval defun")) - - (jd/leader-key-def - :keymaps '(visual) - "er" '(eval-region :which-key "Eval region")) - - (defun jd/kill-other-buffers () - (interactive) - (mapc 'kill-buffer (cdr (buffer-list (current-buffer))))) - - (jd/leader-key-def - "bK" '(jd/kill-other-buffers :which-key "Kill other buffers") - "bk" '(kill-current-buffer :which-key "Kill buffer") - "bB" '(ibuffer :which-key "Open ibuffer"))) - - -(jd/use-package hydra "emacs-hydra" - ;; :defer t - :config - (defun jd/text-scale-increase () - (interactive) - (let ((old-face-attribute (face-attribute 'default :height))) - (set-face-attribute 'default nil :height (+ old-face-attribute 10)))) - - (defun jd/text-scale-decrease () - (interactive) - (let ((old-face-attribute (face-attribute 'default :height))) - (set-face-attribute 'default nil :height (- old-face-attribute 10)))) - - ;; (defhydra hydra-resize-window (:timeout 4) - ;; ("h" evil-window-decrease-width "<") - ;; ("l" evil-window-increase-width ">") - ;; ("k" evil-window-decrease-height "^") - ;; ("j" evil-window-increase-height "v") - ;; ("q" nil "finished" :exit t)) - - (defhydra hydra-text-scale-global (:timeout 4) - "scale text" - ("j" jd/text-scale-increase "in") - ("k" jd/text-scale-decrease "out") - ("q" nil "finished" :exit t)) - - (defhydra hydra-text-scale (:timeout 4) - "scale text" - ("j" text-scale-increase "in") - ("k" text-scale-decrease "out") - ("q" nil "finished" :exit t)) - - (jd/leader-key-def - "tS" '(hydra-text-scale-global/body :which-key "Scale text") - "ts" '(hydra-text-scale/body :which-key "Scale text"))) - - -(jd/use-package undo-tree "emacs-undo-tree" - :diminish - :config - (setq undo-tree-auto-save-history nil) - (global-undo-tree-mode 1)) - -;; (jd/use-package evil-collection "emacs-evil-collection" -;; :after evil -;; :config -;; (evil-collection-init)) - +(use-package! multiple-cursors "emacs-multiple-cursors" + :config + (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) + (global-set-key (kbd "C->") 'mc/mark-next-like-this) + (global-set-key (kbd "C-<") 'mc/mark-previous-like-this) + (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)) + + +(use-package! hydra "emacs-hydra" + ;; :defer t + :config + (defun jd/text-scale-increase () + (interactive) + (let ((old-face-attribute (face-attribute 'default :height))) + (set-face-attribute 'default nil :height (+ old-face-attribute 10)))) + + (defun jd/text-scale-decrease () + (interactive) + (let ((old-face-attribute (face-attribute 'default :height))) + (set-face-attribute 'default nil :height (- old-face-attribute 10)))) + + (defhydra hydra-text-scale-global (:timeout 4) + "scale text" + ("j" jd/text-scale-increase "in") + ("k" jd/text-scale-decrease "out") + ("q" nil "finished" :exit t)) ;; TODO not working + + (defhydra hydra-text-scale (:timeout 4) + "scale text" + ("j" text-scale-increase "in") + ("k" text-scale-decrease "out") + ("q" nil "finished" :exit t))) + +(use-package! undo-tree "emacs-undo-tree" + :diminish + :config + (setq undo-tree-auto-save-history nil) + (global-undo-tree-mode 1)) (provide 'jd-keys) diff --git a/.emacs.d/jd/jd-mu4e.el b/.emacs.d/jd/jd-mu4e.el index cb81c5c..aa0355c 100755 --- a/.emacs.d/jd/jd-mu4e.el +++ b/.emacs.d/jd/jd-mu4e.el @@ -1,86 +1,83 @@ -(when (not jd/guix-p) - (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")) +;;; Dotfiles --- Jakub Dlugosz emacs config +;;; Commentary: -(jd/use-package htmlize "emacs-htmlize") +;;; Code: + +(use-package! htmlize "emacs-htmlize") (jd/add-package-to-manifest "isync") -(jd/use-package mu4e "mu" - :defer 10 - :ensure nil - :bind - ("C-c M" . mu4e) - :config +(use-package! mu4e "mu" + :defer 10 + :ensure nil + :bind + ("C-c M" . mu4e) + :config ;a (require 'org-mu4e) - (if jd/guix-p - (setq mu4e-mu-binary "/home/jakub/.guix-extra-profiles/emacs/emacs/bin/mu") - (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") + (unless jd/guix-p + (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e") + (setq mu4e-mu-binary "/usr/local/bin/mu")) - (setq mu4e-completing-read-function #'ivy-completing-read) + (setq mu4e-update-interval (* 10 60)) + (setq mu4e-get-mail-command "mbsync -a") + (setq mu4e-maildir "~/Mail") - (setq mu4e-change-filenames-when-moving t) + (setq mu4e-completing-read-function #'ivy-completing-read) - (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") - (mu4e-sent-messages-behavior . sent) - (smtpmail-local-domain . "pl") - (smtpmail-smtp-server . "smtp.abaks.pl") - (smtpmail-smtp-user . "jakub@abaks.pl"))) - ,(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") - (smtpmail-smtp-user . "jdlugosz963@gmail.com") - (mu4e-sent-messages-behavior . sent))))) + (setq mu4e-change-filenames-when-moving t) - (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 - smtpmail-servers-requiring-authorization ".*") + (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") + (mu4e-sent-messages-behavior . sent) + (smtpmail-local-domain . "pl") + (smtpmail-smtp-server . "smtp.abaks.pl") + (smtpmail-smtp-user . "jakub@abaks.pl"))) + ,(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") + (smtpmail-smtp-user . "jdlugosz963@gmail.com") + (mu4e-sent-messages-behavior . sent))))) - (setq mu4e-compose-signature (concat - "Pozdrawiam,\n" - "Jakub Długosz")) + (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 + smtpmail-servers-requiring-authorization ".*") - (mu4e t) - (mu4e-modeline-mode nil)) + (setq mu4e-compose-signature (concat + "Pozdrawiam,\n" + "Jakub Długosz")) -(jd/use-package mu4e-alert "emacs-mu4e-alert" - :defer 20 - :config - (mu4e-alert-set-default-style 'libnotify) - (mu4e-alert-enable-mode-line-display) - (mu4e-alert-enable-notifications) + (mu4e t) + (mu4e-modeline-mode nil)) - (jd/leader-key-def - "m" '(:ignore t :which-key "mail") - "mm" 'mu4e - "mc" 'mu4e-compose-new)) +(use-package! mu4e-alert "emacs-mu4e-alert" + :defer 20 + :config + (mu4e-alert-set-default-style 'libnotify) + (mu4e-alert-enable-mode-line-display) + (mu4e-alert-enable-notifications)) (provide 'jd-mu4e) diff --git a/.emacs.d/jd/jd-org.el b/.emacs.d/jd/jd-org.el index a9565f3..ff15b59 100755 --- a/.emacs.d/jd/jd-org.el +++ b/.emacs.d/jd/jd-org.el @@ -13,199 +13,188 @@ (visual-line-mode 1)) (defun jd-emacs/org-insert-date (&optional date) - (let ((d (or date "+0d"))) - (org-insert-time-stamp (org-read-date nil t d)))) - -(jd/use-package org-pomodoro "emacs-org-pomodoro") - -(jd/use-package org "emacs-org" - :pin org - :commands (org-capture org-agenda) - :hook (org-mode . jd/org-mode-init) - :bind - ("C-c o c" . #'org-capture) - ("C-c o p" . #'org-mobile-pull) - ("C-c o P" . #'org-mobile-push) - ("C-c o a" . #'org-agenda) - :config - (setq org-directory (file-truename "~/Documents/Org/")) - (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org")) - (setq org-mobile-directory "~/Documents/Org/Mobile/") - (setq org-agenda-files '("Tasks.org" "Inbox.org" "Habits.org")) - (setq org-ellipsis " ▾") - (setq org-agenda-start-with-log-mode t) - (setq org-log-done 'time) - (setq org-log-into-drawer t) - (setq org-return-follows-link t) - (setq org-capture-templates - `(("t" "Tasks / Projects") - ("tt" "Task" entry (file+olp "Tasks.org" "Inbox") - "* TODO %?\n %t\n %a\n %i" :empty-lines 1) - ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox") - "* TODO %?\n %t\n SCHEDULED: %(jd-emacs/org-insert-date \"+1d\")>\n %a\n %i" :empty-lines 1) - - ("m" "Metrics Capture") - ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics") - "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t) - ("sh" "School Homework" entry (file+olp "school/todo(jd-emacs/org-insert-date \"1\").org")))) - - (setq org-latex-listings 'minted - org-latex-packages-alist '(("" "minted")) - org-latex-pdf-process - '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" - "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) - (require 'org-tempo) - - - (jd/leader-key-def - "o" '(:ignore t :which-key "Open/Org") - "oc" '(org-capture :which-key "Open org-capture") - "oop" '(org-mobile-pull :which-key "Org mobile pull") - "ooP" '(org-mobile-push :which-key "Org mobile push") - "oa" '(org-agenda :which-key "Open org-agenda")) - - - (defun jd/org-font-setup () - ;; Replace list hyphen with dot - (font-lock-add-keywords 'org-mode - '(("^ *\\([-]\\) " - (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-")))))) - - ;; Set faces for heading levels - (dolist (face '((org-level-1 . 1.3) - (org-level-2 . 1.2) - (org-level-3 . 1.1) - (org-level-4 . 1.0) - (org-level-5 . 1.0) - (org-level-6 . 1.0) - (org-level-7 . 1.0) - (org-level-8 . 1.0))) - (set-face-attribute (car face) nil :font "Terminus" :weight 'Bold :height (cdr face))) - - ;; Ensure that anything that should be fixed-pitch in Org files appears that way - (set-face-attribute 'org-block nil :font "Terminus" :inherit 'fixed-pitch :height 100) - (set-face-attribute 'org-table nil :inherit 'fixed-pitch) - (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) - (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) - (set-face-attribute 'org-table nil :font "Terminus" :inherit '(shadow fixed-pitch)) - (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) - (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) - (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) - (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) - (set-face-attribute 'line-number nil :inherit 'fixed-pitch) - (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) - - (with-eval-after-load 'org (jd/org-font-setup)) - - (defun jd-emacs/org-timer-stop () - (start-process-shell-command "notify-send" nil "notify-send Zakonczono odliczanie")) - - - (add-hook 'org-timer-stop-hook #'jd-emacs/org-timer-stop) - - (defun jd/org-tempo-setup () - (add-to-list 'org-structure-template-alist '("s" . "src")) - (add-to-list 'org-structure-template-alist '("sql" . "src sql")) - (add-to-list 'org-structure-template-alist '("sh" . "src sh")) - (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) - (add-to-list 'org-structure-template-alist '("li" . "src lisp")) - (add-to-list 'org-structure-template-alist '("sc" . "src scheme")) - (add-to-list 'org-structure-template-alist '("ts" . "src typescript")) - (add-to-list 'org-structure-template-alist '("py" . "src python")) - (add-to-list 'org-structure-template-alist '("go" . "src go")) - (add-to-list 'org-structure-template-alist '("yaml" . "src yaml"))) - - (with-eval-after-load 'org-tempo (jd/org-tempo-setup)) - - (org-babel-do-load-languages - 'org-babel-load-languages - '((emacs-lisp . t) - (python . t))) - - (defun jd/org-babel-tangle-config () - (when (string-equal (file-name-directory (buffer-file-name)) - (expand-file-name "~/dotfiles/")) - ;; Dynamic scoping to the rescue - (let ((org-confirm-babel-evaluate nil)) - (org-babel-tangle)))) - - (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config))) - ) - -(jd/use-package org-superstar "emacs-org-superstar" - :hook (org-mode . org-superstar-mode) - :init - (setq org-superstar-special-todo-items t) - (setq org-superstar-remove-leading-stars t) - (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) - -(jd/use-package org-roam "emacs-org-roam" - :custom - (org-roam-directory (file-truename jd/org-roam-home)) - :bind (("C-c n l" . org-roam-buffer-toggle) - ("C-c n f" . org-roam-node-find) - ("C-c n g" . org-roam-graph) - ("C-c n i" . org-roam-node-insert) - ("C-c n c" . org-roam-capture) - ;; Dailies - ("C-c n j" . org-roam-dailies-capture-today)) - :bind-keymap - ("C-c n d" . org-roam-dailies-map) - :config - (defun jd/org-roam-filter-by-tag (tag-name) - (lambda (node) - (member tag-name (org-roam-node-tags node)))) - - (defun jd/org-roam-list-notes-by-tag (tag-name) - (mapcar #'org-roam-node-file - (seq-filter - (jd/org-roam-filter-by-tag tag-name) - (org-roam-node-list)))) - - (defun jd/org-roam-refreshagenda-list () - (interactive) - (setq org-agenda-files (org-roam-list-files))) - - (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) - (setq org-roam-capture-templates - '(("a" "workstuff" plain (file (concat org-roam-directory "/work")) - :target (file+head "work/%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n") - :unnarrowed t) - ("b" "research" plain (file "~/Documents/roam/study/templates/research.org") - :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n") - :unnarrowed t) - ("s" "School") - ("ss" "School General" plain nil - :target (file+head - "school/%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n") - :unnarrowed t) - ("sp" "Polish Lesson" plain nil - :target (file+head - "school/polish/%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n") - :unnarrowed t) - ("sw" "Wos Lesson" plain nil - :target (file+head - "school/wos/%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n") - :unnarrowed t) - ("g" "Guitar" plain nil - :target (file+head - "guitar/%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n") - :unnarrowed t) - ("d" "default" plain nil - :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" - "#+title: ${title}\n") - :unnarrowed t) - )) - - (org-roam-db-autosync-mode)) - -(jd/use-package ox-pandoc "emacs-ox-pandoc") + (org-insert-time-stamp (org-read-date nil t (or date "+0d")))) + +(use-package! org-pomodoro "emacs-org-pomodoro") + +(use-package! org "emacs-org" + :pin org + :commands (org-capture org-agenda) + :hook (org-mode . jd/org-mode-init) + :bind + ("C-c o c" . #'org-capture) + ("C-c o p" . #'org-mobile-pull) + ("C-c o P" . #'org-mobile-push) + ("C-c o a" . #'org-agenda) + :config + (setq org-directory (file-truename "~/Documents/Org/")) + (setq org-mobile-inbox-for-pull (concat org-directory "flagged.org")) + (setq org-mobile-directory "~/Documents/Org/Mobile/") + (setq org-agenda-files '("Tasks.org" "Inbox.org" "Habits.org")) + (setq org-ellipsis " ▾") + (setq org-agenda-start-with-log-mode t) + (setq org-log-done 'time) + (setq org-log-into-drawer t) + (setq org-return-follows-link t) + (setq org-capture-templates + `(("t" "Tasks / Projects") + ("tt" "Task" entry (file+olp "Tasks.org" "Inbox") + "* TODO %?\n %t\n %a\n %i" :empty-lines 1) + ("tT" "Task for tomorow" entry (file+olp "Tasks.org" "Inbox") + "* TODO %?\n %t\n SCHEDULED: %(jd-emacs/org-insert-date \"+1d\")>\n %a\n %i" :empty-lines 1) + + ("m" "Metrics Capture") + ("mm" "Metrics" table-line (file+headline "Metrics.org" "Metrics") + "| %U | %^{Weight} | %^{Waist} | %^{Notes} |" :kill-buffer t) + ("sh" "School Homework" entry (file+olp "school/todo(jd-emacs/org-insert-date \"1\").org")))) + + (setq org-latex-listings 'minted + org-latex-packages-alist '(("" "minted")) + org-latex-pdf-process + '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" + "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) + (require 'org-tempo) + + (defun jd/org-font-setup () + ;; Replace list hyphen with dot + (font-lock-add-keywords 'org-mode + '(("^ *\\([-]\\) " + (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•-")))))) + + ;; Set faces for heading levels + (dolist (face '((org-level-1 . 1.3) + (org-level-2 . 1.2) + (org-level-3 . 1.1) + (org-level-4 . 1.0) + (org-level-5 . 1.0) + (org-level-6 . 1.0) + (org-level-7 . 1.0) + (org-level-8 . 1.0))) + (set-face-attribute (car face) nil :font "Terminus" :weight 'Bold :height (cdr face))) + + ;; Ensure that anything that should be fixed-pitch in Org files appears that way + (set-face-attribute 'org-block nil :font "Terminus" :inherit 'fixed-pitch :height 100) + (set-face-attribute 'org-table nil :inherit 'fixed-pitch) + (set-face-attribute 'org-formula nil :inherit 'fixed-pitch) + (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch)) + (set-face-attribute 'org-table nil :font "Terminus" :inherit '(shadow fixed-pitch)) + (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch)) + (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch)) + (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch)) + (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch) + (set-face-attribute 'line-number nil :inherit 'fixed-pitch) + (set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch)) + + (with-eval-after-load 'org (jd/org-font-setup)) + + (defun jd-emacs/org-timer-stop () + (start-process-shell-command "notify-send" nil "notify-send Zakonczono odliczanie")) + + + (add-hook 'org-timer-stop-hook #'jd-emacs/org-timer-stop) + + (defun jd/org-tempo-setup () + (dolist (template '(("s" . "src") + ("sql" . "src sql") + ("sh" . "src sh") + ("el" . "src emacs-lisp") + ("li" . "src lisp") + ("sc" . "src scheme") + ("ts" . "src typescript") + ("py" . "src python") + ("go" . "src go") + ("yaml" . "src yaml"))) + (add-to-list 'org-structure-template-alist template))) + + (with-eval-after-load 'org-tempo (jd/org-tempo-setup)) + + (org-babel-do-load-languages + 'org-babel-load-languages + '((emacs-lisp . t) + (python . t))) + + (defun jd/org-babel-tangle-config () + (when (string-equal (file-name-directory (buffer-file-name)) + (expand-file-name "~/dotfiles/")) + ;; Dynamic scoping to the rescue + (let ((org-confirm-babel-evaluate nil)) + (org-babel-tangle)))) + + (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config)))) + +(use-package! org-superstar "emacs-org-superstar" + :hook (org-mode . org-superstar-mode) + :init + (setq org-superstar-special-todo-items t) + (setq org-superstar-remove-leading-stars t) + (setq org-superstar-headline-bullets-list '("◉" "○" "●" "○" "●" "○" "●"))) + +(use-package! org-roam "emacs-org-roam" + :custom + (org-roam-directory (file-truename jd/org-roam-home)) + :bind (("C-c n l" . org-roam-buffer-toggle) + ("C-c n f" . org-roam-node-find) + ("C-c n g" . org-roam-graph) + ("C-c n i" . org-roam-node-insert) + ("C-c n c" . org-roam-capture) + ;; Dailies + ("C-c n j" . org-roam-dailies-capture-today)) + :bind-keymap + ("C-c n d" . org-roam-dailies-map) + :config + (defun jd/org-roam-filter-by-tag (tag-name) + (lambda (node) + (member tag-name (org-roam-node-tags node)))) + + (defun jd/org-roam-list-notes-by-tag (tag-name) + (mapcar #'org-roam-node-file + (seq-filter + (jd/org-roam-filter-by-tag tag-name) + (org-roam-node-list)))) + + (defun jd/org-roam-refreshagenda-list () + (interactive) + (setq org-agenda-files (org-roam-list-files))) + + (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) + (setq org-roam-capture-templates + '(("a" "workstuff" plain (file (concat org-roam-directory "/work")) + :target (file+head "work/%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t) + ("b" "research" plain (file "~/Documents/roam/study/templates/research.org") + :target (file+head "study/%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t) + ("s" "School") + ("ss" "School General" plain nil + :target (file+head + "school/%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t) + ("sp" "Polish Lesson" plain nil + :target (file+head + "school/polish/%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t) + ("sw" "Wos Lesson" plain nil + :target (file+head + "school/wos/%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t) + ("g" "Guitar" plain nil + :target (file+head + "guitar/%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t) + ("d" "default" plain nil + :target (file+head "%<%Y%m%d%H%M%S>-${slug}.org" + "#+title: ${title}\n") + :unnarrowed t))) + + (org-roam-db-autosync-mode)) + +(use-package! ox-pandoc "emacs-ox-pandoc") (provide 'jd-org) diff --git a/.emacs.d/jd/jd-ui.el b/.emacs.d/jd/jd-ui.el index f3a39bc..ccaf369 100755 --- a/.emacs.d/jd/jd-ui.el +++ b/.emacs.d/jd/jd-ui.el @@ -29,31 +29,25 @@ (require 'diminish) -(jd/use-package doom-modeline "emacs-doom-modeline" - :config - (doom-modeline-mode)) +(use-package! doom-modeline "emacs-doom-modeline" + :config + (doom-modeline-mode)) -(jd/use-package solarized-theme "emacs-solarized-theme" - :config - (load-theme 'solarized-dark-high-contrast t)) +(use-package! solarized-theme "emacs-solarized-theme" + :config + (load-theme 'solarized-dark-high-contrast t)) -(jd/use-package diminish "emacs-diminish") +(use-package! diminish "emacs-diminish") -(jd/use-package hl-todo "emacs-hl-todo" - :init - (setq hl-todo-keyword-faces - '(("TODO" . "#FF0000") - ("FIXME" . "#FF0000") - ("DEBUG" . "#A020F0"))) - :config - (global-hl-todo-mode 1)) - -(defun jd/switch-buffer () - (interactive) - (let ((completion-regexp-list '("\\`[^*]" - "\\`\\([^T]\\|T\\($\\|[^A]\\|A\\($\\|[^G]\\|G\\($\\|[^S]\\|S.\\)\\)\\)\\).*"))) - (call-interactively 'counsel-switch-buffer))) +(use-package! hl-todo "emacs-hl-todo" + :init + (setq hl-todo-keyword-faces + '(("TODO" . "#FF0000") + ("FIXME" . "#FF0000") + ("DEBUG" . "#A020F0"))) + :config + (global-hl-todo-mode 1)) (defvar jd/load-theme-hook nil) (defun jd/load-theme () @@ -61,41 +55,29 @@ (counsel-load-theme) (run-hooks 'jd/load-theme-hook)) -(jd/use-package ivy "emacs-ivy" - :diminish - :bind - (("C-s" . swiper)) - :config - (ivy-mode 1)) - -(jd/use-package counsel "emacs-counsel" - :diminish t - :config - (counsel-mode 1) +(use-package! ivy "emacs-ivy" + :diminish + :bind + (("C-s" . swiper)) + :config + (ivy-mode 1)) - (jd/leader-key-def - "t" '(:ignore t :which-key "Toggle") - "tT" '(toggle-truncate-lines :which-key "Toggle truncate lines") - "tt" '(jd/load-theme :which-key "Choose theme")) +(use-package! counsel "emacs-counsel" + :diminish t + :config + (counsel-mode 1)) - (jd/leader-key-def - "bb" '(jd/switch-buffer :which-key "Buffer switch") - "ba" '(counsel-switch-buffer :which-key "Buffer switch") - "b" '(:ignore t :which-key "Buffer") - "," '(counsel-switch-buffer :which-key "Buffer switch"))) +(use-package! which-key "emacs-which-key" + :diminish + :config + (which-key-mode) + (setq which-key-idle-delay 0.3)) -(jd/use-package which-key "emacs-which-key" - :diminish - :config - (which-key-mode) - (setq which-key-idle-delay 0.3)) +(use-package! all-the-icons "emacs-all-the-icons") -(jd/use-package all-the-icons "emacs-all-the-icons") - - -(jd/use-package beacon "emacs-beacon" - :config - (beacon-mode 1)) +(use-package! beacon "emacs-beacon" + :config + (beacon-mode 1)) (setq display-time-string-forms '(" " 24-hours ":" minutes " ")) @@ -103,7 +85,7 @@ (when jd/exwm-p (display-battery-mode) (display-time-mode)) - + (provide 'jd-ui) ;;; jd-ui.el ends here -- cgit v1.2.3