Top
Best
New

Posted by weakfish 2 days ago

Ask HN: Where to begin with "modern" Emacs?

Hi all,

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!

214 points | 114 commentspage 3
grg0 2 days ago|
My Emacs setup typically involves:

- An LSP: https://emacs-lsp.github.io/lsp-mode/tutorials/CPP-guide/ - Neotree to browse the file system: https://github.com/jaypei/emacs-neotree - Awesome-tab for tabs: https://github.com/manateelazycat/awesome-tab

If you want more, look at the extensions section of the LSP page and then go down the rabbit hole.

I likewise do not use Doom or any of the bundled variants because I want full control and understanding of my config. But those variants are still useful to learn what's out there and selectively add things to your mix.

theflyinghorse 1 day ago|
Using tabs requires so much discipline imo. I just end up having 2000 tabs open, and so I chose to not have tabs at all.
jasonm23 2 days ago||
I made ocomacs for this purpose, it's designed as a minimal config layer which is more of a pattern to follow than a "does everything for you" framework.

https://github.com/ocodo/ocomacs

pkulak 2 days ago||
My hang up is that I live in the terminal. What eMacs folks seem to do is use the terminal in eMacs, kinda in place of tmux? Is that right? And what terminal is the best? Is it really as nice as something like Foot? What happens if you open a text file in an eMacs terminal?
skydhash 1 day ago||
In lieu of the terminal, I use shell-mode for CLI tools. For the rare TUIs i need there’s always ansi-term. And there’s shell-command and async-shell-command for one-off things and `compile` for anything that present a report about files (build, lint, and test).
binary132 2 days ago|||
I usually just use emacs in one terminal tab and tmux / bash in another. The more you get familiar with emacs though, the more you tend to get things done in emacs without using a terminal at all. Magit and the file interface are both generally a lot better than terminal living. You _can_ drop into a shell window, but in my experience it’s usually easier just to keep a terminal around if you need it.
rich_sasha 2 days ago|||
I use Emacs exclusively in the terminal, with standard platform terminals (iterm on Mac, windows terminal on windows). Works great.
pkulak 2 days ago||
You mean, you use eMacs in terminal mode? I thought that was frowned upon? Isn’t a lot of the benefit is eMacs that you can get a true GUI, with no keybinding limitations, varying font sizes, etc?
rich_sasha 2 days ago|||
I wasn't aware of any frowniness! Sure, there are some features you can only access via gui, but I'd say they are extremely minimal in my workflow:

- real buttons in GUI

- rendering inline images/LaTeX

- varies fonts (eg font sizes)

There may be others but I can't think of them. Neither of the above is things I do more often than a handful of times a year.

Meanwhile, terminal Emacs plays well with tmux and SSH which I do a lot of. For example, a workflow I have is to SSH to a Linux box, start a tmux session and have Emacs/ipython/jupyter with port forwarding open on the remote box. I can steal this tmux session from any new connection. It also survives if the machine I'm sshing from dies or reboots. I can't think of a way to make it work with GUI emacs.

brucehoult 2 days ago||||
I guess some people can frown on anything.

I 99% of the time use emacs in a terminal. 90% of the time over ssh or in a non-GUI VM/docker etc.

I usually install emacs-nox to speed up the install.

Vanilla emacs is fine. Maximum I scp my .emacs file from another machine, but there's actually very little in it. Mostly it's disabling the menu bar, tool bar, and scroll bars.

Usually all I'll do is adjust things such as indenting and other code formatting things to match the codebase I'm working on -- which varies from project to project anyway, and you need to do with any editor to avoid making a mess.

I do have one little elisp function that tries to find and open the header file for the C file I'm currently in, or the c, cc, cpp, c++ file for the header file I'm in.

