Browse Source

Emacs: Update Elpaca bootstrap to version 0.3

master
Riyyi 2 years ago
parent
commit
dbf929c687
  1. 50
      .config/emacs/site-lisp/dot-elpaca.el

50
.config/emacs/site-lisp/dot-elpaca.el

@ -9,7 +9,7 @@
;; ----------------------------------------- ;; -----------------------------------------
;; Elpaca bootstrap ;; Elpaca bootstrap
(defvar elpaca-installer-version 0.2) (defvar elpaca-installer-version 0.3)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
@ -17,32 +17,36 @@
:ref nil :ref nil
:files (:defaults (:exclude "extensions")) :files (:defaults (:exclude "extensions"))
:build (:not elpaca--activate-package))) :build (:not elpaca--activate-package)))
(when-let ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) (let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory)) (build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order)) (order (cdr elpaca-order))
((add-to-list 'load-path (if (file-exists-p build) build repo))) (default-directory repo))
((not (file-exists-p repo)))) (add-to-list 'load-path (if (file-exists-p build) build repo))
(condition-case-unless-debug err (unless (file-exists-p repo)
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-installer*")) (make-directory repo t)
((zerop (call-process "git" nil buffer t "clone" (condition-case-unless-debug err
(plist-get order :repo) repo))) (if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
(default-directory repo) ((zerop (call-process "git" nil buffer t "clone"
((zerop (call-process "git" nil buffer t "checkout" (plist-get order :repo) repo)))
(or (plist-get order :ref) "--")))) ((zerop (call-process "git" nil buffer t "checkout"
(emacs (concat invocation-directory invocation-name)) (or (plist-get order :ref) "--"))))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" (emacs (concat invocation-directory invocation-name))
"--eval" "(byte-recompile-directory \".\" 0 'force)")))) ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
(progn (require 'elpaca) "--eval" "(byte-recompile-directory \".\" 0 'force)")))
(elpaca-generate-autoloads "elpaca" repo) ((require 'elpaca))
(kill-buffer buffer)) ((elpaca-generate-autoloads "elpaca" repo)))
(error "%s" (with-current-buffer buffer (buffer-string)))) (kill-buffer buffer)
((error) (warn "%s" err) (delete-directory repo 'recursive)))) (error "%s" (with-current-buffer buffer (buffer-string))))
(require 'elpaca-autoloads) ((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) (add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order)) (elpaca `(,@elpaca-order))
;; Stop coping with startup time, its done loading when its done loading ;; Stop coping with startup time, its done loading when its done loading
(add-hook 'emacs-startup-hook (lambda () (setq after-init-time (current-time)))) (add-hook 'elpaca-after-init-hook (lambda () (setq after-init-time (current-time))))
(provide 'dot-elpaca) (provide 'dot-elpaca)

Loading…
Cancel
Save