Hacker News new | ask | show | jobs
by tempfile 6 days ago
I've been trying emacs for a while. People keep saying it's self-discovering and I have no idea what they mean. Am I missing part of the manual? I google stuff when I don't understand, like any other piece of software. I've never managed to successfully use the help system to find anything.
6 comments

The neat thing with Emacs is that the core concepts of the system are all first-class programming entities with their own documentation. So if you want to know what your current mode does, you can use C-h m to get a bunch of information including commands, key-bindings and links to code. If you have a key command, you can use C-h k, enter the keys, and you'll see exactly what function that command runs. You can get info about functions with C-h f and variables with C-h v; coupled with some kind of fuzzy-find-autocomplete (which, unfortunately, isn't set up by default), it's usually pretty quick to find the functions and config options that are relevant to whatever you're trying to do.

I still use web searches to look up Emacs things occasionally, but the built-in help commands are still useful because they're naturally tied to (and organized by) the core code entities that power Emacs.

Yep. `C-h k` to look up what a key does, `C-h f` to look up a function, and `C-h v` to look up a variable/setting will get you pretty far.

I'd also add `C-h b` to show you the key bindings. (And `C-h` after a prefix key will usually show you the bindings that start with that prefix.) `C-h a` for apropos to search commands by substring can also be useful.

The thing that makes it really "self documenting" is that these help commands reflect the live environment at the moment you use it. If you've added a new binding in your init.el, `C-h b` and `C-h k` will show it. If you've added a new function in your init.el, or loaded a custom package, all those functions can now be found via `C-h f`. The help system will show you the doc strings for them and provide hyperlinks right to the source.

Moreover, this works for anything that you define on the fly. Open an Emacs lisp buffer, type some elisp code to define a function or variable, execute the definition, and now it'll appear under the above in the help system the next time you invoke help.

> I have no idea what they mean

Emacs can "describe" anything contextually. Describe current mode, character at point, specific command, any variable, etc. With Wilfred/helpful it gives you even more stuff. If you're not sure what's the exact symbol/command/mode name you're looking for, there are 'apropos' set of commands. Also, absolutely learn Info and how to navigate it - it's enormously descriptive and very useful - it beats googling stuff up, because a) it works offline b) it gives you more accurate info about your current system.

It's crazy man, you can get full text search for any concept you want. Here goes:

    C-h r (open Emacs manual)
    C-s "line numbers"
That's it. Just keep pressing C-s and it will search through every section of the entire manual for the keyword you mentioned. After 5 tries, it lands on "16.24 Customization of Display", and you can read how that works.

Also apropos works.

Some distros used to (still do?) drop some of the manuals, it was really annoying to discover this on Ubuntu a few years back. As someone who knew the manuals should be there it was easy to get the right google search to find out how to install them, someone new or inexperienced with emacs would likely not recognize that anything was missing in the first place.
I was mildly disappointed the other day when I did a <C-h a>, and instead of "apropos" I saw "search for command". Apropos was one of those killer features that was, as far as I know, unique to emacs (until the "command palette" appeared in one of the newer editors).
Having a good completion package (e.g. `vertico` + `unordered`) goes a long way to finding stuff. I regularly find new functions and variables by calling describe-function and describe-command and just searching/auto-completing my way to what I need. It gets even better with the `helpful` package which improves the layout/features of help pages a lot.
I learned Emacs before search engines and can develop Emacs software while disconnected from the internet. My point is that Emacs is more self-documenting than most things.
It's self discovering... once you figure out how to use its very eclectic by modern standards mechanisms for discovery. No sarcasm. Learning how to use it is a skill you have to actively acquire. This is more a criticism of emacs than of you.

That said, I've been using it for... uhh... about 30 years now, and I've honestly never picked this skill up myself very much. I can only use it minimally. Just googling is fine, and as others have commented today (although maybe in that other thread about emacs), AI makes it even easier because it can just straight up write the modifications for you if you need them.