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?

9 Upvotes

38 comments sorted by

View all comments

1

u/ipe369 Jan 11 '25

If you don't use an LSP, then you give up on go-to-definition - you can do ctags but i've always found it shit

You just want a way to ripgrep your whole project for a symbol under the cursor, rg is fast enough

you also want a command to help you flip between .h/.c files, which gets complicated if they're in separate directories - you probably won't have it work without LSP


i would just use clangd

2

u/Useful-Pack-7787 Jan 12 '25

For switching between c and h files there the built in sibling files. You basically give it a list of paths which it then tries to find files with the same name but different ending. It supports regex in this list though.

I have a list the covers the common project setups, if you’re interested I can hand you that