I'm pretty sure Strong Bad Email needs no introduction.
A while ago I thought it would be cool to make my Gnus delete email like Strong Bad's 386, with a big, white-on-blue DELETED!!!! in the middle of the display.
This is simple enough to do, with a little use of Emacs Lisp advice:
(defadvice gnus-summary-delete-article (around compyify-deletion activate) "Ensure that article deletion always looks like Strong Bad's Compy 386." (with-compy-deleted-display (sit-for 1) ad-do-it))
Basically, this code wraps the normal functionality of
gnus-summary-delete-article within a call to
with-compy-deleted-display. The easy part is over;
the hard part is writing
with-compy-deleted-display. Here's what I came up
with at the time. It's not the best example of good Emacs Lisp
code, but it gets the job done.
(defmacro with-compy-deleted-display (&rest body) "Execute forms in BODY while displaying a 'DELETED!!' buffer. Just like on Strong Bad's Compy 386. BA-LEETED!" `(save-window-excursion (let ((old-buf (current-buffer))) (with-temp-buffer (setq mode-line-format nil indicate-empty-lines nil) (let ((bg (face-background 'default)) (fg (face-foreground 'default))) (unwind-protect (progn (set-face-background 'default "Medium Blue") (set-face-foreground 'default "White") (ted-insert-centered-line "DELETED!!!") (message "") (delete-other-windows) (switch-to-buffer (current-buffer)) (recenter) (with-current-buffer old-buf ,@body)) (set-face-background 'default bg) (set-face-foreground 'default fg)))))))
This depends on the function
ted-insert-centered-line, which inserts a line of
text so that it's horizontally and vertically centered in a
window. Here it is:
(defun ted-insert-centered-line (line) "Insert LINE into the current buffer. Will also insert the necessary number of spaces and newlines to center LINE in the window." (let ((lines (make-string (/ (frame-height) 2) ?\n)) (spaces (make-string (- (/ (frame-width) 2) (/ (length line) 2)) ?\s))) (insert lines spaces line)))
In order to get the body of my advice to indent properly, I did this:
(put 'with-compy-deleted-display 'lisp-indent-function 0)