48

There are all sorts of advantages to using Emacs, but for someone comfortable with the usual Win32 applications it comes with a wall-like learning curve. With most other editors it’s possible to just start using them and then learn about their other features and enhancements as you go along.

How to just get on with using Emacs straight away, with the aim of reaching that point where you actually prefer to use Emacs over other editors or applications?

Edit - To try and clarify the question: I’ve done the tutorial, read some docs, etc. then soon after when I’ve wanted to quickly edit some text it’s been easier to just use another editor, that I already know. What do I need to do so that not only I don’t just go for another easier editor, but that I actually prefer to use Emacs, and how to get here as quickly as possible? What if any are the training wheels for Emacs?

2
  • As a follow-up I've posted an example of when I've found it easier to just go back to using another editor which I already know stackoverflow.com/questions/270930/…
    – Rob Kam
    Nov 7, 2008 at 1:19
  • Personally, I said "I'm going to use this for a week, no matter what." I spent a couple of hours doing the tutorial to get to grips with the basic editing commands and then made myself use it for a week, searching for how to do something if I needed to. I've been using it for about 2 years now as my main editor every day in my job as well as at home. The bonus was when I realised I could use emacs commands in bash too!
    – mouckatron
    Nov 6, 2017 at 17:39

10 Answers 10

44

The biggest thing about learning how to use Emacs is ... (drumroll please) learning how to use Emacs.

Okay, okay, okay. It's a silly answer, and it's a tautology, but it's true. If you start up Emacs, and think to yourself "How could I find every instance of the word 'foobar' in my source tree?" the worst thing you could do is hit Alt + Tab and visit Google.

Seriously.

Learning the help system and how it works is the best thing you can do. It's so nice to just hit C-h a find, and suddenly get all the information you need, right at your fingertips.

The next best thing you could do is install a wonderful little package called Icicles which has some seriously groovy completion functions. After you get it installed, just know that anytime the minibuffer is asking for some kind of input, you can now use regular expressions.

How would this apply to finding every file in your source tree? Well, you'd hit M-x, and then type "find". After that, you could hit (for instance) Shift + Tab and Icicles would kick in, finding every command that prefixes with "find". Alternatively, you could do M-x .find. and it would give you any command with find in it.

Build a cheat sheet. Just keep a saved buffer somewhere that has all of the keyboard shortcuts you use frequently in it. Remove the ones that you know off by heart, and pick up new ones. In most cases when you do a M-x command, the message buffer will tell you what the keyboard shortcut was for that command (if there was one).

Learn. Keyboard. Macros.

Learn. Emacs. Lisp.

Steven Huwig's idea of using some killer applications is a good one. Emacs is easier to use when you want to use it. For me, it was Planner Mode. (I've just moved to Org-mode, and it's even better.)

7
  • 2
    Marked as correct answer for suggesting emacswiki.org/emacs/Icicles
    – Rob Kam
    Dec 26, 2008 at 18:56
  • 4
    +1, but C-h c maps to describe-key, which isn't what you meant I don't think when you said "C-h c find". "C-h a find" maybe?
    – Carl Meyer
    Jun 2, 2009 at 17:09
  • Good advice (learning the help system, creating a cheatsheet - in emacs!) +1.
    – jkp
    Oct 19, 2010 at 8:53
  • 1
    See, in particular, this page about using Icicles to help you learn Emacs: EmacsNewbieWithIcicles.
    – Drew
    Nov 16, 2011 at 6:13
  • This answer is from 2008. Curious, do people still use Icicles, or is helm now considered better? Sep 2, 2015 at 15:54
17
  • spend 20 minutes running the tutorial

    ctrl-h t

That will get you to the point where you can be productive (and that "meta" key that you will read about is probably either Escape or alt).

1
14

I think it is easiest to find a "killer app" or two that just works best in Emacs. For me, it was the SQL editing and interaction mode for Oracle. Once you're already using Emacs for this killer app, then it will be more attractive to just open up other documents in Emacs rather than another editor.

Potential killer apps:

1
  • 2
    For me, its shell-mode. This since on my work-laptop XP explorer.exe continually hangs for unknown reasons. Sometimes it brings the machine to a total halt. Emacs does not.
    – sandos
    Feb 18, 2010 at 12:39
9

Learning to use Emacs effectively is inherently a slow process, but it's worth it.

Set up a .emacs file right away. You'll want to customize it quite a bit. It sounds silly, but having some kind of source control on that file will help, too.

To make it easier to find out about Emacs' innards, add to your .emacs:

(defalias 'ap 'apropos)

Then when you want to see if there's a command to do "something", type "[Alt-x] ap [enter] something [enter]". Emacs has its own name for stuff, so it can be hard to find things sometimes ("yank"? Seriously? Call it "cut" like everyone else!)

"[Ctrl-h f] function-name [enter]" looks up the help for that function.

"[Ctrl-h m]" shows you details about the current mode, like the keybindings specific to that mode.

Learn to use Ctrl-s and Ctrl-r for incremental search. All text editors need to come with this feature.

Add keybindings to your .emacs like:

