From 0c8032dae23d07d5086bd3fe8bb7cd33ac654bd6 Mon Sep 17 00:00:00 2001 From: Peter Oliver Date: Mon, 26 Apr 2021 17:24:59 +0100 Subject: [PATCH 2/2] Default ruby-insert-encoding-magic-comment to 'unless-utf8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most users don’t require a magic comment if their files are encoded using UTF-8, since that has been the default since Ruby 2.0. --- etc/NEWS | 4 ++++ lisp/progmodes/ruby-mode.el | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 8c1325cb09..961a3a76b1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -505,6 +505,10 @@ indentation is done using SMIE or with the old ad-hoc code. With this setting, when saving, a comment describing the file encoding will not be added if it is UTF-8. +*** 'ruby-insert-encoding-magic-comment' defaults to 'unless-utf8. +Most users don’t require a magic comment if their files are encoded +using UTF-8, since that has been the default since Ruby 2.0. + ** Icomplete +++ diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 822e1e1c14..3b04d3d83e 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -299,7 +299,7 @@ ruby-encoding-map explicitly declared in magic comment." :type '(repeat (cons (symbol :tag "From") (symbol :tag "To")))) -(defcustom ruby-insert-encoding-magic-comment t +(defcustom ruby-insert-encoding-magic-comment 'unless-utf8 "Insert a magic Ruby encoding comment upon save if this is non-nil. The encoding will be auto-detected. The format of the encoding comment is customizable via `ruby-encoding-magic-comment-style'. @@ -314,7 +314,8 @@ ruby-insert-encoding-magic-comment (const :tag "On, always UTF-8" always-utf8) (const :tag "On unless UTF-8" unless-utf8) (const :tag "Off" nil)) - :group 'ruby) + :group 'ruby + :version "28.1") (defcustom ruby-encoding-magic-comment-style 'ruby "The style of the magic encoding comment to use." -- 2.26.3