Skip to content

Commit

Permalink
show the tips after the init sequence has completed
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed May 16, 2012
1 parent 6fedc0e commit 026dc56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions init.el
Expand Up @@ -75,7 +75,8 @@ ELPA (or MELPA).")

(message "Prelude is ready to do thy bidding, Master %s!" (getenv "USER"))

;; greet the use with some useful tip
(prelude-tip-of-the-day)
(prelude-eval-after-init
;; greet the use with some useful tip
(run-at-time 5 nil 'prelude-tip-of-the-day))

;;; init.el ends here
9 changes: 9 additions & 0 deletions prelude/prelude-core.el
Expand Up @@ -381,5 +381,14 @@ and so on."
(interactive)
(message (concat "Prelude tip: " (nth (random (length prelude-tips)) prelude-tips))))

(defun prelude-eval-after-init (form)
"Add `(lambda () FORM)' to `after-init-hook'.
If Emacs has already finished initialization, also eval FORM immediately."
(let ((func (list 'lambda nil form)))
(add-hook 'after-init-hook func)
(when after-init-time
(eval form))))

(provide 'prelude-core)
;;; prelude-core.el ends here

0 comments on commit 026dc56

Please sign in to comment.