Skip to content

Commit

Permalink
core: condensed versions into one string in left-hand side
Browse files Browse the repository at this point in the history
spacemacs-version@emacs-version (distribution)
  • Loading branch information
syl20bnr committed Jun 5, 2016
1 parent f3e5019 commit 627e934
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion core/core-configuration-layer.el
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ refreshed during the current session."
If NO-INSTALL is non nil then install steps are skipped."
(dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...")
(when (spacemacs-buffer//choose-banner)
(spacemacs-buffer//inject-version t))
(spacemacs-buffer//inject-version))
;; first, declare layer then package as soon as possible to
;; resolve usage and ownership (in other words, get the list of used
;; layers and packages as soon as possible)
Expand Down
28 changes: 12 additions & 16 deletions core/core-spacemacs-buffer.el
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Cate special text banner can de reachable via `998', `cat' or `random*'.
(if (image-type-available-p (intern (file-name-extension banner)))
(spacemacs-buffer//insert-image-banner banner)
(insert-file-contents banner))
(spacemacs-buffer//inject-version t))
(spacemacs-buffer//inject-version))
(spacemacs-buffer//insert-buttons)
(unless (bound-and-true-p spacemacs-initialized)
(spacemacs-buffer/insert-page-break))
Expand Down Expand Up @@ -167,33 +167,28 @@ If ALL is non-nil then truly all banners can be selected."
(width (car size))
(left-margin (max 0 (floor (- spacemacs-buffer--banner-length width) 2))))
(goto-char (point-min))
(spacemacs-buffer/insert-page-break)
(insert "\n")
(insert (make-string left-margin ?\ ))
(insert-image spec)
(insert "\n\n")
(insert (make-string (max 0 (floor (/ (- spacemacs-buffer--banner-length
(+ (length title) 1)) 2))) ?\ ))
(insert (format "%s\n\n" title)))))

(defun spacemacs-buffer//inject-version (&optional insert-distro)
(defun spacemacs-buffer//inject-version ()
"Inject the current version of spacemacs in the first line of the
buffer, right justified."
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
(save-excursion
(let* ((maxcol spacemacs-buffer--banner-length)
(lhs (format "(emacs-%s)" emacs-version))
(rhs (if insert-distro
(format "(%s-%s)"
dotspacemacs-distribution
spacemacs-version)
(format "(%s)" spacemacs-version)))
(len (- maxcol (length lhs)))
(buffer-read-only nil))
(let ((maxcol spacemacs-buffer--banner-length)
(version (format "%s@%s (%s)"
spacemacs-version
emacs-version
dotspacemacs-distribution))
(buffer-read-only nil))
(goto-char (point-min))
(delete-region (point) (progn (end-of-line) (point)))
(insert (format
(format "%%s%%%ds" len)
lhs rhs))))))
(insert (format (format "%%%ds" maxcol) version))))))

(defun spacemacs-buffer//insert-footer ()
(save-excursion
Expand All @@ -214,6 +209,7 @@ buffer, right justified."
(when (or badge heart)
(goto-char (point-max))
(spacemacs-buffer/insert-page-break)
(insert "\n")
(when badge
(insert (make-string (floor (/ (- maxcol badge-size) 2)) ?\ ))
(insert-image badge))
Expand Down Expand Up @@ -374,7 +370,7 @@ The message is always displayed. "

(defun spacemacs-buffer/insert-page-break ()
"Insert a page break line in spacemacs buffer."
(spacemacs-buffer/append "\n\n\n"))
(spacemacs-buffer/append "\n\n"))

(defun spacemacs-buffer/append (msg &optional messagebuf)
"Append MSG to spacemacs buffer. If MESSAGEBUF is not nil then MSG is
Expand Down

0 comments on commit 627e934

Please sign in to comment.