News for hackers. Stuff that matters.
Re:How to Learn Emacs (2012) by bigdict on Friday September 08, 2023 @08:46PM (#37441086)
> 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.

Re:How to Learn Emacs (2012) by codemonkey-zeta on Friday September 08, 2023 @09:44PM (#37441369)
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.

Re:How to Learn Emacs (2012) by nvy on Friday September 08, 2023 @10:25PM (#37441601)
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.

Re:How to Learn Emacs (2012) by codemonkey-zeta on Friday September 08, 2023 @10:52PM (#37441775)
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.
Re:How to Learn Emacs (2012) by ungamedplayer on Saturday September 09, 2023 @12:01AM (#37442177)
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.

Re:How to Learn Emacs (2012) by jussij on Friday September 08, 2023 @09:52PM (#37441422)
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.
Re:How to Learn Emacs (2012) by vsundar on Friday September 08, 2023 @10:08PM (#37441501)
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

Re:How to Learn Emacs (2012) by G3rn0ti on Saturday September 09, 2023 @08:40AM (#37444666)
> 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.

Re:How to Learn Emacs (2012) by db48x on Monday September 11, 2023 @01:57AM (#37463408)
They could and should, though.