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
 

When using cs-ts-mode, it incorrectly forces me to use paranthesis. For example:

  if (whatever == -1)

it won't auto-indent the next line unless I use braces {} with the if statement, even if there is just one statement with a semi-colon after the if. Also, as I'm typing, it weirdly indents my functions as I type them.

Any way to fix these?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 10 months ago

Emacs has electric-indent-chars. Whenever a character in this set is pressed, Emacs re-indents the current line. And as the indentation calculation is not perfect, it can happen that when you create a new line, its indentation calculated incorrectly, and during editing you press some electric-indent-char, which then re-indents the line.