I want to keep all syntax highlighting, autocomplete, commands etc. of Emacs c-mode (and I'll add in company-mode or similar shortly) but I want to disable everything in c-mode which:
- Reformats other than if I C-<command> or M-<command> ask it to.
- Moves my cursor around the source, even momentarily, unless I asked for it. For example, closing parens/braces highlighting the matching one.
- Ever i) inserts anything I didn't type (other than 1 Tab = 4 spaces) or ii) refuses to insert something I did type because formatting.
- Reformats, repaginates, realigns or otherwise edits the source for any reason, including on paste, on save, or because the moon is gibbous.
I've already set
(setq-default c-basic-offset 4) and
(setq-default indent-tabs-mode nil).
I have tried:
(setq-default c-electric-flag nil)which fixes some of 4, but Tab still reformats code when it feels inclined, and I'm guessing isn't alone; and doesn't fix 2 or 3.
c-auto-align-backslasheswhich fixes one above case only.
(setq c-syntactic-indentation nil)which partially fixes 4, but breaks 1 and 3 (for instance, Tab doesn't insert at the cursor), and doesn't fix 2.
text-modewhich obviously removes all the c-mode features I want to keep.
- Various searches and dives into https://www.gnu.org/software/emacs/manual/html_mono/ccmode.html, which carefully documents 2^1024 settings but doesn't exhibit an "all formatting off" switch that I can find.
- Scanning https://sourceforge.net/p/cc-mode/cc-mode/ci/default/tree/ for obvious flags to disable (*blork*?)
I've been at this for hours, so any help gratefully received.