Hacker News new | past | comments | ask | show | jobs | submit login

This tutorial is painfully out of date, and I would argue a very bad way to learn emacs today. As an example, don't learn to use ETags unless you are going to specifically be working with a C project where other developers use them. You would be better served these days learning LSP and treesitter, which is now built-in. I would also strongly suggest using Doom Emacs, and working your way backward to a minimalist configuration once you are comfortable. There are so many useful packages excluded from default emacs that any beginner learning emacs would walk away with the impression that emacs is old outdated software, and not useful for real work. That couldn't be farther from the truth, but if you follow tutorials from 2012 you wouldn't necessarily figure it out.



> don't learn to use ETags

> You would be better served these days using LSP and treesitter

Could you elaborate? How do I transition from etags to treesitter? Suppose I'm working on a dynamic C or C++ project where I might need to regenerate the tags daily.


With lsp you don't need tags. You essentially have a lsp server like clangd [0] running in the background for finding references, definitions, code completion etc.

With the latest release 29.1, emacs comes with an in-built lsp client - eglot[1]. So you need to (a) Set up clangd or some other lsp server for c++. Make sure it's accessible from emacs (use something like exec-path-from-shell to get your shell paths into emacs) (b) Set up your project for clangd - this involves generating a compile_commands.json which basically lists the full compilation invocation of each and every file in your project. CMake has options to do that and likely many other build tools or maybe use something like bear[2]. (c) Enable eglot (install the package if needed on older versions of emacs) and configure appropriately.

I also use projectile for project mgmt though emacs now has something in built for that too.

I can post my configs if that helps.

[0] https://clangd.llvm.org/ [1] https://github.com/joaotavora/eglot [2] https://github.com/rizsotto/Bear


> How do I transition from etags to treesitter?

… to LSP: You don’t throw your tags away. If you run an LSP client it will add an “xref-backend” transparently, so Emacs will get all references and definitions from the LSP server. If you turn off LSP mode, Emacs will fall back to the etags backend. I don’t think you need any configuration for this to work.

Treesitter modes do not implement an “xref-backend” AFAIK.


They could and should, though.


LSP refers to the Language Server Protocol, a standardized protocol designed to provide real time source code information for a given code base; tree-sitter is parser design to create a real time syntax tree for a given source file. No doubt the OP is suggesting the use of an Emacs plug-in based on those newer technologies.


I meant to say "learning", not "using", that's my mistake.

> Suppose I'm working on a dynamic C or C++ project

Most beginners are not, that's my point. Those technologies are fine if you need them, but the vast majority of beginners are working in dynamic languages like JavaScript and Python. Any modern tutorial using Emacs for code should be about programming in those languages (and elisp).

Honestly the best way to learn to use Emacs today is probably not using it for code at all, but org-mode and plaintext editing. That way you can learn the editor and not get bogged down in creating/configuring IDE features.


I've been using emacs for years, and I use org to write latex documents because writing actual latex is awful, but I don't really see what drives such org mode fanaticism.

You're at a bbq and someone invites you to a ski trip in 5 months, you need to check your schedule so you whip out your laptop to check the org calendar?

I just don't get how people can function putting "everything" into org.


I don't use org-agenda or calendar or anything. I also find them inconvenient. I just use org-mode for writing and organizing documents. Lecture notes, programming exercises, book notes, README's, daily TODO lists, journaling, and writing a blog (exporting to Hugo), and of course writing my emacs config in a literate style with org-babel-tangle. It's a super versatile format with great ergonomic commands and a large community.


You can nicely suggest that you will check your calendar and not answer on the spot.

If you didn't have the flexibility to move your work anyway you probably should not go.


To be honest, as a sometime Emacs user, I'm not sure it's that compelling to learn emacs at all these days if you don't already know it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: