diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 42 |
1 files changed, 37 insertions, 5 deletions
@@ -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)) |