diff --git a/core/banners/000-banner.txt b/core/banners/000-banner.txt new file mode 100644 index 000000000..5016edeb8 --- /dev/null +++ b/core/banners/000-banner.txt @@ -0,0 +1,7 @@ +Welcome to +███████╗██████╗**█████╗**██████╗███████╗███╗***███╗*█████╗**██████╗███████╗ B +██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗*████║██╔══██╗██╔════╝██╔════╝ E +███████╗██████╔╝███████║██║*****█████╗**██╔████╔██║███████║██║*****███████╗ T +╚════██║██╔═══╝*██╔══██║██║*****██╔══╝**██║╚██╔╝██║██╔══██║██║*****╚════██║ A +███████║██║*****██║**██║╚██████╗███████╗██║*╚═╝*██║██║**██║╚██████╗███████║ +╚══════╝╚═╝*****╚═╝**╚═╝*╚═════╝╚══════╝╚═╝*****╚═╝╚═╝**╚═╝*╚═════╝╚══════╝ diff --git a/core/banners/001-banner.txt b/core/banners/001-banner.txt new file mode 100644 index 000000000..842f7b64d --- /dev/null +++ b/core/banners/001-banner.txt @@ -0,0 +1,8 @@ + ┏━━━┓ + ┃┏━┓┃ Welcome to + ┃┗━━┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓╋╋╋╋┏┓┏┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓╋╋╋╋┏━━┓ b + ┗━━┓┃┏━━┓┃┏┓┃┏━━┓┃┏┓┃┏━━┓┃┏━┛┏━━┓┃┃━┫┏━━┓┃┗┛┃┏━━┓┃┏┓┃┏━━┓┃┏━┛┏━━┓┃━━┫ e + ┃┗━┛┃┗━━┛┃┗┛┃┗━━┛┃┏┓┃┗━━┛┃┗━┓┗━━┛┃┃━┫┗━━┛┃┃┃┃┗━━┛┃┏┓┃┗━━┛┃┗━┓┗━━┛┣━━┃ t + ┗━━━┛╋╋╋╋┃┏━┛╋╋╋╋┗┛┗┛╋╋╋╋┗━━┛╋╋╋╋┗━━┛╋╋╋╋┗┻┻┛╋╋╋╋┗┛┗┛╋╋╋╋┗━━┛╋╋╋╋┗━━┛ a + ╋╋╋╋╋╋╋╋╋┃┃[The best editor is neither Emacs nor Vim, it's Emacs+Vim] + ╋╋╋╋╋╋╋╋╋┗┛ diff --git a/core/banner.txt b/core/banners/002-banner.txt similarity index 100% rename from core/banner.txt rename to core/banners/002-banner.txt diff --git a/core/configuration-layer.el b/core/configuration-layer.el index 1f5de58aa..fdefad136 100644 --- a/core/configuration-layer.el +++ b/core/configuration-layer.el @@ -1,6 +1,10 @@ (require 'dotspacemacs) (require 'ht) +(defconst configuration-layer-template-directory + (expand-file-name (concat spacemacs-core-directory "templates/")) + "Configuration layer templates directory.") + (defconst configuration-layer-contrib-directory (expand-file-name (concat user-emacs-directory "contrib/")) "Spacemacs contribution layers base directory.") @@ -91,7 +95,7 @@ NAME." (defun configuration-layer//copy-template (template) "Copy and replace special values of TEMPLATE to LAYER_DIR." - (let ((src (concat spacemacs-template-directory + (let ((src (concat configuration-layer-template-directory (format "%s.template" template))) (dest (concat (configuration-layer//get-private-layer-dir name) (format "%s.el" template)))) diff --git a/core/dotspacemacs.el b/core/dotspacemacs.el index 173e137b9..2138f964c 100644 --- a/core/dotspacemacs.el +++ b/core/dotspacemacs.el @@ -1,7 +1,11 @@ +(defconst dotspacemacs-template-directory + (expand-file-name (concat spacemacs-core-directory "templates/")) + "Templates directory.") + (defvar dotspacemacs-configuration-layer-path '() "List of additional paths where to look for configuration layers. Paths must have a trailing slash (ie. `~/.mycontribs/')" -) + ) (defvar dotspacemacs-configuration-layers '() "list of contribution to load." @@ -73,7 +77,7 @@ before installing the file if the destination already exists." dotfile)) t))) (when install - (copy-file (concat spacemacs-template-directory + (copy-file (concat dotspacemacs-template-directory ".spacemacs.template") dotfile t) (message "%s has been installed." dotfile)))) diff --git a/core/spacemacs-mode.el b/core/spacemacs-mode.el index 61be6ada2..121f0588c 100644 --- a/core/spacemacs-mode.el +++ b/core/spacemacs-mode.el @@ -9,9 +9,9 @@ "Spacemacs core directory.") (add-to-list 'load-path spacemacs-core-directory) -(defconst spacemacs-template-directory - (expand-file-name (concat spacemacs-core-directory "templates/")) - "Spacemacs templates directory.") +(defconst spacemacs-banner-directory + (expand-file-name (concat spacemacs-core-directory "banners/")) + "Spacemacs banners directory.") ;; additional paths (defconst user-home-directory @@ -95,9 +95,7 @@ (`w32 (spacemacs/set-font font 9)) (other (spacemacs/set-font font 10))))) ;; banner - (let ((buffer-read-only nil)) - (insert-file-contents (concat spacemacs-core-directory "banner.txt")) - (spacemacs/insert-buttons)) + (spacemacs//insert-banner) ;; bind-key is required by use-package (spacemacs/load-or-install-package 'bind-key t) (spacemacs/load-or-install-package 'use-package t) @@ -161,6 +159,18 @@ If LOG is non-nil a message is displayed in spacemacs-mode buffer." (add-to-list 'default-frame-alist (cons 'font fontstr)) (set-default-font fontstr))) +(defun spacemacs//insert-banner () + "Choose a banner and insert in spacemacs buffer." + (let* ((files (directory-files spacemacs-banner-directory nil nil 'nosort)) + (count (length files)) + ;; -2 to remove `.' `..' + (choice (random (- count 2))) + (banner (format "%03d-banner.txt" choice)) + (buffer-read-only nil)) + (message "%s" count) + (insert-file-contents (concat spacemacs-banner-directory banner)) + (spacemacs/insert-buttons))) + (defun spacemacs/message (msg &rest args) "Display MSG in message prepended with '(Spacemacs)'." (message "(Spacemacs) %s" (apply 'format msg args)))