Hi Cris,

On Thu, Dec 20, 2001 at 04:58:35PM -0800, Chris Seberino wrote:
> I fell in love with Emacs 

I understand that.

> and wanted to know how to better use Emacs & Mutt together.

Right.  I asked myself the same question when I began using Mutt a
month ago (after having used Emacs for five years).

> Is there any virtue in running Mutt from within Emacs?

Yes there is!  Is is easier to share text data between buffers than
between X windows.  And you do not need to switch windows, just
buffers.  Emacs lovers love switching buffers and hate switching
windows ;-)  In my opinion, any other way of using Emacs as Mutt's
editor is just lame.

> What is the best way to do this???? I tried M-x shell
> and launching Mutt from a shell in Emacs but that
> was all messed up. Any suggestions?

Yep.  Shell-mode is for teletype-like interaction only.  If you want
screen-oriented interaction (required by Elm, Pine, Mutt, etc.), there
is another solution: terminal mode.  In Emacs, type ``M-x term'' to
start it.  You will then be asked which program to run.  Just enter
``mutt''.  Emacs wizards will know how to customize this.

I've been running Mutt like this for 2 weeks now, and it works quite
nicely.  If you haven't used terminal mode before, you need to get used
to a few quirks.  The biggest one: All commands starting C-x are gone.
To use them, you must prefix C-c, so instead of typing C-x b for
switching buffers you now have to type C-c C-x b to get out of the
*terminal* buffer.  Or use a pointing device to pull down a menu.

One more quirk: terminal-mode does not implement transparency in any
way, so you cannot use color setting like this one in ~/.muttrc:
color error brightred default
Mutt will justly complain if you do.  I replaced all occurrences of
``default'' by ``white'', and it looks quite decent now.

Everything else works like you would expect it.  Even before I found
out about terminal mode, I set my editor variable in ~/.muttrc thus:
set editor="emacsclient --alternate-editor vi"
For this to work, you should have a line in your ~/.emacs reading,
(server-start)
so that Emacs is ready to receive requests from emacsclient.  This will
open up a new buffer.  When you're running Mutt within Emacs, the
*terminal* buffer goes into the background while you edit your message
(like you would expect).  For editing Mutt messages in Emacs, I highly
recommend post mode (post.el) available from
http://astro.utoronto.ca/~reid/mutt/
When using post mode, you just hit C-c C-c when you're ready to send
your message.  This will usually take you right back to the *terminal*
buffer where Mutt is waiting for you.

If emacsclient cannot connect to a running Emacs, the stuff after
--alternative-editor is invoked.  If you really hate vi (which stands
for vim on my system), you might want to launch a textmode Emacs if no
Emacs is up.  In this case, try:
set editor="emacsclient --alternate-editor emacs -nw"

Sometimes I want to use Emacs as a pager.  For this purpose, I came up
with this awkward macro that temporarily sets the pager to emacsclient,
then displays a message, then unsets the pager to use the built-in
pager again (assuming that's what you usually do):

macro index \cv "<enter-command>set pager=emacsclient\n<display-message>\
  <enter-command>unset pager\n" "display message in emacsclient"

Maybe I would always use Emacs as the pager but it's kind of weird to
read emails in post mode.  How can I tell Emacs to use some kind of
rmail-mode for reading, and post mode for editing only?

There's one more thing I should mention: I'm using GNU Emacs 20.7 on
Linux 2.4.4.  I quickly tried to run Mutt within GNU Emacs 21.0 but
there was more severe trouble with colors (status bar and help bar
invisible).  If someone has a solution for Emacs 21, please report it
here!

Cheers,
Cristian


-- 

}{  Cristian Pietsch
}{  http://www.interling.de

Attachment: msg21810/pgp00000.pgp
Description: PGP signature

Reply via email to