-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.el
More file actions
executable file
·89 lines (82 loc) · 2.94 KB
/
Copy pathinit.el
File metadata and controls
executable file
·89 lines (82 loc) · 2.94 KB
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
;;
;; Most of this init.el file is an adaptation of Daniel Mai's configuration file
;; https://github.com/danielmai/.emacs.d/blob/master/init.el
;;
(setq gc-cons-threshold 400000000)
;;
;; STARTUP
;;
;;
;; The first line of the init.el file seems to be speeding up the time it takes for Emacs to start ...
;;
;;
;;
;;
;; Begin initialization
;;
;;
;; Turn off mouse interface early in startup to avoid momentary display
;;
(menu-bar-mode -1)
(when window-system
(tool-bar-mode -1)
(scroll-bar-mode -1)
(tooltip-mode -1))
(setq inhibit-startup-message t)
;;
;; PACKAGES
;;
;;
;; Set up package
(require 'package)
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
)
)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;;
;; MORE CUSTOMIZATIONS
;;
;;
;; Set custom-file but only load if it exists (auto-generated by Emacs)
(setq custom-file (expand-file-name "inits/custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
;; Load the config.
;;
;; On a normal launch this just loads the byte-compiled inits/repp.el —
;; Org is NOT loaded at startup. Org is pulled in only to re-tangle when
;; inits/repp.org has actually changed; the tangled output is then
;; byte-compiled (and native-comp JITs it to .eln in the background), so
;; subsequent launches load fast without touching Org or the tangler.
(let* ((conf-org (expand-file-name "inits/repp.org" user-emacs-directory))
(conf-el (expand-file-name "inits/repp.el" user-emacs-directory))
(conf-elc (concat conf-el "c")))
;; (Re)tangle and byte-compile only when the compiled artifact is
;; missing or older than the Org source. Gating on the .elc — the file
;; actually loaded — is what makes this robust: git checkouts bump
;; repp.org's mtime, and org-babel-tangle-file leaves repp.el's mtime
;; untouched when the content is unchanged, so gating on repp.el would
;; re-tangle (and load Org) on every launch and never settle. Org is
;; pulled in only on this path; a normal launch skips it entirely.
(when (or (not (file-exists-p conf-elc))
(file-newer-than-file-p conf-org conf-elc))
(require 'org)
(org-babel-tangle-file conf-org conf-el "emacs-lisp\\|elisp")
;; On compile failure, drop any partial .elc so the load below cleanly
;; falls back to the .el source.
(let ((byte-compile-warnings nil))
(condition-case err
(byte-compile-file conf-el)
(error
(when (file-exists-p conf-elc) (delete-file conf-elc))
(message "repp: byte-compile failed (%s); loading source" err)))))
;; Load the compiled config. load-prefer-newer is still nil here, so
;; the .elc wins; if compilation failed it falls back to the .el.
(load (file-name-sans-extension conf-el) nil t))
(setq gc-cons-threshold 800000)