this post was submitted on 19 Nov 2023
1 points (100.0% liked)

Emacs

305 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

My only tab-related init.el config is:

(setq-default indent-tabs-mode nil) ;; indentation can't insert tabs
(setq-default tab-width 4) ;; make tab-width 4 (spaces)

but in c-ts-mode I have that the indentation only does and works with 2 spaces (I need to indent-region whole file otherwise to fix it). How can I make this back to 4?

top 5 comments
sorted by: hot top controversial new old
[–] wayToGoPotato@alien.top 1 points 10 months ago

Use editorconfig!

[–] 00-11@alien.top 1 points 10 months ago
[–] SnooPets20@alien.top 1 points 10 months ago

(setq c-default-style "stroustrup")

[–] bttertone@alien.top 1 points 10 months ago (1 children)

I think you’re looking for ‘c-basic-offset’, although I’d echo the sentiment that you should use a formatter instead. For that you can check out the reformatter package, which lets you setup hooks based on the programming mode to invoke the formatter of your choice, e.g. setup a hook for c/c++ to use clang format or whatever you’d

[–] SS4L1234@alien.top 1 points 10 months ago

c-basic-offset did not work. that was the first thing i tried.