Add neat loading screen (maybe a litte too big :-))

This commit is contained in:
syl20bnr 2014-09-06 21:36:53 -04:00
parent 3329a8e73c
commit 8f8ffb4f7e
4 changed files with 47 additions and 6 deletions

12
banner.txt Normal file
View File

@ -0,0 +1,12 @@
Welcome to
▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄ ▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░▌ ▐░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌░▌ ▐░▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀
▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌▐░▌ ▐░▌▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░█▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌ ▐░░░░░░░░░░░▌
▀▀▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▀ ▐░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▀▀▀▀▀▀▀▀▀█░▌
▐░▌▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌
▄▄▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄█░▌
▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀

View File

@ -85,7 +85,10 @@ extension.
(puthash pkg sym spacemacs-all-pre-extensions))
(dolist (pkg (eval (intern (format "%s-post-extensions"
(symbol-name sym)))))
(puthash pkg sym spacemacs-all-post-extensions))))))
(puthash pkg sym spacemacs-all-post-extensions)))))
;; number of chuncks for the loading screen
(setq loading-dots-chunk-size-max (/ loading-dots-count-max
loading-dots-chunk-count)))
(defun contribsys/install-packages ()
"Install the packages all the packages if there are not currently installed."
@ -117,6 +120,7 @@ extension.
"Initialize the package PKG from the configuration layer LSYM."
(let* ((layer (assq lsym spacemacs-config-layers))
(init-func (intern (format "%s/init-%s" (symbol-name lsym) pkg))))
(loading-animation)
(if (and (package-installed-p pkg) (fboundp init-func))
(funcall init-func))))
@ -130,6 +134,7 @@ extension.
(ext-dir (plist-get (cdr layer) :ext-dir))
(init-func (intern (format "%s/init-%s" (symbol-name lsym) ext))))
(add-to-list 'load-path (format "%s%s/" ext-dir ext))
(loading-animation)
(if (fboundp init-func) (funcall init-func))))
(defun contribsys/declare-configuration-layers ()

32
init.el
View File

@ -3,19 +3,43 @@
(setq message-log-max 16384)
(defconst emacs-start-time (current-time))
(switch-to-buffer (get-buffer-create "*spacemacs*"))
(defvar spacemacs-title-length 116)
(defvar loading-text "Loading")
(defvar loading-done-text "Ready!")
(defvar loading-dots-chunk-count 3)
(defvar loading-dots-chunk-size 0)
(defvar loading-dots-chunk-size-max 0)
(defvar loading-dots-count-max
(- spacemacs-title-length (length loading-text) (length loading-done-text)))
(defun create-spacemacs-buf ()
"Create and initialize the spacemacs startup buffer."
(switch-to-buffer (get-buffer-create "*spacemacs*"))
(insert-file-contents (concat user-emacs-directory "banner.txt"))
(goto-char (point-max))
(insert loading-text)
(redisplay))
(defun append-to-spacemacs-buf (msg)
"Append MSG to buffer."
"Append MSG to spacemacs buffer."
(with-current-buffer (get-buffer-create "*spacemacs*")
(goto-char (point-max))
(insert (format "%s\n" msg))))
(defun replace-last-line-of-spacemacs-buf (msg)
"Replace the last line of the buffer with MSG."
"Replace the last line of the spacemacs buffer with MSG."
(with-current-buffer (get-buffer-create "*spacemacs*")
(goto-char (point-max))
(delete-region (line-beginning-position) (point-max))
(insert msg)))
(defun loading-animation ()
"Display LOADING-TITLE with trailing dots of max length
SPACEMACS-TITLE-LENGTH. New loading title is displayed by chunk
of size LOADING-DOTS-CHUNK-SIZE-MAX."
(setq loading-dots-chunk-size (1+ loading-dots-chunk-size))
(setq loading-text (concat loading-text "."))
(if (>= loading-dots-chunk-size loading-dots-chunk-size-max)
(progn
(setq loading-dots-chunk-size 0)
(replace-last-line-of-spacemacs-buf loading-text)
(redisplay))))
(defconst user-home-directory
(expand-file-name (concat user-emacs-directory "../"))

View File

@ -113,4 +113,4 @@
(deftheme solarized-dark "The dark variant of the Solarized colour theme")
(create-solarized-theme 'dark 'solarized-dark)
(spacemacs/set-flycheck-custom-face)
)))
(create-spacemacs-buf))))