
Ask HN: How to force myself to learn emacs? - newsisan
Any suggestions welcomed, but what I was thinking was...<p>Is there some module or extension that prevents me or notifies me whenever i do something that could be done easier with a shortcut? E.g. if i use the arrow keys, it stops me until i use c-b/c-f/c-p/c-n? If I go to a new line and press tab, it undoes it newline and tells me to use c-j, etc.<p>It would be fantastic if there was one.
======
yason
Learning Emacs versus another editor is like learning to compose versus
learning the names of the notes of the keys on a piano. When I jumped in in
the early 90's I--having already been convinced of Emacs' superb capabilities
--just made the decision to not use anything else than Emacs and stick to
that.

I guess that with a program so endless as Emacs, there's no other way.

First I never looked back and then I never wanted to look back.

The first days were painful because there was so much I hadn't bumped into yet
but soon the later days were much easier. The same analogy held for the coming
weeks, months, and years. I _still_ learn new stuff that Emacs has but in 95%
of what I do with it I don't even think about anymore. That's the payload I've
accumulated in nearly 20 years of Emacs.

It's all in my spine somewhere and I'm always amazed when I occasionally use
another editor that it doesn't do things that Emacs does, or rather that it
doesn't work _with me_ as Emacs does.

I also customized Emacs heavily in the beginning years but now I've been
trying to not touch anything unless absolutely necessary. In other words,
first I made Emacs grow closer to me and now I've grown closer to Emacs. I can
work up another .emacs from scratch in a couple of days, fixing all remaining
settings that I've accustomed to, on the fly as I bump into them. There aren't
that many left.

------
stuhacking
Just use it a lot. During university I reached a point where I wrote
everything in Emacs and appreciated the fact that whatever I was working on
(Code, terminal, articles) I could switch over to something else without
having to switch context in my mind. (Keyboard shortcuts, macros and
formatting options stayed the same.)

Don't worry at the start about default options or the Right Way(tm), these
things are likely to distract you to begin with. You probably will find
yourself gradually adopting them. Make emacs a comfortable editor for your own
way of working - It is intended to be extendible and configurable for this
reason.

As to a module for teaching... When you run extended commands using M-x
(Alt-x) it should tell you if there is a shortcut bound to that command. If it
doesn't or you miss it then maybe the following functions will be helpful:

 _M-x where-is_ [C-h w] Type a command and it will tell you the key shortcut
(if any)

 _M-x describe-key_ [C-h k] Type a key shortcut and it will tell you the
command it is bound to

 _M-x describe-function_ [C-h f] Provides details about the function you
specify

------
rcfox
...People do that? Make emacs work for you; don't work for it!

There's nothing wrong with using the arrow keys. There's nothing wrong with
remapping return to do newline and indent. Heck, if you want to use the
standard C-c, C-v, C-x for copy, paste, cut, there's a mode for that too.
(<http://www.emacswiki.org/CuaMode>)

Put your .emacs and .emacs.d somewhere easily accessible and updateable, like
GitHub or Dropbox, and you don't have to worry about not knowing the default
settings.

~~~
sliverstorm
There's something to be said for complying with default settings. I know there
are people out there who only ever work on their own machines, but I find that
when I'm hopping around on 100+ different boxes I don't own it's worth the
trouble to live by the default mappings and behaviors.

~~~
stuhacking
This is why you can do: (load-file "/<user>@<host>:~/.emacs")

(Assuming your 100+ machines are capable of reaching your home directory in
some way (ssh, ftp, ...). If not, you could also put your desired emacs init
in a publicly accessible location.)

 _Edit_ : Or put a copy on a USB drive, or diskette, or floppy.

~~~
sliverstorm
(Half the time a given box didn't even have network access)

------
dstorrs
1] Set up a reminder saying "Read EmacsWiki" in gCal for a specific time every
day. Have it send you an SMS.

2] When you get the reminder, spend 10 minutes reading
<http://www.emacswiki.org/> Find _just one thing_ that interests you.

