I did some research and I've found few similar questions, but not a single one is able to help me.

Well, recently I've started using TTCN-3 major mode and I've found its indentation style awful. I've checked all available c-styles and there is no hope aswell.

I would like to turn off this whole smart indentations that are triggered for example by indent-for-tab-command or ending line with semicolon.

As far as I know, due to this:

(require 'cc-mode)                      ; ttcn-3-mode inherits from cc-mode

major mode TTCN-3 uses electric-indent-mode. I am trying to turn this off only for TTCN-3 but my wonderful lisp craft is not working:

(add-hook 'ttcn3-mode-hook (lambda () (electric-indent-mode -1)))

Could someone please tell me how to do this properly ?

Btw. Should I add hook after or before load function in my .emacs file ?

  • Try electric-indent-local-mode instead.
    – Dan
    Commented Jun 1, 2015 at 8:21
  • Not working either. Maybe I should rebind keys like TAB ; etc. ?
    – Scony
    Commented Jun 1, 2015 at 8:36

1 Answer 1


Well, it took extra hour, but here it is:

(add-hook 'ttcn3-mode-hook
          (lambda ()
            (setq-default indent-tabs-mode nil)
            (setq c-basic-offset 4)
            (c-toggle-electric-state -1)
            (setq c-syntactic-indentation nil)))

Last two lines are most crucial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.