summaryrefslogtreecommitdiff
path: root/init.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2020-12-24 16:27:22 +0800
committerJSDurand <mmemmew@gmail.com>2020-12-24 17:48:34 +0800
commitf21945a5afa22e051d3888b8dcacb2b27900403f (patch)
treedd2a16838f9c537976ac213ca2a1dc8b3cb796d0 /init.el
parent706f2000cedb1bc8983f07fca2f45e5090b79ddf (diff)
More progess
Diffstat (limited to 'init.el')
-rw-r--r--init.el42
1 files changed, 37 insertions, 5 deletions
diff --git a/init.el b/init.el
index 3e10d19..ed4e36a 100644
--- a/init.el
+++ b/init.el
@@ -1,19 +1,51 @@
-;;; macro to conveniently load files
+;;; -*- 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))
+(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")
+(load-config "modeline.el")
+(prepare-in-hook-once prepare-elisp emacs-lisp-mode-hook "elisp.el")
+(setq gc-cons-threshold (* 2 1024 1024))