3] Make a point of using that one thing at least a couple of times over the
course of the day.

If you want to learn all the keyboard commands, spend your first few days
(re-(re-(re-)))reading the basic keylists.

It will start to stick in less time than you think, and you'll have fun doing
it.

~~~
angusgr
I used to do something similar to this (less intense), however I seem to have
hit my limit for number of remembered features.

ie I'll find something new now, use it for a few hours or a day, then suddenly
it will be 3 months later and I'll suddenly remember that I could be using
that feature right now, if I could still remember how to use it.

Any tips?

------
zellyn
Use ~/.emacs.d/init.el instead of ~/.emacs (emacs will recognize either): that
way you can put the whole directory under version control more easily.

The best way is to just start using it. And periodically read tutorials or the
built-in info (C-h i) - don't worry about memorizing everything at once. Just
learn a couple of shortcuts, and come back again later.

Ask people you know who use emacs for tips. Just follow your interests: if
reading IRC inside emacs sounds cool, learn to do it. If org-mode sounds like
something you could use, read a tutorial, start using it, and read more later.

If you like lots of window panes (C-x 2, C-x 3, repeat), window-number.el is
nice. Or bind M-o to other-window.

Learn to use the kill-ring. Learn to love C-y M-y and miss it in other apps.

Learn to record and play back macros -- C-x m ( -- if you use your movement
commands carefully (forward-word, end-of-line, etc. instead of single-
character movements), you can get a LOT of mileage out of it.

Use customization rather than programmatic configuration wherever possible -
it'll keep your init.el much more manageable later when you come back and
completely forgot why you added things.

Again, just start using it, and follow your sense of interest in learning new
things. Focus on features that actually help you accomplish tasks more easily
or quickly.

Oh, and for the love of everything holy, rebind your Caps-lock to another
Ctrl, so you don't damage your pinky finger! :-)

------
pdelgallego
That is easy, I always include this lines in the .emacs f new users

\---

    
    
      (defun  disabled-key ()
        "Assign this to disable a key"
        (interactive)
        (print "All your arrow keys are belong to me. Have a nice day!"))
    
      ;; All your arrow keys are disabled Hahahah
      (global-set-key (kbd "<up>")      'disabled-key)
      (global-set-key (kbd "<down>")    'disabled-key)
      (global-set-key (kbd "<left>")    'disabled-key)
      (global-set-key (kbd "<right>")   'disabled-key)
      (global-set-key (kbd "<C-up>")      'disabled-key)
      (global-set-key (kbd "<C-down>")    'disabled-key)
      (global-set-key (kbd "<C-left>")    'disabled-key)
      (global-set-key (kbd "<C-right>")   'disabled-key)
    

Learning emacs can means many different things.

The first thing you will need to learn is, indeedn to use it as a text editor.
But you should also learn many other things, like learning eshell, learn and
use elisp to adapt emacs to your work flow, use org emacs, rectangular
editing, ...

Yesterday I send this "Mastering EShell" link [1] that didn't make the front
page.

[1] <http://news.ycombinator.com/item?id=2002037>

~~~
angusgr
Is using the arrow keys really that bad? I understand that it moves you off
the home row, but is _that_ really so bad? Should I be doing this?

If you're being serious, it kinda seems like just punishing new users for no
good reason. If you want that kind of self-flagellation, use vim (kidding!
kidding!!)

(FWIW I use arrow keys, but also other smart navigation combinations, a lot. I
consider myself a reasonable user of emacs but no pro - I have bells and
whistles turned off, fairly hefty .emacs/.emacs.d file, much of which I wrote
(or tweaked, to be honest) myself for specific cases, etc. but I know I only
use <1% of what is out there. I try and make myself learn a new feature
reasonably regularly, though.)

~~~
pdelgallego
Dont understand me wrong, I use Arrow Keys, plus S-j S-k S-l S-i as custom
"smart navigation".

I think the extra pain, that you cause when you remove the arrow keys is worth
because force a new user to be conscious all the time that he is not anymore
in his old editor.

E.g For me the arrow keys were a good enough option to align things by hand,
but after removing the them, I learned to use align-regex and rectangular
editing.

~~~
angusgr
Thanks. I've never used either align-regex or rectangular editing, so you've
inspired me to give them a go!

------
mleonhard
I put off learning Emacs until I found Steve Yegge's Effective Emacs article:
<http://sites.google.com/site/steveyegge2/effective-emacs>

Here's a list of basic emacs keyboard commands I wrote during college:
<http://tamale.net/essays/effcoding.shtml#emacs>

------
grandalf
get the emacs starter kit by technomancy (on github). It comes with some nice
default settings that made it pretty easy for me to jump right in.

I still do a few non-emacsy things like use the arrow keys, but I've installed
a few new libraries and customized it a bit more to my liking... _to the point
where I now find Textmate a big drag on productivity_.

------
eccp
I'm learning Emacs too (after 10 years of vi/Vim), and one of the first things
that most people suggest are: hiding the menu and toolbars.

See more here: [http://charsequence.blogspot.com/2010/07/setup-emacs-for-
dev...](http://charsequence.blogspot.com/2010/07/setup-emacs-for-development-
with.html)

------
matei
dude, don't be fanatic about it. it's a tool, not a mistic knowledge that once
you gain, you'll master the universe

~~~
rick_2047
I cannot agree with you more. Sure things could be done easier in it (or in
vi/vim) but programming is done in the head not in the editor.

------
bhudman
The best way to stay motivated to learn emacs is to get benefits from it very
quickly.

In my case, I was in undergrad school and my annoyance with MS word formatting
led to latex. I did not want to learn all the keywords, so the latex mode
helped me quickly to get over the hump.

Check this out for creating html in emacs :
<http://www.youtube.com/watch?v=EQAd41VAXWo>

Pick your favorite language (something popular), load up the mode and get to
work :)

------
davnola
C-h m brings up all the shortcuts for the current mode.

------
odyniec
Don't try doing any real work with it at first. I made that mistake a couple
times, only to learn that trying to get anything done using a tool I don't
know (no matter how great and useful it is) can only lead to frustration. Give
yourself a day or two to just play with it and get comfortable, go through the
built-in tutorial, write a few small Hello World-like programs, etc.

------
program
1) Hide your mouse

2) Hide the other editors

3) Hide the toolbar (if you aren't using the ncurses interface)

4) Always look at the minibuffer every time you "M-x command". Emacs tells you
if there is a shortcut that does the same thing

5) "C-h a command" is your friend

6) If you are on Mac OS X use the emacs-style shortcuts in other editors too
(C-a, C-b, C-d, C-e, C-f, C-h, C-k, C-n, C-p, C-u, C-v)

------
SkyMarshal
Buy either _Practical Common Lisp_ or _Land of Lisp_ and work through the
entire book. They both teach Lisp via Emacs.

<http://gigamonkeys.com/book/>

<http://landoflisp.com/>

~~~
saw-lau
I bought Land of Lisp recently (haven't got round to starting it yet), but a
quick search of the PDF only shows a couple of mentions of emacs...

------
hessenwolf
Blu-tack a cheat-sheet to the wall. Worked for me.

------
bayareaguy
alias vi emacs

~~~
thelastnode
I actually did this recently! I kept vim as vim though, so if I REALLY needed
to edit something quickly, I still could.

It's very natural to type "vi <filename>", so it certainly helped.

~~~
bayareaguy
_it certainly helped_

That was my experience as well, having learned vi before emacs. Unfortunately
back then computers were scarce and I frequently shared my account with
friends less pleased with this strategy. One even thought it was a joke On him
and after he eventually got his own account he got "even" with me by putting
'nice 5' in my .login, which I didn't find for weeks...

------
pshirishreddy
Set your desktop wall paper to some cheat sheet of Emacs. I employed a similar
technique for VIM thought :)

