I get a lot of email at work and at home and I’m always deleting sections and inlining responses so I decided that I needed a key binding in XEmacs to do that work for me. Thanks to my growing familiarity with Scheme, writing elisp doesn’t seem so bad (well, as long as I have the XEmacs Lisp Reference Manual handy).

It’s ugly but it works and it’s my first useful creation in Lisp/Scheme:

(defun region-is-active ()           ;; stolen from eparker's dot file
  (if (string-match "XEmacs" emacs-version)
      (region-exists-p)  mark-active) ) 

(defun whack () "text killer, region, to sig, or next paragraph"
       (interactive)
       (let ((start (point)))
         (cond 
          ((region-is-active) (delete-region (point) (mark)))
          ((re-search-forward "^--" nil t) 
            (forward-line -1) (delete-region start (point)))
          (t (forward-paragraph) (delete-region start (point)))))
       (insert "    [snip]\n\n\n")
       (forward-line -1))

(global-set-key (kbd "C-x !") 'whack)