0

I've been using hide-ifdef-mode with c-mode buffers for a while, but it is quite tedious to have to manually run hide-ifdefs (C-c @ h) every time a block of code containing preprocessors changes.

Is there any way this can be run automatically? (for example during syntax highlighting)

Luctins
  • 120
  • 7

1 Answers1

0

After a while, I think I have found a viable solution: run hide-ifdefs on c-mode-hook's after-file-save hook like so:

  (add-hook 'c-mode-common-hook
             (lambda ()
               (hide-ifdef-mode)
               ;... your other hook code here
               (add-hook 'after-save-hook (lambda () (hide-ifdefs)))
               )
Luctins
  • 120
  • 7