aboutsummaryrefslogtreecommitdiff
path: root/common/.config/emacs/package-setup.el.org
blob: fa15a440a3984bb5b50deb2530ab2bfad550da7e (plain)
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
#+title: Emacs Package Setup
Install =straight= for better package management.
#+begin_src emacs-lisp :tangle ~/.config/emacs/package-setup.el :mkdirp yes
    (defun set-exec-path-from-shell-PATH ()
     (interactive)
     (let ((path-from-shell (replace-regexp-in-string
                             "[ \t\n]*$" "" (shell-command-to-string
                                             "$SHELL --login -c 'echo $PATH'"))))

       (setenv "PATH" path-from-shell)
       (setq exec-path (split-string path-from-shell path-separator))))

  (set-exec-path-from-shell-PATH)
  (setq native-comp-async-report-warnings-errors 'silent)
  (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))
#+end_src

Install =use-package= for declarative package installation. Make =use-package= default to =ensure t= so that packages are enabled if they are declared.
#+begin_src emacs-lisp :tangle ~/.config/emacs/package-setup.el :mkdirp yes
  (straight-use-package 'use-package)
  (setq straight-use-package-by-default t)
#+end_src