mirror of https://github.com/Chizi123/.emacs.d.git

Joel Grunbaum
2024-02-14 56a5d88324a3d10b8ba52d673f58fc43b01b1b89
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;;; Package manager selection
;; Can chose the package manager from the default package.el or straight.el
;; There may be problems with some of them in corporate environments
 
;; Repos
(cond ((eq package-manager 'package)
       (require 'package)
       (when (not (boundp 'package-archives))
         (setq package-archives '(("gnu"   . "https://elpa.gnu.org/packages/")
                                  ("nongnu"  . "https://elpa.nongnu.org/nongnu/")
                                  ("melpa" . "https://melpa.org/packages/"))))
       (package-initialize)
 
       ;; use-package
       (unless (package-installed-p 'use-package)
         (package-refresh-contents)
         (package-install 'use-package))
       (setq package-install-upgrade-built-in t)
 
       (eval-when-compile
         (require 'use-package))
       (require 'use-package-ensure)
       (setq use-package-always-ensure t))
      ((eq package-manager 'straight)
       (defvar bootstrap-version)
       (let ((bootstrap-file
              (expand-file-name
               "straight/repos/straight.el/bootstrap.el"
               (or (bound-and-true-p straight-base-dir)
                  user-emacs-directory)))
             (bootstrap-version 7))
         (unless (file-exists-p bootstrap-file)
           (with-current-buffer
               (url-retrieve-synchronously
                "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
                'silent 'inhibit-cookies)
             (goto-char (point-max))
             (eval-print-last-sexp)))
         (load bootstrap-file nil 'nomessage))
       (straight-use-package 'use-package)
       (setq straight-use-package-by-default t)))