Search code examples
htmlemacsaquamacs

aquamacs require-final-newline


I'm using aquatics for rails development and thanks to some inline-block issues I have a situation where I need to render partials without a newline at the end.

The problem is when I save aquamacs always adds a newline to the end of the file.

I have tried adding (setq require-final-newline) in my .emacs file but it doesn't solve the issue.


Solution

  • Try setting the value in the ruby-mode-hook in your emacs init file. For example, for Ruby mode:

    (add-hook 'ruby-mode-hook '(lambda ()
                                 (setq require-final-newline nil)
                                 (setq mode-require-final-newline nil)))
    

    EDIT: Ruby mode explicitly sets on "require-final-newline" as a file local variable (which is why your .emacs setting isn't working) so you have to set both variables in the hook. I don't program in Ruby so I'm not sure why the author of ruby-mode sets "require-final-newline" on so there may be some negative side-effects to turning it off. However, the above code should do what you asked for.