-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
96 lines (69 loc) · 2.66 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
;;; -*- lexical-binding: t; -*-
;; using space instead of hard tab
(setq-default indent-tabs-mode nil)
(defadvice message (before message-with-timestamp activate)
"message with timestamp"
(if (not (or (< (length (ad-get-args 0)) 1)
(null (ad-get-arg 0))
(string-equal (ad-get-arg 0) "%s")))
(let ((deactivate-mar nil))
(with-current-buffer "*Messages*"
(read-only-mode -1)
(goto-char (point-max))
(if (not (bolp))
(newline))
(insert (format-time-string "[%F %T.%3N] " (current-time)))
(read-only-mode 1)))))
(message "initialization begin")
;; using space instead of hard tab
(setq-default indent-tabs-mode nil)
;; gc config for boost startup
(setq gc-cons-threshold (* 100 1000 1000))
(toggle-debug-on-error)
(setq emacsroot "~/.emacs.d")
(setq package-archives '(("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
("org" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/org/")))
(require 'package)
(package-initialize) ; load and activate packages defined in package-load-list
;; install use-package if missing
(dolist (pkg '(use-package))
(unless (package-installed-p pkg)
(message "refresh package content...")
(package-refresh-contents)
(message "begin to install %s" pkg)
(package-install pkg)
(message "%s install finished" pkg)))
(require 'use-package)
(setq use-package-verbose t
use-package-always-defer t
use-package-always-ensure t)
(setq package-check-signature nil)
;; setup customize init scripts path
(add-to-list 'load-path
(expand-file-name "lisp" emacsroot))
(setq custom-file
(expand-file-name "custom.el" emacsroot))
(require 'init-misc)
(require 'init-org)
(require 'init-helm)
(require 'init-company)
(require 'init-tex)
(require 'init-python)
(require 'init-cpp)
(require 'init-lisp)
;; start up time profile
(add-hook 'emacs-startup-hook (lambda ()
(message "emacs start in %s with %d garbage collections"
(format "%.2fseconds" (float-time (time-subtract after-init-time before-init-time)))
gcs-done)))
(setq g-cons-threshold (* 20 1000 1000))
(put 'narrow-to-page 'disabled nil)
(put 'narrow-to-region 'disabled nil)
;; customize face while run in GUI
(when (display-graphic-p)
(load-theme 'nova t)
(set-default-font "monaco 16" nil t)
;; possible alpha value: (active . inactive) or both
(set-frame-parameter nil 'alpha '(96 . 90)))
(message "initialization done")