Skip to content

Commit

Permalink
Show warnings in home buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBB authored and syl20bnr committed Oct 19, 2016
1 parent b3ad5ee commit dd8d70c
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions core/core-spacemacs-buffer.el
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,15 @@ The message is displayed only if `init-file-debug' is non nil."
(when init-file-debug
(message "(Spacemacs) %s" (apply 'format msg args))))

(defvar spacemacs-buffer--warnings nil
"List of warnings during startup.")

(defun spacemacs-buffer/warning (msg &rest args)
"Display MSG as a warning message but in buffer `*Messages*'.
The message is always displayed. "
(message "(Spacemacs) Warning: %s" (apply 'format msg args)))
(let ((msg (apply 'format msg args)))
(message "(Spacemacs) Warning: %s" msg)
(add-to-list 'spacemacs-buffer--warnings msg 'append)))

(defun spacemacs-buffer/insert-page-break ()
"Insert a page break line in spacemacs buffer."
Expand Down Expand Up @@ -670,6 +675,22 @@ border."
(spacemacs-buffer//center-line)
(insert "\n\n"))

(defun spacemacs-buffer//insert-string-list (list-display-name list)
(when (car list)
(insert list-display-name)
(mapc (lambda (el)
(insert
"\n"
(with-temp-buffer
(insert el)
(fill-paragraph)
(goto-char (point-min))
(insert " - ")
(while (= 0 (forward-line))
(insert " "))
(buffer-string))))
list)))

(defun spacemacs-buffer//insert-file-list (list-display-name list)
(when (car list)
(insert list-display-name)
Expand Down Expand Up @@ -811,6 +832,12 @@ list. Return entire list if `END' is omitted."
(or (cdr-safe els)
spacemacs-buffer-startup-lists-length)))
(cond
((eq el 'warnings)
(when (spacemacs-buffer//insert-string-list
"Warnings:"
spacemacs-buffer--warnings)
(spacemacs//insert--shortcut "w" "Warnings:")
(insert list-separator)))
((eq el 'recents)
(recentf-mode)
(when (spacemacs-buffer//insert-file-list
Expand Down Expand Up @@ -850,7 +877,10 @@ list. Return entire list if `END' is omitted."
(spacemacs//subseq (projectile-relevant-known-projects)
0 list-size))
(spacemacs//insert--shortcut "p" "Projects:")
(insert list-separator)))))) dotspacemacs-startup-lists)))
(insert list-separator))))))
(append
'(warnings)
dotspacemacs-startup-lists))))

(defun spacemacs-buffer//get-buffer-width ()
(save-excursion
Expand Down

0 comments on commit dd8d70c

Please sign in to comment.