From f21945a5afa22e051d3888b8dcacb2b27900403f Mon Sep 17 00:00:00 2001 From: JSDurand Date: Thu, 24 Dec 2020 16:27:22 +0800 Subject: More progess --- init.el | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'init.el') 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)) -- cgit v1.2.3-18-g5258