Every mode in Emacs has its own rules for indentation. I don't want that. How can I disable it and have custom indentation rules for every mode?
Here's the docstring for the function
Indent line in proper way for current major mode. Normally, this is done by calling the function specified by the variable
indent-line-function. However, if the value of that variable is
indent-relative-maybe, handle it specially (since those functions are used for tabbing); in that case, indent by aligning to the previous non-blank line.
If you want to turn off indentation (but why...?) in a particular buffer, you can more or less achieve this via
M-: (setf indent-line-function #'indent-relative-maybe) (but have a look at
indent-relative-maybe's docstring for more information). If you want to make that the default for a given mode, put the line in the mode hook.
If you want to write your own indentation rules, you can
(setf indent-line-function #'your-custom-function) in the mode hook.
Please consider, however, that writing a custom indentation function is a non-trivial amount of work (browse the code for
lisp-indent-function and you'll see what I mean), so unless you have a really compelling reason to deviate from the default indentation style, it's probably not worth the effort. Moreover, it's arguably a bad idea: letting Emacs indent according to the default indentation rules means that your code is more likely to conform to general coding conventions, which will make it easier for other people to read your code.