I'll reproduce that below, if anyone cares. Please don't laugh too much at my elisp -- I probably wrote that in the 90s.

    ;;;;;;;;;;;; Automatic switching between source and header files ;;;;;;;;;;;;;;;;
    
    (defvar c++-source-extension-list '("c" "cc" "C" "cpp" "c++" "pcc" "pc"))
    (defvar c++-header-extension-list '("h" "hh" "H" "hpp"))
    (defvar c++-header-ext-regexp "\\.\\(hpp\\|h\\|\hh\\|H\\)$")
    (defvar c++-source-ext-regexp "\\.\\(cpp\\|c\\|\cc\\|C\\|pcc\\|pc\\)$")
    
    (defun toggle-source-header()
      "Switches to the source buffer if currently in the header buffer and vice versa."
      (interactive)
      (let* ((buf (current-buffer))
             (name (file-name-nondirectory (buffer-file-name)))
             (check (lambda (regexp extns)
                      (let ((offs (string-match regexp name)))
                        (if offs
                            (let ((file (substring name 0 offs)))
                              (loop for ext in extns
                                    for test-file = (concat file "." ext)
                                    do (if (file-exists-p test-file)
                                           (return (find-file test-file))))))))))
    
        (or (funcall check c++-header-ext-regexp c++-source-extension-list)
            (funcall check c++-source-ext-regexp c++-header-extension-list))))
    
    (global-set-key [?\C-c ?`] 'toggle-source-header)
ksherlock 2 days ago||||
The emacs GUI is basically a dog-shit terminal emulator that only runs emacs. Just run emacs in the terminal.
yablak 2 days ago||||
You can set up the terminal+tmux to forward all the important keys to console emacs. I like iterm2 for its extreme configurability. Others say kitty terminal with the kitty term emacs library is great. I never got that working with tmux.
ksherlock 1 day ago|||
By the way, Richard Stallman uses emacs from a text console. A text console! Not an xterm, not a terminal emulator, the text console.
Scarblac 2 days ago||
If you want to quickly edit a file, you can also open emacs in the terminal with "emacs -nw".
wafflemaker 2 days ago||
I'm not on level as power users here, but have one good tip on having good and clean configuration.

Just like config.d dir in ~.ssh/, you can have a 'load' instruction in your emacs.el/init.el file and a separate directory for configs. This way you can easily do see what does what (by name) and have even more comments in the beginning of files.

So even if you added some modification late at night/under influence of substances, you can still tell that you were thinking and easily switch it off or improve it.

Edit: and love your question, even tho I used Emacs for over 10 years, I've learned a lot in here.

wyclif 2 days ago|
You mean the `Include` directive, right? Not "load"...but I guess that's just shorthand for the concept.

So you split your main ~/.ssh/config file into smaller, reusable files stored in a subdirectory like ~/.ssh/config.d/. The main config file then "includes" (loads) these modular files automatically. So for instance, you might have:

~/.ssh/config.d/10-general.conf

~/.ssh/config.d/20-work.conf

~/.ssh/config.d/30-github.conf

Can confirm this works great in teams or on multi-host setups, as it keeps things organized without cluttering a single massive config file and it works across tools like ssh, scp, rsync, etc.

wafflemaker 22 hours ago||
It also makes automation easier. I have a script auto adding vagrant VMs under known names when working on a project with vagrant. And had to go at great lengths to avoid nuking the main config file.

And same for for Emacs: it's much easier to vibe code some changes (don't know ELisp that well). And then when knowledge of the language matures I can look at fixes and at least know what was the idea behind them.

I_complete_me 2 days ago||
IANAD I am not a developer.

I got into vim because it made total sense to me as a way to transfer thoughts to words, I loved it , I lived it and I love it and live it. Then I heard about emacs org-mode – after trying for ages to find the "software to organise my life" (pick your poison).

I found it to be totally workable, initially, via doom-emacs.

Then they said "You won't believe Magit".

I didn't leave my wife, instead I invited everyone into my world.

True, I had been fooling around looking for a wife. I hit on vim. She was perfect. In her world there were people who knew all about perfection – no surprise – until I met her beautiful sister. I fell in love with her. Then I met a relation of hers (her name was Magic, also beautiful) and I invited them all back to what became their place where I am now welcome too.

facundo_olano 2 days ago||
I started with prelude[1], I wanted something batteries included to use as my main editor right away, but not as structurally different from vanilla as Doom or Spacemacs. Then after a couple of years I rewrote my config line by line looking at what prelude did and keeping only what I needed.

I’m happy with result, but this was 7 years ago so there may be better options than prelude to do something similar today.

[1] https://github.com/bbatsov/prelude

alfiedotwtf 2 days ago||
Check out the book Mastering Emacs, and then his blog. It’s a goldmine for what you’re after
shivekkhurana 1 day ago||
I was advised to start with vanilla eMacs to get the hang of the system.

I now feel it was bad advice.

As someone who grew up with good dx tools like Sublime, it’s really hard to be productive in vanilla eMacs.

I’d suggest going with Doom, but don’t enable any package except Evil, LSP, Treesitter and Projectile.

This will give you a Vim like experience with basic project management.

As you become more comfortable, you can enable more packages.

This way you will stay productive and learn on the back of the community wisdom.

Kholin 2 days ago||
For me, the "modern" way is when I meet any problem on updating my emacs config files, just ask Claude or Gemini, they will help you to find solutions for the most of common problems. The "traditional" way is to know the basic keybindings, and write an actual project directly, whenever you found there's lack of a feature, just search and config for it. After a period, you'll got a stable config for long term use.
etothemacs 2 days ago|
[dead]
abhiyerra 2 days ago|
I’ve been an Emacs user for more than a decade and I would recommend just using Doom especially if you are coming from a Vim background.

I started before Doom existed but ended up in a configuration similar to Doom but more brittle. I ended up just declaring .emacs bankruptcy and started over with Doom and was pleasantly surprised that my over 2000 line configuration became less than 30 customized lines.

If you want to do it the hard way I’d start with figuring out elpa and going from there installing the specific plugins that you want. Likely, evil being a first.

More comments...