Official website for Linux User & Developer
FOLLOW US ON:
Nov
16

Emacs in the real world – part 3

by Richard Smedley

Forget Perl’s claims, Emacs really is the Swiss Army chainsaw of the *NIX world. Join Richard Smedley for the conclusion of his three-part series, this time exploring how you can live your life online and do it faster and better with Emacs…

This article originally appeared in issue 93 of Linux User & Developer magazine.Emacs in the real world - part 3 Subscribe and save more than 30% and receive our exclusive money back guarantee – click here to find out more.

Over the past couple of months we’ve been running a series of articles to demonstrate how you can do most of your day-to-day tasks without leaving Emacs. Click to read the introduction to Emacs in the real world here, and part 2 here

A quick shortcut to Emacs enlightenment…
For brevity we’re writing C-x C-s to mean simultaneously press the Ctrl and X keys, release, then simultaneously press the Ctrl and S keys (this saves the file in the current buffer).
M-! means press the Meta and ! keys – Alt represents Meta on most modern keyboards. You can also press and release Esc, then press !. Oh yes, and as ! is Shift+1 on most keyboards, that’s a bit more stretching!
Start Emacs and type C-h t. This will bring you into the excellent interactive beginners’ tutorial. Run through it, then use your newfound knowledge on  a couple of your documents. Print out one of the many crib sheets for Emacs keystrokes available on the web, then join us on these pages to join the wired world from the world’s most flexible text editor.

Resources – what you’ll need for this tutorial
Emacs23 contains much of the additional software.
w3m-el-snapshot – in Debian and Ubuntu you need the snapshot package of W3M-el. Other distros vary. You’ll have no problems if you compile according to the instructions here
emacs-oauth enables authentication for client apps – now mandatory for Twitter apps

We’re online all the time and the information just keeps pouring in. You get emails for work and leisure, mailing lists for projects to which you contribute, tons of spam of course, plus the near-spam sent by organisations who gather your email address every time you buy something. Add to this microblog posts (Twitter, Identi.ca, Facebook status updates), RSS feeds, instant messages and IRC, and good old-fashioned newsgroups, and there’s a lot to keep up with.

Swapping between apps to monitor these channels adds to the time spent. If you’ve followed these tutorials and are finding Emacs useful, you’ll be glad to know that you can do it all from Emacs and benefit from some of the best tools for handling all these messages – such as Gnus – into the bargain.

As always, we can only whet your appetite here, so please take your time and try out what’s on offer. Once you’re this far down the road there’s almost no turning back – just relax and enjoy the power at your fingertips. Anyone who went to university in the 1980s or early 1990s is likely to have had their first email account on a big UNIX machine, accessed through a green-screen serial terminal. The mail client was Pine or Elm. Perhaps you were glad to leave that behind and love your current GUI email, whether Thunderbird, Evolution, Outlook or even Lotus Notes.

Nevertheless, many of our readers use Mutt, a powerful evolution of Pine. Its speed and ease of use outclass GUI solutions in the same way that many of Emacs’ features leave GUI IDEs (integrated development environments) behind for many coders. However, Mutt is a standalone program, designed to do one thing well: handling email. It doesn’t even have a text editor. Nor
does it fetch mail, leaving that to the dedicated app of your choice – usually Fetchmail on GNU/Linux systems.

It’s very hard to shake Mutt users away from their favoured client – you’ll see them ssh-ing to their server and reading emails in Mutt on smartphones, rather than the cumbersome apps presented by Android et al. However it’s easy to use Emacs as Mutt’s default editor, and get Emacs to see all files whose name contains ‘mutt’ to be in mail-mode.

Add the following to ~/.emacs

(server-start)
(add-to-list ‘auto-mode-alist ‘(“/mutt” . mail-mode))

and to ~/.muttrc

set editor=emacsclient
set pager=emacsclient

Rmail
Emacs does come with a simple default mail mode, called Rmail. Some users, faced with so many powerful alternative email clients in Emacs, are a bit sniffy about Rmail, but it’s actually quite good enough for many purposes, and it is able to handle multiple accounts and remote inboxes.

Emacs can fetch your mail for you, but seems to lose all multitasking abilities while engaged in this task so, like Mutt, is best used with the ever-helpful Fetchmail utility. Rmail is started, predictably enough, with:

M-x rmail

and will pull mail from the local spool and place it in ~/rmail, or wherever it’s been pointed by:

rmail-file-name

Reading mail and scrolling between messages is easy (h brings up a summary window, n and p take you back and forward through the list). Pressing ‘a’ while viewing a message allows you to mark it with (comma-separated) tags. ‘l’ gives you a view of tagged mails.

One nifty feature is:

M-x undigestify-rmail-message

which takes a mailing list digest and splits it into individual messages – useful if you want to reply properly to one of the messages.

Continue to page 2

You might also like:
Emacs in the real world – part 1
Emacs in the real world – part 2
Linux User homepage

twitter follow us
Pages: 1 2 3
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.
    • chaudhry anwar

      I have learned perl.. and I’ve learned how emacs works.. considering i’ll have to learn elisp to extend it, and vi allows perl to extend it.. I am going to choose perl until the time when I have enough free hours for fishing..

    • chaudhry anwar

      i am in love with the concepts of an emacs operating system.. a paradise for command-line geeks, and a powerhorse for the rest of us.. I just hope it was not so “CLOSED” w.r.t. the languages it supports for writing extension modules.. where is free here.. its free but its shitty hard to extend it unless one spends hours learning one particular language! it’s about time they thought about that and release a 2.0 release of emacs!

    • http://www.turkirc.com mirc

      I got what you intend, appreciate it for posting .Woh I am thankful to find this website through google…