2024-07-30 14:40:34 +02:00
|
|
|
;;; Bootstrap elpaca
|
|
|
|
(setq package-enable-at-startup nil)
|
|
|
|
|
2024-07-30 20:09:06 +02:00
|
|
|
;; for guix emacs-next packages you can find the date with
|
|
|
|
;; ➜ stat /gnu/store/*emacs-next-[23]*.drv | rg Birth | cut -d' ' -f3 | tr -d '-'
|
|
|
|
;; 20240727
|
|
|
|
;;
|
|
|
|
;; it is possible there are more so probably the most recent one is the one to use.
|
|
|
|
|
|
|
|
(setq elpaca-core-date "20240727")
|
2024-07-30 14:40:34 +02:00
|
|
|
(defvar elpaca-installer-version 0.7)
|
|
|
|
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
|
|
|
|
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
|
|
|
|
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
|
|
|
|
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
|
|
|
|
:ref nil :depth 1
|
|
|
|
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
|
|
|
|
:build (:not elpaca--activate-package)))
|
|
|
|
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
|
|
|
|
(build (expand-file-name "elpaca/" elpaca-builds-directory))
|
|
|
|
(order (cdr elpaca-order))
|
|
|
|
(default-directory repo))
|
|
|
|
(add-to-list 'load-path (if (file-exists-p build) build repo))
|
|
|
|
(unless (file-exists-p repo)
|
|
|
|
(make-directory repo t)
|
|
|
|
(when (< emacs-major-version 28) (require 'subr-x))
|
|
|
|
(condition-case-unless-debug err
|
|
|
|
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
|
|
|
|
((zerop (apply #'call-process `("git" nil ,buffer t "clone"
|
|
|
|
,@(when-let ((depth (plist-get order :depth)))
|
|
|
|
(list (format "--depth=%d" depth) "--no-single-branch"))
|
|
|
|
,(plist-get order :repo) ,repo))))
|
|
|
|
((zerop (call-process "git" nil buffer t "checkout"
|
|
|
|
(or (plist-get order :ref) "--"))))
|
|
|
|
(emacs (concat invocation-directory invocation-name))
|
|
|
|
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
|
|
|
|
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
|
|
|
|
((require 'elpaca))
|
|
|
|
((elpaca-generate-autoloads "elpaca" repo)))
|
|
|
|
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
|
|
|
|
(error "%s" (with-current-buffer buffer (buffer-string))))
|
|
|
|
((error) (warn "%s" err) (delete-directory repo 'recursive))))
|
|
|
|
(unless (require 'elpaca-autoloads nil t)
|
|
|
|
(require 'elpaca)
|
|
|
|
(elpaca-generate-autoloads "elpaca" repo)
|
|
|
|
(load "./elpaca-autoloads")))
|
|
|
|
(add-hook 'after-init-hook #'elpaca-process-queues)
|
|
|
|
(elpaca `(,@elpaca-order))
|
|
|
|
|
|
|
|
;; Enable :elpaca use-package keyword.
|
|
|
|
(elpaca elpaca-use-package
|
|
|
|
(elpaca-use-package-mode))
|
|
|
|
|
2024-09-22 01:19:43 +02:00
|
|
|
;; Wait for elpaca ;
|
2024-08-16 00:44:07 +02:00
|
|
|
(message "Waiting for elpaca")
|
2024-09-22 01:19:43 +02:00
|
|
|
;(elpaca-wait)
|
2024-07-30 14:40:34 +02:00
|
|
|
|
2024-07-30 16:40:09 +02:00
|
|
|
(setq crafted-emacs-home "~/.local/share/crafted-emacs")
|
|
|
|
|
|
|
|
(defun check-crafted-emacs-fresh-repo ()
|
|
|
|
"Check if the crafted-emacs repo is fresh."
|
|
|
|
(if (file-exists-p crafted-emacs-home)
|
|
|
|
(progn
|
|
|
|
(message "Crafted Emacs repo exists. Pulling...")
|
|
|
|
(shell-command (format "cd %s && git pull" crafted-emacs-home)))
|
|
|
|
(progn
|
|
|
|
(message "Crafted Emacs repo does not exist. Cloning...")
|
|
|
|
(shell-command (format "git clone https://github.com/SystemCrafters/crafted-emacs.git %s" crafted-emacs-home)))
|
|
|
|
))
|
|
|
|
|
2024-07-30 14:40:34 +02:00
|
|
|
;; tangling to generate scripts for the local bin directory. This
|
|
|
|
;; causes the name of the scripts to be returned in the car of the
|
|
|
|
;; tangle command which is used to load the file. The net result is
|
|
|
|
;; that not the initialization is loaded, but the first exported
|
|
|
|
;; script.
|
|
|
|
(use-package ob-tangle)
|
|
|
|
(let ((src (concat user-emacs-directory "init.org"))
|
2024-10-30 12:40:12 +01:00
|
|
|
(tgt (concat user-emacs-directory "init.el"))
|
|
|
|
(enable-local-variables nil)) ;; disable local variables to prevent asking confirmation before frame is available
|
2024-08-15 13:14:23 +02:00
|
|
|
(when (file-newer-than-file-p src tgt)
|
2024-09-22 01:19:43 +02:00
|
|
|
(message "tangling init.org")
|
2024-08-15 13:14:23 +02:00
|
|
|
(delete-file tgt)
|
|
|
|
(org-babel-tangle-file src tgt "emacs-lisp")
|
|
|
|
;; this is a good time to check if the crafted-emacs repo is fresh
|
|
|
|
;; - we just updated the init.org file so we expect changes.
|
|
|
|
;; - or this is the initial tangling and we need the repo to exist.
|
|
|
|
(message "checking crafted emacs repo...")
|
|
|
|
(check-crafted-emacs-fresh-repo)
|
|
|
|
))
|
2024-07-30 14:40:34 +02:00
|
|
|
|
|
|
|
;; Configure Crafted Emacs
|
|
|
|
(setq crafted-package-system 'elpaca)
|
|
|
|
(setq crafted-package-installer #'elpaca-try)
|
|
|
|
(setq crafted-package-installed-predicate #'elpaca-installed-p)
|
|
|
|
|
|
|
|
|
2024-09-22 01:19:43 +02:00
|
|
|
;; Startup Crafted Emacsa
|
|
|
|
(message "start crafted emacs")
|
2024-07-30 14:40:34 +02:00
|
|
|
(load (expand-file-name "modules/crafted-package-config" crafted-emacs-home))
|
|
|
|
(load (expand-file-name "modules/crafted-early-init-config" crafted-emacs-home))
|
|
|
|
|
2024-08-11 11:36:44 +02:00
|
|
|
(message "early-init done")
|