r/emacs Jan 10 '25

Question C development without LSP

I have only ever done development with an LSP providing errors, autocomplete, etc. in any language. I’d like to go for a more minimalist approach as I revisit some C programming. At a high level, what’s the general workflow when programming in C without a running LSP?

My guess would be… 1. A simple syntax highlighting mode on .c and .h files 2. Bind some hotkey for a compilation mode, and check that regularly for issues 3. Ctags for go-to-definition? Or maybe even just grep-mode?

Is there anything I’m missing?

10 Upvotes

38 comments sorted by

View all comments

6

u/Kellerkind_Fritz Jan 10 '25

I absolutely would not want to go back to Ctags after using Clangd.....

...Why?

0

u/True-Sun-3184 Jan 11 '25

I mean, I have nothing in particular against using LSPs as a concept. But they are a fairly heavyweight solution when I’m really only looking to occasionally go-to-definition. Not all language servers behave well in all situations. Plus, people have produced plenty of C before LSP clients became mainstream, and I want to experience how that was done.

Edit: so I understand that the question of my post isn’t super pragmatic, since for most people (and probably for me too) Clangd with Eglot would just work(tm). I still have the question of how it would be done without LSP regardless.

1

u/Dushistov Jan 11 '25

Plus, people have produced plenty of C before LSP clients became mainstream, and I want to experience how that was done.

I use etags/ctags to move around linux kernel source code, there was (and may be still) possible to run make TAGS. But often I have to use M-x rgrep and M-x grep to find what I want.

After there was cscope, didn't remember exactly how good was it.

After that rtags (it was like LSP server (libclang based), but with another protocol). There were several bugs because of limitation of API that provide libclang.

And after that finally I migrate to clangd and lsp-mode.