I have the following in my .emacs file.

(require 'astyle)
(add-hook 'c-mode-hook (lambda () (setq astyle-on-save-mode t)))
(add-hook 'c++-mode-hook (lambda () (setq astyle-on-save-mode t)))

For files ending in .c or .cpp everything is golden. Each time I save I see a "formatting" message and the buffer is correctly formatted prior to save.

With .h files, not so much.

Is there an h-mode-hook or is this a known bug in Emacs?

The buffer clearly "thinks" it should be running astyle.

buffer info line

When I save, it does nothing. When I execute "astyle" from the command prompt I see the buffer perfectly formatted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.