Official website for Linux User & Developer

Emacs in the real world – part 1

by Richard Smedley

Forget Perl’s claims, Emacs really is the Swiss Army chainsaw of the *NIX world. Join Richard Smedley on the first of a three-part series revealing how you can do most of your day-to-day tasks without leaving Emacs – even if programming is a small or non-existent part of your typical day…

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

Emacs in the real world - part 1You can find part 2 of this series here…

Yes, Emacs is a programmer’s editor. Yes, it comes from a 1960s command-line world. Yes, it’s not easy to start using, as one must adapt to new concepts and ridiculous key-stroke combinations. Yes it’s Anglocentric in menus and doesn’t really do right-to-left languages. But there must be an upside, right? Yes, once through the pain barrier – say a week of editing, and adding in other operations through Emacs – you’ll find the power is addictive.

In the first part of the series we’ll introduce some of the Emacs concepts you need to get you started, but also take a brief look at music and games. The main focus has to be on editing, just to get comfortable with the interface. Stick with it for the next few weeks because in the next part we will concentrate on organisation, with Emacs making a great project management tool, and PIM, as well as adding a bit more customisation. And in the final part we’ll look at everything internet, from email to updating your status on social networks, and point you to info on how to take things further.

Swiss Army chainsaw?
The UNIX way is small, specialised programs that do one job well, glued together to form a system that can easily be maintained. Emacs is a 500lb gorilla of a text editor that takes on many operating systems in functionality. This is because of its origins not within UNIX, but MIT’s Artificial Intelligence Lab, where Lisp machines used that language to modify themselves on the fly. Richard M Stallman coded the original Emacs – Editor MACroS – for the TECO line editor there in the 1970s with Guy Steele Jr, and rewrote it as GNU Emacs when he started the GNU project in the 1980s. Parts of the app, and even the config files, are written in the Elisp dialect of Lisp.

Required Resources
Emacs23 should be in your OS’s repository. Older versions can be extended to do almost everything we cover here
EMMS is available from here
.emacs customisation can be found here and many other places

For brevity, in this article 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’ – don’t have a Meta key? You’re not alone; it’s been a while since they were common in the wild. Alt is used instead, but no one’s in any hurry to update the documentation. 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!

Modern keyboards leave the Ctrl key isolated in the bottom left-hand corner. Even switching it with the Caps Lock key still leaves it under your little finger, and heavy Emacs users can develop nasty RSI (repetitive strain injury).

emacs 1 Space-cadet

However, with a good keyboard, Alt and AltGr are equidistant from the centre, and swapping them with Ctrl means you can reach Ctrl with your thumbs while touch-typing. Better still, get an ergonomic keyboard, such as the Kinesis Contoured ones, which splits the keys between each hand and puts the modifier keys within easy reach of the thumbs. Other alternatives include chording keyboards or even foot or knee switches for Ctrl, Alt and Shift. A little extreme? Well, if you rely on typing all day to pay the rent, investing in your hands’ health is sensible.

Continue to page 2…

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.
    • Pingback: Linux User & Developer issue 91 is out now! | Linux User()

    • Steve Clark

      Nice article. I have been using emacs or uemacs since the ’80s. Didn’t know about the tramp feature. Just tried it out AWESOME.
      I’ve always heard it as Escape Meta Alt Control Shift !!!

    • Jim

      This doesn’t help my confusion.

    • Emacs is definitely THE editor. Swiss army knife. Best operating system. And all in one. I have my Emacs thoughts collected in my blog, under the category emacs. Check it out if you feel like it (some tips and tricks, AucTeX…).

      Some day I will write all uses I do for it… Today I almost converted one vi-er to emacser. I need a written document to do so :D


    • YHVH

      This article is badly out of date, I’m too annoyed to list the errors.

    • The advice to swap Alt and Ctrl are a no go for anyone using AltGr as a modifier for inputting national characters. Sadly.

    • Thanks for all the comments :)

      @YHVH I accept there are likely to be too many errors to list. Perhaps just a few of the worst would have been a helpful start? ;^)

      @yacoob true. I seriously think Crl & Meta pedals would be the ideal solution, but have yet to try it out :-)

      @Ruben great link. Thanks. Must get my kids to try out the Emacs-on-iPod-touch :)

      @Steve Thanks – I was late discovering tramp. Now it’s becoming indispensable.

      @Jim It’s a big topic, even to introduce. I can only recommend time, and a couple of definite goals – a couple of tasks that need accomplishing, and give yourself time to learn your way through doing it the Emacs way.
      – and don’t forget to print out a cheat sheet of keyboard short-cuts. You’ll soon save time over navigating menus :)

    • Pingback: Emacs in the real world – part 2 | Linux User()

    • Pingback: Emacs in the real world – part 3 | Linux User()

    • Lawrence D’Oliveiro

      If you can’t decide between menus and keystrokes, you can navigate the menus from the keyboard, too. Press alt-backquote to bring up the prompt, which will tell you how to proceed.