blob: ed4e36a979edef2b444908b9179304b67bf86398 (
plain)
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
|
;;; -*- lexical-binding: t; -*-
;;; garbage collection threshold maneuvre
(setq gc-cons-threshold (* 512 1024 1024))
;;; tell me the start time at start-up
;;;###autoload
(defun message-start-time ()
"Tell me the start time at start-up."
(interactive)
(message "%s" (emacs-init-time)))
(add-hook 'emacs-startup-hook #'message-start-time)
;;; Macro to conveniently load files
;;;###autoload
(defvar load-file-directory (cond ((stringp load-file-name) (file-name-directory load-file-name))
(t default-directory))
"The directory to load files")
;;;###autoload
(defun load-config (file-name)
"Conviently load configuration files in the same directory as this file."
(load-file (expand-file-name file-name load-file-directory)))
;;;###autoload
(defun load-config-later (file-name seconds)
"Load FILE-NAME SECONDS later."
(run-with-idle-timer seconds nil (lambda () (load-config file-name))))
;;;###autoload
(defmacro prepare-in-hook-once (entry-name hook file)
"Define a function called ENTRY-NAME that loads FILE in HOOK once."
`(progn
(defun ,entry-name ()
(remove-hook ',hook ',entry-name)
(load-config ,file))
(add-hook ',hook ',entry-name)))
(load-config "basic.el")
(load-config "theme.el")
(load-config "modeline.el")
(prepare-in-hook-once prepare-elisp emacs-lisp-mode-hook "elisp.el")
(setq gc-cons-threshold (* 2 1024 1024))
|