
Start Using Emacs – A Thorough Guide for Beginners - nonrecursive
http://www.braveclojure.com/basic-emacs/
======
Matti
Emacs-related things I have learned recently:

* Sticky modifiers: I don't know why it took me so long for me to activate these. The difference between _holding_ Ctrl _while_ hitting another key or just _hitting_ Ctrl once before the next key makes a huge difference for me. [http://www.emacswiki.org/emacs/StickyModifiers](http://www.emacswiki.org/emacs/StickyModifiers)

* Got an old-styled Thinkpad keyboard with the trackpoint buttons below the spacebar? I mapped the left button to C-x and the right one to M-x. These buttons are PERFECT for this purpose. I would have mapped them system-wide to Ctrl and Alt but didn't find a solution for doing that in Debian (console/tty).

* Helm: Incremental completion and selection narrowing. Makes it a lot easier to find those commands which you sort-of-remember-the-name-of: [https://github.com/emacs-helm/helm](https://github.com/emacs-helm/helm)

* Sunrise Commander: MC-ish file explorer, based on Emacs's Dired: [http://www.emacswiki.org/emacs/Sunrise_Commander](http://www.emacswiki.org/emacs/Sunrise_Commander)

~~~
RBerenguel
I think you may also like key chord-mode:
[http://www.emacswiki.org/emacs/KeyChord](http://www.emacswiki.org/emacs/KeyChord)

~~~
sb
Seconded! Especially with magit (and I suppose with vc in general) key chords
are really nice.

------
rickdale
When I was in college I had the privilege to work on a project with a
developer that understood emacs as on operating system and used it as a way of
life. When we started the project he would yell at me whenever I took my hand
off the keyboard and tried to use the mouse. Finally he started to hit my hand
with a ruler when I would lift it up.

My emacs skills are still probably only 1% of his, but after working that
short time with him I have never been able to fully feel comfortable using
textmate or sublime text. I always come back to emacs, even though the
learning curve even years later is still there. Just feels like the right tool
to me.

~~~
rrmm
hah! I did this to people too. I ended up popping the keycaps of the arrows
off the keyboard and taping over the hole.

~~~
barbs
I don't know much about emacs, but that would be a good way to train yourself
to use vim :)

~~~
rwg
On the first day of my first CS class in college, the gruff old professor
passed around a stack of photocopied "VI TUTORIAL" papers. In the "MOVEMENT"
section, it had pictures of arrow keys, then X's hand-drawn over top of each
arrow key, and H J K L handwritten above their corresponding X'd out arrow
keys.

Gruff old professor explained that using H J K L was the True and Proper Way
and the arrow keys were a work of the Devil, so to make sure we were not
tempted by the Dark Lord of cursor motion, he had the department's system
administrator recompile vi on the department's (pathetically overworked) Sun
to remove support for the arrow keys.

 _(As an aside, if you 've never tried working interactively on a Unix box
whose load is higher than its CPU speed in MHz, you've really missed out.)_

Rather than get used to using H J K L, I spent that evening waiting for a new
vi executable to build in my home directory.

Laziness will find a way.

~~~
59nadir
> Rather than get used to using H J K L, I spent that evening waiting for a
> new vi executable to build in my home directory. >Laziness will find a way.

Doesn't sound like laziness as much as it sounds like the thinking of an
obstinate youngster who secretly is uneasy with learning new things.

------
kenrose
Great work with this tutorial! It's a nice intro guide to Emacs.

One thing I'd recommend adding in the introduction is that even though Emacs
can be daunting to learn in the beginning, the effort is worth it because it
will eventually become your editor for everything, not just Clojure.

Have to start programming in a different language? Emacs is there for you.
Want to write an e-mail message? Emacs is there for you. Want to keep a TODO
list or a calendar? Emacs is there for you.

This fact was lost on me when I first started with Emacs many years ago. I had
come from using "easier to use" editors like EditPlus and Visual Studio. After
trying to use Emacs for a week, I gave up in frustration and didn't touch it
for another year. I've been using Emacs for about 11 years since then and I
think I wouldn't have dropped it if I had been told "I know it seems hard now,
but it's extremely powerful and it can become your one program for everything,
on any platform you will ever use".

~~~
nonrecursive
Great feedback, thanks! I'll work it in.

------
jcurbo
I had tinkered with emacs over the years but mostly used vim for programming,
until the past year or so when I started writing Haskell and LaTeX for school
and put in a determined effort to use Emacs full time. I've found I like a
'regular' text editor more than vi's modes, and that (like rickdale's comment)
when I've tried out other editors like Textmate or Sublime Text, they feel
like they're missing something compared to the raw extensibility of Emacs.
(What that something is I'm not quite sure and - I just feel like if I want an
extensible editor, emacs is the best. Strong opinion weakly held I guess)

My advice to new users is to start simple and try to only add in
extensions/modifications when you hit pain points. I added some universally
useful/specific ones early on like AuCTeX, a solarized theme, turning on
syntax highlighting, haskell-mode, and so on, but I've found that piling on a
ton of plugins and getting away from the 'default' behavior makes it much
harder to create a comfortable workflow. This is also why I'm not a fan of
stuff like Prelude or emacs-starter-kit.

~~~
cgag
Interesting, I honestly was pretty confident no one who got used to modal
editing ever wanted to go back to crazy key chording.

~~~
Baalbetherim
I think it depends on what people are using their editor for whether they'll
jump ship. I started out on vim, and I really loved it. Then I was typing up
papers using the vim latex suite and syntax highlighting would cause my
machine to choke every time I scrolled through text. I could have just turned
off syntax highlighting, but I tried emacs and auctex, and it worked
wonderfully. Since then, I found a bunch of other things that I prefer about
it, and only really use vim for quick config file edits. Now that I've been
playing with it for a while, chords are second nature, just like modal editing
became for me with vim.

I imagine that nobody who's terribly accustomed to either editor will switch
unless they've got a specific need their current editor doesn't meet.

~~~
jcurbo
I had a similar experience, really. Do I want to use emacs to edit system
files and such? Not really, I'll continue to use vim. But for programming
projects and document writing I like emacs better. To be honest I think the
thing that started it was messing with Sublime Text; after using it for a few
weeks I started tinkering with emacs again and never looked back. I will say
that I never fully bought into vim in terms of movement keys and in depth
shortcuts; I pretty much used cursor keys and the mouse and didn't do anything
too advanced.

------
__david__
This is a great intro! I've been using Emacs since 1996 or so and I still
learned a new key: M-m, which will go in my lexicon immediately.

BTW, "M-g g" (goto-line) is also bound to "M-g M-g" which I find much easier
to type.

Another thing I discovered way too late about Emacs was the "q" key. When
you're in a read-only buffer like a diff, a man page, an Emacs help page, or
an info page, pressing "q" will bury the buffer and close the window (if it
wasn't open before the buffer appeared). I find this tremendously useful.

------
singular
> There are other options, like Aquamacs, which are supposed to make Emacs
> more "Mac-like", but they're problematic in the long run because they're set
> up so differently from standard Emacs that it's difficult to use the Emacs
> manual or follow along with tutorials.

Having used emacs on linux, windows and now mac I disagree with this - though
aquamacs introduces some (annoying, to me) functionality, you can simply turn
these off and it works just like emacs in any other environment.

I have found aquamacs works better with ansi-term + with full-screen
functionality than vanilla emacs, and I use both these functions enough to not
want to go back.

~~~
tazjin
When you say vanilla emacs, do you include the Cocoa version?
([http://emacsformacosx.com/](http://emacsformacosx.com/))

I'm using that many hours every day and have zero problems.

Regarding fullscreen, if you use a recent build both native and non-native
fullscreen are supported.

~~~
singular
Yes, I tried the cocoa version and that's what I'm referring to. I recall
having real issues in particular with ansi-term not having the environment
correctly set + simply not being able to resolve that.

I'm pretty sure I had other issues too, but I can't remember them.

To be fair, I've not tried the cocoa version or any other for some time, so
things may have changed.

However, I still think OP's point was unfair on aquamacs - other than some
(annoying!) quirks regarding autofonts and tabs (I instantly turn those off),
it's no different than emacs anywhere else, in my experience.

~~~
intranation
PATH, exec-path etc. are mangled because of the way OSX loads environment
variables. Here's an Emacs package that fixes that:

[https://github.com/purcell/exec-path-from-
shell](https://github.com/purcell/exec-path-from-shell)

------
michaelsbradley
As an Emacs beginner and budding Clojure programmer in early 2012, I benefited
greatly from Bozhidar Batsov's Emacs Prelude:

[https://github.com/bbatsov/prelude](https://github.com/bbatsov/prelude)

I highly recommend it, and have been very pleased to see it get better and
better over the past year+.

~~~
babarock
And you shouldn't miss Bozhidar's blog on Emacs
([http://emacsredux.com/](http://emacsredux.com/)) where he explains a lot of
the very cool techniques he included in Prelude.

------
outworlder
Finally an introduction that has screenshots which don't remind you of the
70's.

Fonts and color schemes do matter, specially nowadays with the likes of
Sublime and Textmate. Even more so for new users.

~~~
lord_quas
This is one of the most beautiful theme I've come across, and the one I am
currently using:

[https://github.com/jasonm23/emacs-purple-haze-
theme](https://github.com/jasonm23/emacs-purple-haze-theme)

~~~
terhechte
Interestingly, I use Soothe ([https://github.com/jasonm23/emacs-soothe-
theme](https://github.com/jasonm23/emacs-soothe-theme)) also by the same guy,
which is also one of the most beautiful themes to ever grace one of my
editors.

~~~
laichzeit0
Any reason why you guys chose these themes other than it looks nice? :)

Solarized seems to be the de facto theme these days. I always wanted a theme
that had some kind of "science" behind it. It also looks pretty good.

------
sb
I started using emacs about seven years ago after about eight years of
exclusively using vim, primarily because I wanted to see what the editor war's
were all about (and because I got the blues from work and needed something
uplifting...) I agree with the learning curve, and constantly am fine tuning
my setup and configuration, but once you've mastered the basics, it truly
becomes one of the most powerful editors. Plus it is constantly evolving
(e.g., multiple cursors).

Another good emacs guide that I came across recently is:

[http://m00natic.github.io/emacs/emacs-
wiki.html](http://m00natic.github.io/emacs/emacs-wiki.html)

Additional resources I found helpful:

[http://www.emacswiki.org/emacs/EmacsNiftyTricks](http://www.emacswiki.org/emacs/EmacsNiftyTricks)

[http://web.psung.name/emacstips/essential.html](http://web.psung.name/emacstips/essential.html)

Plus, check out the videos from Magnar Sveen's emacs rocks:

[http://emacsrocks.com](http://emacsrocks.com)

------
mmariani
After about a year developing a love/hate relationship with Vim I've finally
had enough. After reading this post I think I'm ready to make the switch. Very
good writing. Thanks for posting it.

~~~
AndreasFrom
I tend to switch back and forth between Vim and Emacs and am curious. What
causes the hate in your relationship with Vim?

~~~
mmariani
Vim is an excellent text editor. But I mostly use it for coding, and that's
the problem. Vim is not an IDE. It relies on plugins to deliver a half baked
IDE experience. Sometimes these plugins are broken and other times they refuse
to play nice with each other. As I sort of need them to get the job done I end
up wasting time fixing broken things instead of solving real problems. That's
why I'm ready to throw this tool away and move on. I might try Vim again in
the future when things are a little bit more stable. Anyhow, thanks for all
the fish.

~~~
tiziano88
Can Emacs replace eclim (eclipse + vim) as a Java IDE? Are there plugins that
can make editing Java in Emacs nicer and more productive?

------
andrewflnr
Irrespective of the merits of emacs itself, this feels like a nearly perfect
introductory tutorial. I've never seriousny used emacs, but this made me want
to go try it and made me feel like I would probably succeed. Good show,
whoever wrote this.

~~~
nonrecursive
Thank you!

------
asgard1024
I also recently started using Emacs. Not much progress in learning, yet,
though.

It would be nice if someone made a nice starting package that would set it up
more sanely for all the IDE-oriented people (basically take what modern IDE
can do out of the box and setup Emacs that way). Something similar to what
Ubuntu did for Linux. I have seen lots of personal configs on Github, and read
lots of Emacs Wiki on how to set this and that, but it's still quite a
struggle for me. Part of the struggle is that there are too many options
sometimes.

Maybe someone will have a good suggestion regarding this.

Edit: Someone mentioned Prelude, didn't know about it. That looks good, like
something I wanted.

~~~
goblinfoblin
The starter packages like prelude and emacs-starter-kit are more like a
learning to walk with a crutch when you have perfectly working legs. They
offer an easy way to start but once you start using them you'll find it hard
to do it the normal way (like when you need to modify your emacs config or add
some new elisp that isn't included).

It is better just to start emacs do C-h t and start learning, then add and
configure when needed. You'll need to start out rough but after a while you'll
learn how emacs works and be a better emacs user because of it.

Though if you don't invest in emacs and just need it to finish your thesis or
because a professor won't let you use anything else then the starter kits
could be fine as they are pre-configured.

~~~
nonrecursive
I might be biased (I'm the author), but I don't think that emacs-starter-kit
prevents you from doing things the normal way. You can still modify your emacs
config and include vendor elisp, and ESK doesn't make it more difficult.

And with the tutorial - I have a pretty low opinion of it. I mean, it starts
out talking about how to navigate up and down one screen - who cares about
that when they're starting to learn a new editor? Who? Emacs already has a
reputation for being obscure and difficult, and the tutorial does not help.

This frustration isn't directed at you, of course - I appreciate the comment.
In general, though, I think that Emacs instructions would be better if they
had a little more empathy for the learner. As a new person, I don't care about
hearing all this magical stuff about emacs right off the bat - I can't even
make sense of it because I have no context. Just show me how to actually do
real work.

~~~
goblinfoblin
That was kind of my point about the rough start, you won't get emacs to do the
real work without putting time into figuring out how to get it to go.

The tutorial is more of a get you started and make sure you can actually edit
text in emacs.

The most important parts of the tutorial are the how to save (which most
people get to) and getting more help which is probably what people don't get
to or understand. It isn't the best thing but it is okay if people make it
through the end.

But you're right if you don't want to mess with your editor and `learn` emacs
go for a starter kit or go for another editor with bells and whistles
included.

~~~
asgard1024
"That was kind of my point about the rough start, you won't get emacs to do
the real work without putting time into figuring out how to get it to go."

I disagree. It's not true for most IDEs, why should it hold for Emacs? This
argument was also raised about Linux, but then Ubuntu came along and proved it
was wrong. This seems to me like a religious stupidity - you have to use it
for everything or it won't work at all.

My main motivation to use Emacs is org-mode and Common Lisp. That's already
real work; although I try to use Emacs for everything, but using it for just
one of these things would be perfectly valid use case for many people.

It's not that I wouldn't like to mess with the editor either; in fact I did a
lot. But it still was not enough for it to work decently. I will have to try
one of the starter packages yet (probably Prelude), though.

------
liyanage
I tried to get into Emacs on OS X a few times, but one of the things I don't
like is the awkwardness of not having the Meta key mapped to a direct simple
key press.

Activating the "Use option as meta key" isn't a good solution because I
sometimes need to type accented characters that require the option key.

How do people deal with this when using Emacs in the OS X Terminal app?

~~~
ordinary
You can enter accented characters into emacs by hitting M-x 8:

    
    
      M-x 8 ` e -> è
      M-x 8 / a -> å
      M-x 8 E   -> €
    

The number of these binds does not cover all of unicode, but it's surprisingly
high nonetheless. If your desired character does not have a direct bind like
that, or you just can't find one (C-h b lists them), you can insert a
character by hitting M-x 8 RET and then typing its name:

    
    
      M-x 8 RET "Em dash" -> —
      M-x 8 RET "Hebrew letter double vav" -> װ
    

Tab completion works for these, of course.

[edit] I just saw the comment where you're more specific about what you're
looking for. This isn't it, but having gotten a reply already, I don't want to
delete this comment. It won't help you, but maybe it will others :P

~~~
lelf
It's C-x 8, not M-x 8. Use C-x 8 C-h for help

~~~
ordinary
Uhh, whoops! I can't believe that I messed that up. Sorry!

------
computer
Question to the Emacs crowd: how do I hit Alt comfortably? My instinct is to
use my left ring finger, but have trouble doing that without moving my other
fingers much. Could it be because I have very large hands (or because my
keyboard sucks)? Is it a good idea to just remap capslock to be the meta key?

~~~
spudlyo
The control key is used more often than the meta key, so I'd reserve that
choice bit of keyboard real estate (caps-lock) for control. For meta you can
hit Esc, or even easier Ctrl+[ which is the same thing. Contorting your hand
to hit control and alt in their default locations is going to cause you pain,
so don't do it.

I now use a kinesis keyboard, which has two giant thumb keys for your left
hand, I use those for control and meta. Before that I used control at caps-
lock and meta using Ctrl+[, which worked well and pain-free for me for years.

------
swah
Emacs makes Windows more bearable - thats why I'm thinking of returning.

------
runeks
> Go ahead and undo that change.

How do I do that?

Thanks for the guide by the way!

~~~
spacemanaki
C-_ is undo in Emacs. That's hold Control, and press "underscore". On my
keyboard (most keyboards?) this requires holding Shift and pressing the
"minus" key. Hopefully that's clear.

~~~
dgempesaw
C-/ is also undo, which is arguably easier to reach :)

~~~
lelf
Or C-x u

------
sbuccini
I'm learning Emacs for class, and I was wondering: do you use the same hand to
hit the command/meta keys? For example, when I'm doing C-n or C-p, I am
currently hitting the command key with my left hand, but the identifier with
my right. Is this the normal way, or do most people use one hand to execute a
command?

~~~
Fishkins
I believe the general ergonomic advice is to hit the modifier and "normal" key
each with a different hand, so you're doing it right. I try to follow that
guideline, but I frequently make exceptions. This is especially true since I
have caps lock mapped to ctrl, so I favor that left ctrl button regardless of
the other keys I'm pressing.

~~~
sbuccini
So for C-x, I should hit the command key with my right hand?

~~~
__david__
First off, the Mac "Command key" is not involved with "C-x". "C" is for
"control". "Command" is often bound to the Emacs "Meta" key, which would be
"M-x".

For C-x I generally hit Control with my left pinky and X with my left middle
finger: since C-x is a "prefix" key, there's going to be another key I hit
later and that will generally be hit with my left index finger.

However for the C-x C-s sequence I use my left index finger on X and my left
middle finger for S. Same with C-x C-q.

For M-x I use my left thumb on the Meta key (my Mac's "Option" key in my case)
and my left index finger on X.

Just like playing piano, there is no "right" way to map your fingers to the
keys (everyone's hands are different, after all). If something feels wrong or
is hurting, try using different fingers.

------
codygman
I've been using vim for 3-4 years now. The plugin system is alright, but it's
nothing to brag about. It's an amazing editor, but I think I'm going to try
emacs + evil for a bit.

I almost added some other claims but I couldn't put them into words correctly,
so I'll just leave it at this :D

------
tiatia
Emacs is one of the most powerful and impressive programs I have ever seen. It
just lacks a decent editor.

~~~
dasil003
At least put the quotation marks around that. I'm pretty sure 95% of visitors
to this comment page have seen that 100 times.

------
hogu
The best feature of emacs is running shells in buffers. For interactive work,
this is supremely useful because you can easily search your history, grab
previous lines/chunks of code, and edit them into future commands. I do this
all the time for data exploration with python.

~~~
Tezro
I like the M-x eshell function a lot, too. It supplies identical shell
experience across every system which is capable to run emacs.

------
tux
Have you ever tried Sublime Text ? I find it very powerful. But of course its
GUI unlike emacs or vim.

------
donniezazen
I am not a developer but am learning programming. I picked up vim and have
slowly build memory muscle for it for at least basic commands. I have never
use Emacs. It seems to be quite popular. Is it worth learning? Is there a
decisive answer to Emacs vs vim?

~~~
Derbasti
You should become intimately comfortable with a powerful text editor. Whether
that is Emacs or Vim or Sublime Text does not matter too much.

I don't think there is any one axis that clearly marks Vim or Emacs superior.
Both are awesome, geeky, sophisticated and powerful.

------
shire
Is it worth learning this over Sublime Text? I love Sublime.

~~~
Derbasti
Learning is almost always worth it.

~~~
shire
Kudo, But Time is of the essence

------
mrdraper
CTRL+F "vim"

~~~
maxk42
/vim<CR>

------
minor_nitwit
Or C-h t

------
burgerz
What benefits does Emacs have over something like Sublime? All I can see is
you can customize a million key binds so you don't have to use the mouse.
Sorry but I'm not racing type to as fast as possible when I write code, I
don't mind spending an extra second and using a cursor.

~~~
RBerenguel
Emacs also binds almost any REPL (Python, Lisp dialects, Erlang...) There's
also AucTeX if you need to write TeX (the best thing for LaTeX out there.)
Emacs is also completely configurable with emacs lisp: you can write your own
"things." For example, I have a mode I used to format posts for my blog: with
just a few custom keybindings I had it formatted to my tastes and special CSS
rules.

PS: Also, leaving the keyboard easily breaks the flow, specially when you are
in the "damn, delete this whole line and start again" frenzy that is just
milliseconds away from your neat idea. C-a C-k (this also works in most text
boxes in Mac OS, though) is extra fast for this kind of things.

As for leaving the mouse, that's not the point. I'm a heavy emacs user, but my
latest dwelling with Go have been using Acme (which is a mouse-heavy text
editor) and it is very enjoyable, as a change of pace. But being in emacs is
not "for the keyboard" as much as being in Acme is not "for the mouse."

~~~
burgerz
You can replicate a lot of that behavior in Sublime, plus you get a full GUI,
file browser tree and it's easy to use and customize right away.

I'm not really convinced I should invest time in using emacs.

~~~
pivo
As a long time Emacs user a "Full GUI" or file browser tree are negatives.
They just get in the way. There are alternative (and better) ways to navigate
a file system that don't require pop-ups and other types of additional
windows.

With Emacs directory navigation you can navigate into archive files such as
.tar, .tgz and .zip without having to extract them.

Another Emacs benefit that Sublime may or may not support is that the editor's
code can be customized simply by placing cursor at the function and typing a
keystroke. Your code is then immediately active with no restarts or reloading.

Emacs works just as well in a OS window on my laptop and remotely running in a
terminal. Being able to use the same editor locally and on a headless server
is huge if you do server work at all.

You can run bash (or whatever) shells in emacs buffers. The full benefit of
this is hard to describe, but once you try this you'll probably use it all the
time.

In the end, you'll probably never be convinced by people advocating for Emacs,
the best thing to do if you're really interested is to give it an honest try
for a non-trivial period of time. Emacs can take time to learn but I think the
payback is well worth it.

~~~
RBerenguel
Completely agree with the payback. I'd never dream of going back to more IDE-
like editors

