-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
111 lines (84 loc) · 3.24 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
;;; init.el --- Initialization. -*- lexical-binding: t; -*-
;; Copyright (C) 2022 Brihadeesh
;; This file is NOT part of GNU Emacs.
;; This file is free software.
;; Author: peregrinator <brihadeesh@protonmail.com>
;; URL: https://git.sr.ht/~peregrinator/.emacs.d
;; Package-Requires: ((emacs "28.1"))
;;; Commentary:
;; This file provides the initialization configuration.
;;; Code:
;; Make emacs startup faster
(defvar startup/file-name-handler-alist file-name-handler-alist)
(setq file-name-handler-alist nil)
(defun startup/revert-file-name-handler-alist ()
"Revert file name handler alist."
(setq file-name-handler-alist startup/file-name-handler-alist))
(add-hook 'emacs-startup-hook 'startup/revert-file-name-handler-alist)
;; For performance
(setq read-process-output-max (* 1024 1024)) ;; 1mb
(setq process-adaptive-read-buffering nil)
;; Load newer .elc or .el
(setq load-prefer-newer t)
;; prevent native-comp error (?)
;; see https://github.com/doomemacs/doomemacs/issues/5682
(defvar native-comp-deferred-compilation-deny-list nil)
;;; Configure `straight.el'
;; fetch developmental version of `straight.el'
(setq straight-repository-branch "develop"
;; redirect all package repos and builddirs elsewhere
straight-base-dir "~/.cache/")
;; Bootstrap straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" "~/.cache"))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;;; Configure straight.el (contd.)
;; make all use-package instances use straight.el
(setq straight-use-package-by-default t
;; clone depth (probably to save space)
straight-vc-git-default-clone-depth 1
;; Define when to check for package modifications,
;; for improved straight.el startup time.
straight-check-for-modifications nil
;; use elpa
straight-recipes-gnu-elpa-use-mirror t
straight-host-usernames
'((github . "brihadeesh")
(gitlab . "peregrinator")))
;; Install use-package with straight.el
(straight-use-package 'use-package)
;; install org & org-contrib
(straight-use-package 'org)
;; (require 'org)
(straight-use-package 'org-contrib)
;; WHY?
;; Restore original GC values
;; (add-hook 'emacs-startup-hook
;; (lambda ()
;; (setq gc-cons-threshold gc-cons-threshold-original)
;; (setq gc-cons-percentage gc-cons-percentage-original)))
;; Tangle the file if needed
(let* ((default-directory user-emacs-directory)
(org-file "configuration.org")
(el-file "configuration.el")
(changed-at (file-attribute-modification-time (file-attributes org-file))))
(require 'org-macs)
(unless (org-file-newer-than-p el-file changed-at)
(require 'ob-tangle)
(org-babel-tangle-file org-file el-file "emacs-lisp"))
(load-file el-file))
;; Load configuration.org
(when (file-readable-p
(concat user-emacs-directory "configuration.org"))
(org-babel-load-file
(concat user-emacs-directory "configuration.org")))
;;; init.el ends here