show the tips after the init sequence has completed

This commit is contained in:
Bozhidar Batsov 2012-05-16 14:50:30 +03:00
parent 6fedc0ec70
commit 026dc563d1
2 changed files with 12 additions and 2 deletions

View file

@ -75,7 +75,8 @@ ELPA (or MELPA).")
(message "Prelude is ready to do thy bidding, Master %s!" (getenv "USER"))
(prelude-eval-after-init
;; greet the use with some useful tip
(prelude-tip-of-the-day)
(run-at-time 5 nil 'prelude-tip-of-the-day))
;;; init.el ends here

View file

@ -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