In some files, especially .rb I have a problem where emacs forces me to have the following encoding line.
# -*- coding: utf-8 -*-
Even if I delete the line it will get written again once I save my file.
Is it possible to disable this feature?
It looks like this is part of the ruby-mode in emacs.
I found a link to an article that shows how to edit the ruby-mode.el file. Not sure if it works, but there is also a comment on that article that may work better:
(setq ruby-insert-encoding-magic-comment nil)
If instead of using ruby-mode your are using enh-ruby-mode you should set this variable:
(setq enh-ruby-add-encoding-comment-on-save nil)
Links:
Fix: Emacs/Aquamacs keeps adding encoding comments to my files
Also, semi-related question but pertinent answer by Michael Kohl: How can I avoid putting the magic encoding comment on top of every UTF-8 file in Ruby 1.9?
Enh-ruby-mode comment encoding line
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With