Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • This worked for me when others on this page did not. Commented Feb 27, 2015 at 21:35
  • Works in emacs 26.3 Commented Apr 14, 2020 at 20:46
  • @Saurabh On what system? Here on Win10 64, no love. NONE of these solutions have any effect. Emacs 26.4. C++ - It's always 2 spaces, no exceptions. Commented Nov 22, 2022 at 22:05
  • @ChuckkHubbard -- I trust you are not using the text-mode-hook to try and alter the behavior of a major mode to edit C++ files? Moreover, a major-mode such cc-mode, etc. may require slightly different treatment depending upon what variables are being used ... type C-h m to see what major-mode is at issue. Commented Nov 22, 2022 at 22:16
  • @lawlist Yes, I figured it out; though I actually wanted the same setting for all languages, but I guess I have to do each one. Anyone else with my hangup: M-x customize-groups emacs-Programming-Languages-C-C basic offset = override style settings did it for me. Commented Nov 22, 2022 at 22:26