Clean up init.el

This commit is contained in:
syl20bnr 2014-09-23 20:47:20 -04:00
parent 8323ddb53c
commit c8310c6393
2 changed files with 29 additions and 37 deletions

View File

@ -1,3 +1,6 @@
(setq message-log-max 16384)
(defconst emacs-start-time (current-time))
(define-derived-mode spacemacs-mode special-mode "spacemacs-mode"
"Spacemacs major mode for startup screen."
:syntax-table nil
@ -13,15 +16,14 @@
(copy-file (concat user-emacs-directory ".spacemacs.template") dotfile))
(load dotfile)))
(defvar spacemacs-title-length 68)
(defvar spacemacs-title-length 70)
(defvar loading-counter 0)
(defvar loading-text "Loading")
(defvar loading-done-text "Ready!")
(defvar loading-dots-chunk-count 3)
(defvar loading-dots-count-max
(defvar loading-dots-count
(- spacemacs-title-length (length loading-text) (length loading-done-text)))
(defvar loading-dots-chunk-size
(/ loading-dots-count-max loading-dots-chunk-count))
(defvar loading-dots-chunk-size (/ loading-dots-count loading-dots-chunk-count))
(defvar loading-dots-chunk-threshold 0)
(defun spacemacs-buffer ()
@ -63,6 +65,13 @@ of size LOADING-DOTS-CHUNK-THRESHOLD."
(redisplay))))
;; Ready message
(add-hook 'after-init-hook (lambda ()
(append-to-spacemacs-buf loading-done-text)))
(add-hook 'after-init-hook
(lambda ()
(append-to-spacemacs-buf (format "%s\n" loading-done-text))
;; from jwiegley
;; https://github.com/jwiegley/dot-emacs/blob/master/init.el
(let ((elapsed (float-time
(time-subtract (current-time) emacs-start-time))))
(append-to-spacemacs-buf
(format "[%.3fs]\n" elapsed)))))

45
init.el
View File

@ -1,15 +1,15 @@
;; from jwiegley
;; https://github.com/jwiegley/dot-emacs/blob/master/init.el
(setq message-log-max 16384)
(defconst emacs-start-time (current-time))
;; paths
(defconst user-home-directory
(expand-file-name (concat user-emacs-directory "../"))
"User home directory (~/).")
;; load core source and display spacemacs buffer
(defconst spacemacs-core-directory
(expand-file-name (concat user-emacs-directory "core/"))
"Spacemacs core directory.")
(dolist (elisp '("spacemacs-mode.el" "contribsys.el"))
(load (concat spacemacs-core-directory elisp)))
(spacemacs-buffer)
;; additional paths
(defconst user-home-directory
(expand-file-name (concat user-emacs-directory "../"))
"User home directory (~/).")
(defconst spacemacs-contrib-config-directory
(expand-file-name (concat user-emacs-directory "contrib/"))
"Spacemacs contribution layers base directory.")
@ -19,33 +19,16 @@
;; if you have a dropbox, then ~/Dropbox/emacs is added to load path
(add-to-list 'load-path (concat user-dropbox-directory "emacs/"))
;; load core source
(dolist (elisp '("spacemacs-mode.el" "contribsys.el"))
(load (concat spacemacs-core-directory elisp)))
(spacemacs-buffer)
;; User configuration file for Spacemacs: ~/.spacemacs
(spacemacs-load-dotfile)
(dotspacemacs/init)
;; initialisation of the contribution system based on configuration layers
;; additional configuration layers are declared in ~/.spacemacs
;; in variable dotspacemacs-configuration-layers
(contribsys/declare-layer 'spacemacs)
(contribsys/declare-configuration-layers)
(contribsys/load-layers)
;; Last configuration decisions are given to the user who can defined them
;; in ~/.spacemacs
;; Ultimate configuration decisions are given to the user who can defined them
;; in his/her ~/.spacemacs file
(dotspacemacs/config)
; from jwiegley
;; https://github.com/jwiegley/dot-emacs/blob/master/init.el
;; Display load times after init.el and after all buffers has been loaded
(let ((elapsed (float-time (time-subtract (current-time)
emacs-start-time))))
(message "Loading %s...done (%.3fs)" load-file-name elapsed))
(add-hook 'after-init-hook
`(lambda ()
(let ((elapsed (float-time
(time-subtract (current-time) emacs-start-time))))
(message "Loading %s...done (%.3fs) [after-init]"
,load-file-name elapsed))) t)