post.el
Note: You are viewing an old revision of this page. View the current version.
An emacs mode for mutt
Update 7/16/01! I found a small bug in my post.el - C-cC-c didn't work to close the edit session if you weren't running gnuserv. The post.el on my web site contains this fix.
I use a combination of mutt and emacs to read my mail. One thing that really makes this work is the XEmacs gnuserv mechanism, where you can keep XEmacs running all the time and pop up new edit windows as needed. This really makes things speedy.
On a related note, I use a special emacs mode called post.el to edit my messages. This makes it very quick and easy - in mutt I choose 'm' to create a new message, and up pops a new XEmacs window for me to type in. I can compose my message and add attachments in that window. Then I push C-cC-c (that's <ctrl-C,ctrl-C. in emacs parlance) to save my work and return to mutt to send the message. If I use the word attach in my message, post mode asks if I want to attach anything. That's a handy reminder.
The official post.el site is Rob Reid's page. However, I have made several improvements to his script to make it work correctly with XEmacs. He has incorporated one of those fixes but forgot the other, so I suggest you get post.el from my ftp site.
- I suggest the following additions to your .emacs to use post.el
(require 'post)
;; Add an informative message when editing mail messages under post.el. ;; I should combine these cases more elegantly. (if (boundp 'running-xemacs)
(defadvice gnuserv-process-filter (after post-mode-message first activate)
"If the buffer is in post mode, overwrite the server-edit
message with a post-save-current-buffer-and-exit message."
(if (eq major-mode 'post-mode)
(message
(substitute-command-keys
"Type
describe-mode for help composing; \
post-save-current-buffer-and-exit when done."))));(else GNU Emacs (defadvice server-process-filter (after post-mode-message first activate)
"If the buffer is in post mode, overwrite the server-edit
message with a post-save-current-buffer-and-exit message."
(if (eq major-mode 'post-mode)
(message
(substitute-command-keys
"Type
describe-mode for help composing; \
post-save-current-buffer-and-exit when done.")))) ); Make sure we get moved to the message body when using gnuclient ; or emacsclient. (if (boundp 'running-xemacs)
(add-hook 'gnuserv-visit-hook
(function (lambda()
(cond ((string-match "Post" mode-name)
(post-goto-body))))))
;(else GNU Emacs (add-hook 'server-switch-hook
(function (lambda()
(cond ((string-match "Post" mode-name)
(post-goto-body))))))
)
;; Customize post mode a bit. (defun my-post-mode-hook ()
;Turn on abbrev mode ; (sort of a simple auto-correct for common mispellings). (setq abbrev-mode t) (read-abbrev-file (concat my-emacs-dir ".post_abbrev_defs")) (setq save-abbrevs t) ;Add a key binding for ispell-buffer. (local-set-key (kbd "C-c C-i") 'ispell-buffer) ;Put the cursor just where I want it - at the beginning of the body ;text. (post-goto-body) (beginning-of-line)
) (add-hook 'post-mode-hook 'my-post-mode-hook)