 (defvar spacemacs-buffer--fresh-install
   (not (file-exists-p dotspacemacs-filepath))
   "Non-nil if this Emacs instance if a fresh install.")
+
+(defvar spacemacs-buffer--buttons-position nil
+  "Offset in characters between the edge of the screen and the beginning of the
+ home buffer buttons. Do not set this variable.")
 
 (defvar spacemacs-buffer-mode-map
   (let ((map (make-sparse-keymap)))

                   :mouse-face 'highlight
                   :follow-link "\C-m"
                   (propertize "Update Spacemacs" 'face 'font-lock-keyword-face))
    (spacemacs-buffer//center-line)
    (insert "\n")
    (widget-create 'push-button
                   :help-echo "Update all ELPA packages to the latest versions."

                  (when (spacemacs-buffer//insert-file-list
                         "Projects:"
                         (spacemacs//subseq (projectile-relevant-known-projects)
                                            0 list-size))
                    (spacemacs//insert--shortcut "p" "Projects:")
                    (insert list-separator)))))) dotspacemacs-startup-lists)))

(defun spacemacs-buffer//get-buffer-width ()
  (save-excursion
    (goto-char 0)
    (let ((current-max 0))
      (while (not (eobp))
        (let ((line-length (- (line-end-position) (line-beginning-position))))
          (if (< current-max line-length)
              (setq current-max line-length)))
        (forward-line 1))
      current-max)))

(defun spacemacs-buffer//center-startupify-lists ()
  (let* ((lists-width (spacemacs-buffer//get-buffer-width))
         (margin (max 0 (- spacemacs-buffer--buttons-position
                           spacemacs-buffer-buttons-startup-lists-offset)))
         (final-padding (if (< spacemacs-buffer--banner-length (+ margin lists-width))
                            (max 0 (floor (/ (- spacemacs-buffer--banner-length lists-width) 2)))
                          margin)))
    (goto-char 0)
    (while (not (eobp))
      (line-beginning-position)
      (insert (make-string final-padding ?\ ))
      (forward-line))))

(defun spacemacs-buffer/insert-startupify-lists ()
  (interactive)
  (with-current-buffer (get-buffer spacemacs-buffer-name)
    (let ((buffer-read-only nil))
      (goto-char (point-max))
      (spacemacs-buffer/insert-page-break)
      (insert "\n")
      (save-restriction
        (narrow-to-region (point) (point))
        (spacemacs-buffer//do-insert-startupify-lists)
        (spacemacs-buffer//center-startupify-lists)))))

(defun spacemacs-buffer/goto-link-line ()
  "Set point to the beginning of the link line."
