Disable all Emacs c-mode reformatting, insertion/refusal, cursor jumps

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:

  1. Reformats other than if I C-<command> or M-<command> ask it to.
  2. Moves my cursor around the source, even momentarily, unless I asked for it. For example, closing parens/braces highlighting the matching one.
  3. 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.
  4. 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:

  • C-x C-l a.k.a. c-toggle-electric-state a.k.a. (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-backslashes which 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-mode which 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.


Category: c# Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.196 (s). 12 q(s)