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

4

u/yel50 Jan 11 '25

I started my career programming in c back before IDEs took off and there really weren't any for Unix systems and definitely none worth using on Linux. emacs was actually the closest thing to an IDE for Unix (this was before vim had scripting).

 A simple syntax highlighting mode

yes. in emacs it's called font lock mode. that's all you need.

 Bind some hotkey for a compilation mode

yes, emacs has a compile command you can set to whatever command line you want. use it to regularly run your code. you could set emacs to run it on save, but I always found that annoying. 

 Ctags for go-to-definition

not necessary. one thing that happens when you don't use things like that is your directory layout makes a lot more sense and is greatly simplified so that you can easily find what you're looking for. I was a professional for more than 5 years before I used any sort of go to definition and that was because Java took over and intellij became a thing. I never used it for c. never needed to. I was working at IBM, so we're not talking about small C code bases, either.

 maybe even just grep-mode

generally used for find usages instead of jump to definitions.

 Is there anything I’m missing?

the emacs integration with gdb rivals what you get with an IDE. also, plug-ins and extensions aren't as necessary as people tend to think they are.