bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48043: UTF-8 magic comment is unwelcome with recent Ruby versions


From: Peter Oliver
Subject: bug#48043: UTF-8 magic comment is unwelcome with recent Ruby versions
Date: Mon, 26 Apr 2021 19:28:21 +0100 (BST)

When saving a ruby-mode buffer, if the content is not plain ASCII, then the 
default behaviour is to add a specially-formatted comment that indicates the 
encoding to the Ruby interpreter.  E.g.,

# coding: utf-8

However, since Ruby 2.0 released in 2013, the default encoding for Ruby has 
been UTF-8.  Consequently, users of other editors tend not to include this 
comment when using UTF-8.  When you edit such a file with Emacs, you end up 
with a messy diff.

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.

--
Peter Oliver

Attachment: 0001-New-choice-for-ruby-insert-encoding-magic-comment-un.patch
Description: Text document

Attachment: 0002-Default-ruby-insert-encoding-magic-comment-to-unless.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]