Hacker News new | ask | show | jobs
by frodetb 1351 days ago
With all the devotion on display from so many very clever people, it's hard not to be at least a little curious about Emacs. But I still have something holding me back. On the one hand, the entire environment that I've heard described might be very powerful. But at the same time, it is a whole new system to learn and get into, very specific to itself, on top of the operating system I'm already using. People say you will want to do everything in Emacs, and hold that idea up as a good thing, but I tend to be scared away instead. I don't like the idea of digging myself into a groove, even if it should be a comfy one. Powerful ecosystems can be hard to break out of, something I've found with Google and specific social media.
9 comments

In my experience, this is one possible path for getting "into" Emacs:

1. Having a need for something where Emacs is one of the best. E.g. outline folding, git gui, etc.

2. learning the basic shortcuts and concepts; doing the basic config to remove any problems

3. deep customization and creation.

If you don't have the need (#1), I wouldn't worry about it. If you do and you try it out, I agree #2 can be a little discouraging, but not too much. You can also usually make it easier by learning only the concepts and then using the gui menus to navigate. You can skip #3, or at least delay it. At this point, it's still just a tool like most others, and that's fine. I think #3 is what you're thinking of. That's what tends to get written and blogged about.

Is all about muscular memory, so you need to repeat and repeat, and take your time to develop it. Is normal not to grasp it after a few hours using the program. Nobody expects taking one karate class and exit being a master of katas.

First emacs kata should include this very simple concepts

1.Opening a file (the easy way) -> extra simple. Type "emacs /path/to/my-file" in a terminal. If a file with this name does not exist in the directory, a file image in memory will be created for it.

2.Do something with the file. Edit the file, see the image, read the pdf that you opened or take a look to the pdf code. Just use the keyboard and type something.

3.Close your file. Type Control and X at the same time. Then type C (for close): "ctrl-x c"

> "Your buffer (image in memory of the file) has been modified. Do you want to save the changes?"

Not: type N.

Yes: type Y.

Take in mind that if you open an extant file and type N, the old file will not be modified (you have still a file with this name).

But if you open a new file and type N, the image in memory will be discarded without a trace. Don't look for an empty file with that name in your directory. Will materialize only after you save it once. You can save an empty file.

Congratulations you are using emacs now. Here is your white belt.

Any time invested on using the program will payback later generously

This is exactly how I learned Vim. Afterwards I bundled it all together into a book (shameless self promotion I know)

The book is a weekly practice schedule that takes ten minutes a day to build up muscle memory for variety of techniques on premade files. It starts with the absolute basics, but builds all the way to advanced regular expressions with lookahead and lookbehind. By the end it covers the management and editing of marks, registers and macros.

It's amazing what a difference it makes to have muscle memory with macros and registers. Of course one can devise their own katas from the docs, but I just did the legwork of manufacturing scenarios to practice them.

https://leanpub.com/deliberatevim

Yes, except the keystroke to "close a file" is C-x k (for kill buffer).

Like you said, muscle memory. It's not surprising that you didn't remember the exact name of the keystroke because normally, you just do it.

This is also related to one of those sharp edges of Emacs that can cut you. "C-x c" is pretty close to "C-x C-c", which is the shortcut to exit Emacs. If for some reason, you DID mean to type "C-x c", it's easy to let your Ctrl finger linger a little too long and hit "C-x C-c" instead. And since x and c are next to each other on a US keyboard, it's also very easy (for me) to hit x and c at the same time with a single finger motion. The odds go up since so many actions start with "C-x"

(setq confirm-kill-emacs 'y-or-n-p) is one of the most important configs to start with, IMO. Or if you don't want to learn/use elisp, the equivalent Customize setting:

Options > Customize Emacs > Top-Level Customization Groups > Convenience > Confirm Kill Emacs

Generally, if I have unsaved work Emacs prompts me to save, so I can C-g out then if I fat-finger kill-emacs.
I think that killing the entire app is jarring enough that it should never happen accidentally, regardless of unsaved work. It would be especially harmful for newer users, since they will find it harder to relax and feel comfortable with Emacs. But even for experienced users, Emacs state that you would want to preserve goes far beyond unsaved edits. Expensive startup computation, open buffers, window arrangement, ongoing rgrep operations, etc.
Ctl-x k when you have more than one file opened. Ctl-x C is faster and more easy in this particular case.

Hum, I see. I stand corrected. It seems that all this time I was typing Ctl-x Ctl-C instead. I never use copy in emacs

I learned the basics for org mode. I invested a bit of time to learn one small corner of the default emacs ecosystem, and every second was worth it. Since then, I've continued to explore its use as a text editor (and it keeps getting better and better). There's a bit of a learning curve for just the basics, and it's understandable that you don't want to deal with that. Just the basics can go a long way with org mode, though.

With org mode, everything is plain text. This should go a long way to easing your worries about getting stuck in a groove. Lots of folks take notes in markdown. It's the same kind of thing.

> But at the same time, it is a whole new system to learn and get into, very specific to itself

If you already know Vim keybindings, it is very easy to get into Emacs with evil-mode.[1]

Besides that, Emacs by default comes with a menu system that helps you discover keybindings, too. And there is also cua-mode which I haven’t tried.[2]

[1] https://github.com/emacs-evil/evil

[2] https://www.emacswiki.org/emacs/CuaMode

I use cua-mode with a few key bindings and mouse modifications of my own to make it work the way I want. Its pretty easy jumping between windows apps and emacs for me
Hey,

> I don't like the idea of digging myself into a groove, even if it should be a comfy one. Powerful ecosystems can be hard to break out of, something I've found with Google and specific social media.

I had the exactly same thought holding me back, then I realized that Emacs doesn't really suffer from vendor lock-in/the walled garden effect: it's way older than most gardens, and bound to be around for as long as we use keyboards to interact with computers.

Come over to the Emacs side, frodetb, we have lambdas.

You do not have to doeverything in emacs. At the end of the day it is a tool and it should make your life easier. Do in it only the bits that actually help you, if any. With time you might do more and more stuff. Or not, that's fine.

For example I have been using emacs for more than 20 years and only recently I got into the habit of actually running shells from inside it (it is very convenient, but just opening another terminal is an habit that is very hard to shake).

Indeed, no one is telling you you have to or should do everything in Emacs.

But much like Linux itself was in the Windows 9x era, it is a gravity well for your attention, and you will want to do more and more with it if you can.

>but I tend to be scared away instead.

I think a lot of the myth-making around the power and the cleverness of long time emacs wizards paradoxically achieves exactly what happened to you, it makes Emacs seem more intimidating than it is. Also true for a lot of programming languages with that reputation.

Is emacs old, has weird keybindings and weird UI paradigms? Yes, but it's also just a piece of software and there's nothing in the way of learning it. It calls itself the self-documenting text editor for a reason, it has plenty of learning tools deliberately built in. Despite its reputation, from language support to help there's very few pieces of software that have put that much emphasis on being accessible.

You can still use other software, don't need to go all-in, etc, but I'd always recommend everyone to give it at least a shot.

Still, with emacs, it's open source and runs almost anywhere. If you happen to LIKE that grove, you can be confident that you can bring it along wherever you go.
I think the idea that learning emacs will suck all your brain power is a bit false. You can really just use it on the side from time to time and get a feel about it without investing much. It is a large (40+ years show) system, that even old users don't know fully ..

And in a way that's how I use vi, I'm emacs mostly but I play with vi regularly, I stay at the no-plugin level enjoy keyboard golfing :)