From 5ee161953a899d4026a698d2ee027e32a28e190f Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Wed, 8 May 2024 19:45:01 +0200 Subject: Delete use-package! and add :guix-package keyword instead. --- .emacs.d/init.el | 60 +++++++++++++++++++++--------------- .emacs.d/jd/jd-apps.el | 23 +++++++++----- .emacs.d/jd/jd-dev.el | 67 ++++++++++++++++++++++++++++------------- .emacs.d/jd/jd-exwm.el | 9 ++++-- .emacs.d/jd/jd-keys.el | 9 ++++-- .emacs.d/jd/jd-mu4e.el | 11 ++++--- .emacs.d/jd/jd-org.el | 26 +++++++++++++--- .emacs.d/jd/jd-ui.el | 27 +++++++++++------ guix/jd/home/services/emacs.scm | 1 + 9 files changed, 154 insertions(+), 79 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d9183a1..090592f 100755 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -86,31 +86,41 @@ (setq use-package-always-ensure (not jd/guix-p)) -(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)) - (use-package ,package-name ,@body))) - -(defun jd/manifest-generate-to-file (file-name) - "Generate GNU/Guix Emacs manifest to output file provided in: FILE-NAME." - (interactive - (list (read-from-minibuffer "Output file: " ))) - (with-temp-file file-name - (insert - (with-temp-buffer - (insert (format ";; This file is auto-generated by Emacs function: jd/manifest-generate-to-file\n%s" - `(specifications->manifest - '(,@(mapcar #'(lambda (guix-package-name) - (concat "\"" - guix-package-name - "\"\n")) - jd/manifest-list))))) - (pp-buffer) - (buffer-string))))) +(defun jd/generate-manifest () + "Generate GNU/Guix Emacs manifest to temp-buffer." + (interactive) + (with-output-to-temp-buffer "*guix-emacs-packages-manifest.scm*" + (princ (concat ";; This file is auto-generated by Emacs " + "function: jd/manifest-generate-to-file \n")) + (princ `(specifications->manifest + '(,@(mapcar #'(lambda (guix-package-name) + (concat "\"" + guix-package-name + "\"\n")) + jd/manifest-list)))))) + +(defun use-package-normalize/:guix-package (name keyword args) + (use-package-as-one (symbol-name keyword) args + #'(lambda (_label arg) + (cond + ((consp arg) arg) + ((stringp arg) (list arg)) + ((use-package-non-nil-symbolp arg) (symbol-name arg)) + (t + (use-package-error + ":pin wants an archive name (a string)")))))) + +(defun use-package-handler/:guix-package + (name _keyword args rest state) + (let ((body (use-package-process-keywords name rest state))) + (use-package-concat + (when (consp args) + (mapcar #'(lambda (arg) + `(jd/add-package-to-manifest ,arg)) + args)) + body))) + +(add-to-list 'use-package-keywords ':guix-package) (jd/add-package-to-manifest "emacs") (jd/add-package-to-manifest "emacs-guix") diff --git a/.emacs.d/jd/jd-apps.el b/.emacs.d/jd/jd-apps.el index a831d8d..f06430b 100755 --- a/.emacs.d/jd/jd-apps.el +++ b/.emacs.d/jd/jd-apps.el @@ -3,37 +3,44 @@ ;;; Code: -(use-package! vterm "emacs-vterm" +(use-package vterm + :guix-package "emacs-vterm" :init (add-to-list 'project-switch-commands '(project-vterm "Vterm") t) - (add-to-list 'project-kill-buffer-conditions '(major-mode . vterm-mode)) + (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)) + (setq vterm-tramp-shells + (append '(("ssh" "/bin/bash")) vterm-tramp-shells)) ) -(use-package! all-the-icons-dired "emacs-all-the-icons-dired" +(use-package all-the-icons-dired + :guix-package "emacs-all-the-icons-dired" :hook (dired-mode . all-the-icons-dired-mode)) -(use-package! dired nil +(use-package dired :ensure nil :commands (dired dired-jump) :custom ((dired-listing-switches "-agho --group-directories-first")) :config (setq dired-kill-when-opening-new-dired-buffer t)) -(use-package! pdf-tools "emacs-pdf-tools") +(use-package pdf-tools + :guix-package + "emacs-pdf-tools") -(use-package! password-store "emacs-password-store" +(use-package password-store + :guix-package "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! shell nil +(use-package shell :bind ("C-c C-" . shell)) diff --git a/.emacs.d/jd/jd-dev.el b/.emacs.d/jd/jd-dev.el index 4cd3f0c..569b12f 100755 --- a/.emacs.d/jd/jd-dev.el +++ b/.emacs.d/jd/jd-dev.el @@ -7,7 +7,8 @@ c-basic-offset 8 gdb-many-windows t) -(use-package! lsp-mode "emacs-lsp-mode" +(use-package lsp-mode + :guix-package "emacs-lsp-mode" :diminish t :commands (lsp lsp-deferred) :init @@ -18,10 +19,13 @@ :config (lsp-enable-which-key-integration t)) -(use-package! lsp-ivy "emacs-lsp-ivy" +(use-package lsp-ivy + :guix-package "emacs-lsp-ivy" :after lsp) -(use-package! paredit "emacs-paredit") + +(use-package paredit + :guix-package "emacs-paredit") (defun jd/lisp-mode-setup () (rainbow-delimiters-mode) @@ -34,14 +38,23 @@ (add-hook 'clojure-mode-hook 'jd/lisp-mode-setup) (add-hook 'lisp-mode-hook 'jd/lisp-mode-setup))) -(use-package! rainbow-delimiters "emacs-rainbow-delimiters") +(use-package rainbow-delimiters + :guix-package "emacs-rainbow-delimiters") + +(use-package sly + :guix-package "emacs-sly") + +(use-package geiser + :guix-package "emacs-geiser") + +(use-package geiser-racket + :guix-package "emacs-geiser-racket") -(use-package! sly "emacs-sly") +(use-package racket-mode + :guix-package "emacs-racket-mode") -(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" +(use-package geiser-guile + :guix-package "emacs-geiser-guile" :config (when jd/guix-p (defun jd/guix-repl () @@ -50,23 +63,29 @@ (geiser-guile-load-path (cons "~/dotfiles/guix" geiser-guile-load-path))) (geiser 'guile))))) -(use-package! pyvenv "emacs-pyvenv" +(use-package pyvenv + :guix-package "emacs-pyvenv" :after python-mode) -(use-package! typescript-mode "emacs-typescript-mode" +(use-package typescript-mode + :guix-package "emacs-typescript-mode" :mode ("\\.ts\\'") :config (setq typescript-indent-level 2)) -(use-package! cider "emacs-cider") +(use-package cider + :guix-package "emacs-cider") -(use-package! tide "emacs-tide" +(use-package tide + :guix-package "emacs-tide" :after (typescript-mode company web-mode)) -(use-package! flycheck "emacs-flycheck" +(use-package flycheck + :guix-package "emacs-flycheck" :hook ((after-init . global-flycheck-mode))) -(use-package! web-mode "emacs-web-mode" +(use-package web-mode + :guix-package "emacs-web-mode" :mode ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'") :config @@ -81,14 +100,17 @@ (setq web-mode-enable-auto-closing t) (setq web-mode-enable-current-element-highlight t)) -(use-package! yaml-mode "emacs-yaml-mode") +(use-package yaml-mode + :guix-package "emacs-yaml-mode") -(use-package! docker "emacs-docker" +(use-package docker + :guix-package "emacs-docker" :bind ("C-c D d" . docker-containers) ("C-c D D" . docker)) -(use-package! company "emacs-company" +(use-package company + :guix-package "emacs-company" :diminish t :after lsp-mode :hook (lsp-mode . company-mode) @@ -102,7 +124,8 @@ :config (global-company-mode)) -(use-package! projectile "emacs-projectile" +(use-package projectile + :guix-package "emacs-projectile" :diminish projectile-mode :init (when (file-directory-p "~/Documents/code") @@ -112,11 +135,13 @@ (setq projectile-switch-project-action #'projectile-dired) (projectile-mode)) -(use-package! magit "emacs-magit" +(use-package magit + :guix-package "emacs-magit" :custom (magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) -(use-package! restclient "emacs-restclient") +(use-package restclient + :guix-package "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 98b5e89..7731b01 100755 --- a/.emacs.d/jd/jd-exwm.el +++ b/.emacs.d/jd/jd-exwm.el @@ -4,9 +4,11 @@ ;;; Code: -(use-package! perspective "emacs-perspective") +(use-package perspective + :guix-package "emacs-perspective") -(use-package! exwm "emacs-exwm" +(use-package exwm + :guix-package "emacs-exwm" :config (defun jd/exwm-update-class () (exwm-workspace-rename-buffer exwm-class-name)) @@ -105,7 +107,8 @@ (require 'exwm-systemtray) (exwm-systemtray-enable)) -(use-package! desktop-environment "emacs-desktop-environment" +(use-package desktop-environment + :guix-package "emacs-desktop-environment" :after exwm :custom (desktop-environment-brightness-small-increment "2%+") diff --git a/.emacs.d/jd/jd-keys.el b/.emacs.d/jd/jd-keys.el index 108c70c..a5b828b 100755 --- a/.emacs.d/jd/jd-keys.el +++ b/.emacs.d/jd/jd-keys.el @@ -3,7 +3,8 @@ ;; Custom keysets used in my emacs ;;; Code: -(use-package! multiple-cursors "emacs-multiple-cursors" +(use-package multiple-cursors + :guix-package "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) @@ -11,7 +12,8 @@ (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)) -(use-package! hydra "emacs-hydra" +(use-package hydra + :guix-package "emacs-hydra" ;; :defer t :config (defun jd/text-scale-increase () @@ -36,7 +38,8 @@ ("k" text-scale-decrease "out") ("q" nil "finished" :exit t))) -(use-package! undo-tree "emacs-undo-tree" +(use-package undo-tree + :guix-package "emacs-undo-tree" :diminish :config (setq undo-tree-auto-save-history nil) diff --git a/.emacs.d/jd/jd-mu4e.el b/.emacs.d/jd/jd-mu4e.el index aa0355c..b388201 100755 --- a/.emacs.d/jd/jd-mu4e.el +++ b/.emacs.d/jd/jd-mu4e.el @@ -3,11 +3,11 @@ ;;; Code: -(use-package! htmlize "emacs-htmlize") +(use-package htmlize + :guix-package "emacs-htmlize") -(jd/add-package-to-manifest "isync") - -(use-package! mu4e "mu" +(use-package mu4e + :guix-package ("mu" "isync") :defer 10 :ensure nil :bind @@ -73,7 +73,8 @@ (mu4e t) (mu4e-modeline-mode nil)) -(use-package! mu4e-alert "emacs-mu4e-alert" +(use-package mu4e-alert + :guix-package "emacs-mu4e-alert" :defer 20 :config (mu4e-alert-set-default-style 'libnotify) diff --git a/.emacs.d/jd/jd-org.el b/.emacs.d/jd/jd-org.el index ff15b59..1126155 100755 --- a/.emacs.d/jd/jd-org.el +++ b/.emacs.d/jd/jd-org.el @@ -5,6 +5,7 @@ (defvar jd/org-home "~/Documents/Org") (defvar jd/org-roam-home (concat jd/org-home "/roam")) +(defvar jd/org-roam-agenda (concat jd/org-home "/agenda")) (defvar jd/org-roam-daily-home (concat jd/org-roam-home "/daily")) (defun jd/org-mode-init () @@ -15,9 +16,21 @@ (defun jd-emacs/org-insert-date (&optional date) (org-insert-time-stamp (org-read-date nil t (or date "+0d")))) -(use-package! org-pomodoro "emacs-org-pomodoro") +(use-package org-pomodoro + :guix-package "emacs-org-pomodoro") -(use-package! org "emacs-org" +(use-package org-caldav + :guix-package "emacs-org-caldav" + :config + (setq org-caldav-url "http://jdlugosz.com:5232/jdlugosz" + org-caldav-calendar-id "841a6259-8fe5-a178-e326-ddbb7c767e22" + org-caldav-inbox (concat jd/org-roam-agenda + "/main.org") + org-caldav-files nil + org-icalendar-timezone "Europe/Warsaw")) + +(use-package org + :guix-package "emacs-org" :pin org :commands (org-capture org-agenda) :hook (org-mode . jd/org-mode-init) @@ -122,14 +135,16 @@ (add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'jd/org-babel-tangle-config)))) -(use-package! org-superstar "emacs-org-superstar" +(use-package org-superstar + :guix-package "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" +(use-package org-roam + :guix-package "emacs-org-roam" :custom (org-roam-directory (file-truename jd/org-roam-home)) :bind (("C-c n l" . org-roam-buffer-toggle) @@ -194,7 +209,8 @@ (org-roam-db-autosync-mode)) -(use-package! ox-pandoc "emacs-ox-pandoc") +(use-package ox-pandoc + :guix-package "emacs-ox-pandoc") (provide 'jd-org) diff --git a/.emacs.d/jd/jd-ui.el b/.emacs.d/jd/jd-ui.el index ccaf369..992ba17 100755 --- a/.emacs.d/jd/jd-ui.el +++ b/.emacs.d/jd/jd-ui.el @@ -29,18 +29,22 @@ (require 'diminish) -(use-package! doom-modeline "emacs-doom-modeline" +(use-package doom-modeline + :guix-package "emacs-doom-modeline" :config (doom-modeline-mode)) -(use-package! solarized-theme "emacs-solarized-theme" +(use-package solarized-theme + :guix-package "emacs-solarized-theme" :config (load-theme 'solarized-dark-high-contrast t)) -(use-package! diminish "emacs-diminish") +(use-package diminish + :guix-package "emacs-diminish") -(use-package! hl-todo "emacs-hl-todo" +(use-package hl-todo + :guix-package "emacs-hl-todo" :init (setq hl-todo-keyword-faces '(("TODO" . "#FF0000") @@ -55,27 +59,32 @@ (counsel-load-theme) (run-hooks 'jd/load-theme-hook)) -(use-package! ivy "emacs-ivy" +(use-package ivy + :guix-package "emacs-ivy" :diminish :bind (("C-s" . swiper)) :config (ivy-mode 1)) -(use-package! counsel "emacs-counsel" +(use-package counsel + :guix-package "emacs-counsel" :diminish t :config (counsel-mode 1)) -(use-package! which-key "emacs-which-key" +(use-package which-key + :guix-package "emacs-which-key" :diminish :config (which-key-mode) (setq which-key-idle-delay 0.3)) -(use-package! all-the-icons "emacs-all-the-icons") +(use-package all-the-icons + :guix-package "emacs-all-the-icons") -(use-package! beacon "emacs-beacon" +(use-package beacon + :guix-package "emacs-beacon" :config (beacon-mode 1)) diff --git a/guix/jd/home/services/emacs.scm b/guix/jd/home/services/emacs.scm index 5eb74e8..15f0e68 100644 --- a/guix/jd/home/services/emacs.scm +++ b/guix/jd/home/services/emacs.scm @@ -66,6 +66,7 @@ "emacs-paredit" ;; "emacs-lsp-ivy" ;; "emacs-lsp-mode" + "emacs-org-caldav" "emacs-org-pomodoro" "emacs-org-roam" "emacs-org-roam-bibtex" -- cgit v1.2.3