Posted by weakfish 3 days ago
Ask HN: Where to begin with "modern" Emacs?
I’m a longtime Neovim user who’s been EMacs-curious. The hold up for me has been that I’ve been unable to find a source of truth for what’s top-of-the-line as far as plugins are. With Neovim, it’s a safe bet to look at what folks like Folke are doing, but I have struggled to find a similar figure in the Emacs community who gives insight into what’s-what. I know Doom exists, but I want to fully “own” my config and not over complicate it.
Thanks!
AFAIK this is an easy setting in desktop environments such as Cosmic, Gnome, and KDE. But I've been using keyd on Linux distros for a while:
https://github.com/rvaiya/keyd#quickstart
Using the config in the above example results in Caps Lock acting as Esc if used on its own or as Ctrl if it's held down.
What? This has worked for me in X11 for at least two years now:
setxkbmap -model pc104 us -option ctrl:nocaps
(If you still need a Caps Lock key, there’s -option ctrl:swapcaps)Some of the things I’ve found work well for me:
- it’s pretty obvious, but it took me a while to figure it out: make your `~/.emacs.d` into a git (jj, hg, whatever) repo. You don’t need a remote but as you try things out it’s nice to be able to step back in time.
- know what you want to build. For me I’m generally trying to make emacs do something that I’ve seen a colleague’s editor do: integrating language servers for source navigation; integrating a debug server for a nice visual debugging experience.
- some people manage their emacs configuration as org-mode files. This is neat because you get an experience similar to Jupiter notebooks: you can intermix commentary and elisp. I haven’t ever gotten to this point but it looks neat when I see others do it.
There are some good YouTube channels and blogs that talk about configuration, or that test different packages. I’ve found “Emacs from Scratch” and “Emacs Rocks” to be really useful.
There’s a lot to customize and select from. Without steering you one way or another, here are some changes I’ve made recently or packages that I use:
1. For language servers, I find `lsp-mode` to be easier and more full-featured than `elgot`.
2. `dap-mode` plays nicely with `lsp-mode` and makes debugging straightforward.
3. I’ve tried, and use, a few different plugins for AI coding: `greger.el` is the first one I tried, but I’ve started using `xenodium/agent-shell` more. If you want to write (or hack on) an AI agent written in elisp, there’s `steveyegge/efrit`.
4. You’re probably accustomed to some sort of “tab completion” from neovim. Within emacs you’ll need to set up a “completion framework”; there’s a bunch to choose from. Watch some videos and experiment. You’ll probably find one that feels a lot like you’re used to (whether that’s completion-as-arrow-navigable-dropdown-at-cursor, or completion-in-side-panel, or whatever).
Your muscle memory of how to move around in a document and how to tell your editor “I want to do something new now (see a list of open files, go to a new file, etc)” isn’t going to translate into emacs very well. It’s like shifting from a laptop keyboard to some weird split keyboard with thumb paddles: muscle memory won’t be satisfied, and you might just “not like” emacs due to that. There’s `evil.el` (“Emacs VI Layer”) which teaches emacs to recognize vim-style commands. I think vims have fantastic macro recording and replaying functionality - emacs has it as well, but making a recursive macro is harder for me, for some reason - and evil makes emacs’s macros feel on par with the vims.
Another tripping hazard coming from a vim-like is that “undo” operates differently in emacs. I think the vims have a fairly linear undo: like a browser history back button. emacs stores an undo tree, which can lead to surprising behavior at first.
If you’ve written or tweaked plugins for your editor and enjoy tinkering with your tools, then a vanilla greenfield approach to emacs will probably be very satisfying for you.
If you want something that “just works” which you can experiment with and gradually learn more about over time, then you might get more mileage out of spacemacs.
I think vim-style users tend to launch vim many many times through the day. cd here, edit a file; save, quit, edit the next file. emacs can act like an editor, but if you think of it as a highly customizable IDE, then you’ll get more use out of it. My uptime on emacs is generally measured in months, whereas for me vim is in seconds to minutes. I mention this because the startup time for emacs can be quite slow compared to vim; just don’t pay that cost over and over.
Understandably, some people complain that it shouldn't need a tutorial or the defaults are bad. There's validity to that angle. There's also validity to Emacs pre-dating GUIs, the IBM keyboard, and the x86 instruction set. Once you get past the history of windows and killing, you can explore. The history is also super interesting!
https://www.emacswiki.org/emacs?EmacsHistory
https://dl.acm.org/doi/abs/10.1145/3386324
After you've read the tutorial, go wild. Try stuff out. Break things. Fix them. Learn your limits. Learn that there are very few limits imposed by Emacs itself.
Hands down, the best resource for Emacs is Emacs itself. Especially, the Emacs manual and the Elisp manual. The "An Introduction to Programming in Emacs Lisp" is also excellent if you're not familiar with Lisp. Learn to read Info files and learn the help system (basically C-h f and C-h v)
https://www.gnu.org/software/emacs/manual/
Emacs really is a flagship of Freedom, with all its pain and glory. It lets you exist at the threshold of your zone of proximal development. Every bit you put into Emacs, you get a return on investment.
Welcome to the Emacs community! It's full of weirdos and wizards, as well as regular folk. Stick around and I'm sure you'll make friends in no time.