Emacs Send to Email Command

I’ve been using Emacs for nearly all my editing for a couple years now, and I’m getting more hungry for highly personalized customizations. I often need to email files I’m working on, so I wrote up this little command (Throw it in your .emacs):

(defun mail-current-buffer ()
  "Send the current buffer to email (for Mac)"
  (interactive)
  (shell-command (format "open -a Sparrow %s" (buffer-file-name))))
(define-key global-map "\C-cm" 'mail-current-buffer)

This opens a new message with the file in the current buffer attached. If you use another mail app, replace Sparrow with its name. The last line binds the function to C-c C-m. Really, this will open the current buffer in any application you choose to put in that command besides Sparrow, so perhaps you have some other handy ideas?

I guess the next step is just doing my email in Emacs.

Advertisements

About Zachary Wasserman

Currently working on www.tenayaconsulting.com
This entry was posted in Emacs and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s