Skip to content

Instantly share code, notes, and snippets.

@jordonbiondo
Last active December 18, 2015 08:00
Show Gist options
  • Save jordonbiondo/5751061 to your computer and use it in GitHub Desktop.
Save jordonbiondo/5751061 to your computer and use it in GitHub Desktop.
yell
(defun yell/message(message &optional foreground background time)
"Yell MESSAGE at the user.
Deletes all windows and displays MESSAGE in large text in the entire frame. After TIME
seconds, the window configuration is returned to its previous state.
If FOREGROUND is non-nil it specifies the foreground color of the message, default is red
If BACKGROUND is non-nil it specifies the background color of the message."
(lexical-let
((old-config (current-window-configuration))
(old-bg (face-background 'default))
(foreground (if foreground foreground "red"))
(background (if background background (face-background 'default)))
(time (if time time 1))
(yell-buffer (generate-new-buffer (generate-new-buffer-name ":yell"))))
(delete-other-windows)
(switch-to-buffer yell-buffer)
(set-face-background 'default background)
(insert (propertize (concat "\n" message "\n")
'face `(:foreground ,foreground
:height ,(* 25 (face-attribute 'default :height)))))
(run-with-timer time nil
(lambda()
(set-face-background 'default old-bg)
(set-window-configuration old-config)
(kill-buffer yell-buffer)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment