On Tue, 27 Apr 2021, Dmitry Gutov wrote: > On 26.04.2021 21:28, Peter Oliver wrote: > >> Two patches are attached to address this: >> >> - The first patch adds a new choice to ruby-insert-encoding-magic-comment, >> unless-utf8, which causes the magic comment not to be inserted if the >> encoding is UTF-8. >> >> - The second patch, perhaps more controversially, makes this the default. > > Both changes make sense to me. > > However, I've looked at the existing code and found a prior change which > intended for this to be more customizable already, yet had a minor bug. > > Please try out the following patch: That works for me, and I think is more straightforward than my approach. Thanks. Attached is an additional patch which adapts the tests added in my patch for your patch. -- Peter Oliver