-
Notifications
You must be signed in to change notification settings - Fork 43
/
init.el
57 lines (47 loc) · 2.08 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
;;; init.el --- Emacs init file
;; Author: Ian Y.E. Pan
;;; Commentary:
;;; A lightweight Emacs config containing only the essentials: shipped with a custom theme!
;;; Code:
(defvar file-name-handler-alist-original file-name-handler-alist)
(setq gc-cons-threshold most-positive-fixnum
gc-cons-percentage 0.6
file-name-handler-alist nil
site-run-file nil)
(defvar ian/gc-cons-threshold 100000000)
(add-hook 'emacs-startup-hook ; hook run after loading init files
(lambda ()
(setq gc-cons-threshold ian/gc-cons-threshold
gc-cons-percentage 0.1
file-name-handler-alist file-name-handler-alist-original)))
(add-hook 'minibuffer-setup-hook (lambda ()
(setq gc-cons-threshold (* ian/gc-cons-threshold 2))))
(add-hook 'minibuffer-exit-hook (lambda ()
(garbage-collect)
(setq gc-cons-threshold ian/gc-cons-threshold)))
(require 'package)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/"))
(setq package-enable-at-startup nil)
(package-initialize)
;; workaround bug in Emacs 26.2
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;; Setting up the package manager. Install if missing.
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-and-compile
(setq use-package-always-ensure t))
;;; Emacs 28+ (native-comp) stuff
(when (and (fboundp 'native-comp-available-p) (native-comp-available-p))
(progn
(setq native-comp-async-report-warnings-errors nil)
(setq native-comp-deferred-compilation t)
(add-to-list 'native-comp-eln-load-path (expand-file-name "eln-cache/" user-emacs-directory))
(setq package-native-compile t)))
;; Load main config file "./config.org"
(require 'org)
(org-babel-load-file (expand-file-name (concat user-emacs-directory "config.org")))
(provide 'init)
;;; init.el ends here