(define-key global-map (kbd "M-z") 'redo)
(define-key global-map (kbd "C-z") 'undo)

Get the redo.el package to make Emacs' redo suck less.

iswitchb-mode is invaluable. It lets you have dozens of buffers open at once and switch between them in a blink of an eye. Set up iswitchb and add to your .emacs:

(iswitchb-mode)
(define-key global-map (kbd "M-RET") 'iswitchb-buffer)

To evaluate an emacs-lisp expression, type the expression into a buffer, put the cursor just after it, and type "[Ctrl-x Ctrl-e]". This lets you experiment with different customizations easily.

Remember, you don't have to let go of ctrl when typing a sequence like that.

See where a string occurs in a buffer with the "occur" function. Here are some handy functions and keybindings for that:


(defun word-at-point ()
  (thing-at-point 'word)
  )

(defun word-at-point-or-selection ()
  (if mark-active
    (regexp-quote (buffer-substring (mark) (point)))
    (concat "\\")
    )
  )

(defun find-word-at-point ()
  (interactive)
  (occur (word-at-point-or-selection))
  )

(define-key global-map (kbd "C-o") 'find-word-at-point)

(define-key isearch-mode-map (kbd "C-o")
  (lambda ()
    (interactive)
    (let ((case-fold-search isearch-case-fold-search))
      (occur (if isearch-regexp isearch-string
               (regexp-quote isearch-string))))))
3
  • 1
    "yank" means paste, not cut. The main problem is that Emacs is so old that it predates many of the terms used to describe GUIs.
    – cjm
    Nov 6, 2008 at 22:19
  • 1
    Ah, right. See? I use it every day and can't even remember that, because it...makes...no...sense :) The kill-ring is really handy, though. But again, kill/yank vs cut/paste? Emacs-specific terminology like that makes it hard to find what you want in the help files, sometimes. Nov 6, 2008 at 22:43
  • Something's wrong with the definition of word-at-point-or-selection.
    – Yoo
    Aug 10, 2009 at 11:38
5

My ideas on how to come up to speed faster:

  1. Find another Emacs user and watch them a few minutes every day
  2. Have the Emacs user watch you (and provide feedback)
  3. Find more Emacs users and repeat steps 1&2
  4. Subscribe to the planet emacsen feed to see what other Emacs folks are learning
  5. Follow the emacs tip of the day twitter
  6. Try to answer folks Emacs questions on SO

I've been using Emacs for 15+ years and I learn a new thing every day by doing the things above.

4

Like @Claudiu said, just use it. Just bumble through and let your needs drive your learning curve.

Eventually you will get to a point where you "know enough to be dangerous", while not really mastering the environment. That's OK. Because at this point you'll likely be quite productive. You'll have the basic skills and tools.

In time, you'll run in to things that you do every day that you're simply sick enough of to try and take the time to find a "better way". Normally, your base skill set is enough to get by, enough that the (potentially unknown) time invested in to some alternate path isn't worth the cost, especially for something rare.

But, you may have free time, or the task might be big enough to justify looking deeper.

At these points you'll become more of an expert Emacs person than a journeyman user.

While I personally no longer use Emacs (instead relying on an IDE), I will say that while Emacs is quite complex, you need only know a small subset to make it useful and fun. I will also say that I've never "screamed at Emacs", whereas I scream at my IDE all the time. Yes, Emacs was doing less than what my IDE was doing, but I am seriously getting to the point that it might be worth my time to go back to it, and stop the screaming.

I just get this sense that Emacs is more "deterministic" than my IDE which likes to go traipsing off in to lala land every now and then, or require a restart, or whatever.

I've never personally crashed Emacs (which some will say means I'm not using it hard enough...)

2

Basic text editing with emacs is no more complicated than doing the same with Notepad. Just use it like it's notepad, but as you explore the menus, take note of the keyboard shortucts. Slowly you'll start to pick up things. When you want to do something and you don't know how, there's help available as a pulldown from menus, just like with other editors.

I guess the only "trick" I'd suggest is that after you open up a file for editing, try ctrl-h m to pull up a list of the keyboard bindings that work in that buffer's mode.

1
  • 1
    This is the best answer for those of us who don't want to go through a ~45 minute tutorial
    – aks
    Feb 12, 2018 at 13:45
1

My advice is:

  • Learn the very basics (how to type, save a document, turn on syntax highlighting, maybe copy and paste). You can look up how to do these online (google "emacs tutorial" maybe)
  • Start using it.

Whenever you wish you knew how to do something, then look up how to do it. You might have to look the same thing up 3-4 times before you get it, but then you will learn it.

Keep doing this. It'll be annoying at first, but then you'll get used to it, and then you might even enjoy using it!

(DISCLAIMER: Personally I just use another editor).

1
  • 1
    Just using another editor is what I was trying to avoid. It's what I've done before each time when trying to learn Emacs and it's what I've done again this time. It's just too easy to go back to an editor that I'm used to, which does almost everything I need with ease.
    – Rob Kam
    Dec 26, 2008 at 20:30
1

Turn on icomplete-mode and you will often see functions that look useful when poking around.

(icomplete-mode t)

In your .emacs file.

C-h f will let you look up the docstring for a function, and C-h v will do the same for a variable. With icomplete, this is great for exploring.

1
  1. As you learn basics like key commands, make your own cheat sheet. Of course find and plunder existing cheat sheets, but be sure to make your own and categorise the shortcuts / key bindings to groups that make sense to you. This will help you learn the basics and retain the memory.

  2. Aim to customize Emacs into the editor you want, this is the single biggest advantage to using Emacs, and it will help you learn about all it's features and how it's extended.

  3. Be glad that, relatively speaking, learning Emacs is much easier thanks to the community here on SO and other places like EmacsWiki. :)

  4. Work from this point onward... a) Key bindings and customize. b) Macros and the macro editor. c) Elisp and your own custom libraries.

It's also worth noting that setting Emacs up to work like a more modern App, can be painful, you will need to do things like run the emacs server, and use the emacs client.

Thankfully (re: 3) there is a lot of help available on the net, but if you have direct access to a seasoned Emacs user, consider yourself lucky.

Not the answer you're looking for? Browse other questions tagged or ask your own question.