From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bozhidar Batsov Newsgroups: gmane.emacs.devel Subject: Re: Subject: [PATCH] * lisp/progmodes/ruby-mode.el: Set `ruby-insert-encoding-magic-comment' to nil by default. Date: Wed, 6 Nov 2013 19:10:11 +0200 Message-ID: References: <61BBE6C8D4D349B6963A0F429237A3A8@gmail.com> <87txfvad0a.fsf@yandex.ru> <52755D62.1070700@yandex.ru> <87wqkpalgl.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=001a11363f9ed14c3e04ea853885 X-Trace: ger.gmane.org 1383757828 6363 80.91.229.3 (6 Nov 2013 17:10:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Nov 2013 17:10:28 +0000 (UTC) Cc: emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 06 18:10:30 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ve6cc-0005I2-4I for ged-emacs-devel@m.gmane.org; Wed, 06 Nov 2013 18:10:26 +0100 Original-Received: from localhost ([::1]:35101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve6cb-00038u-Ly for ged-emacs-devel@m.gmane.org; Wed, 06 Nov 2013 12:10:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve6cU-00037o-8q for emacs-devel@gnu.org; Wed, 06 Nov 2013 12:10:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve6cO-0008T2-Ko for emacs-devel@gnu.org; Wed, 06 Nov 2013 12:10:18 -0500 Original-Received: from mail-ob0-x22a.google.com ([2607:f8b0:4003:c01::22a]:52832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve6cO-0008Sf-Ef for emacs-devel@gnu.org; Wed, 06 Nov 2013 12:10:12 -0500 Original-Received: by mail-ob0-f170.google.com with SMTP id wp18so10444090obc.15 for ; Wed, 06 Nov 2013 09:10:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=M89axt0l1UnrnTrC8zycp0rc2Wcqy6fsvp/ACvCsoIw=; b=AbzXKSnpdpiSP5S+qsVhPjFiO7O3lNRnrBvvSW52YuwpEKzXsnPEiX7VMbcmvZkwj3 g2wVMF8NxniOS2iRnRhAUyWHb3ZY/m+KLDekqQdp/xS7RIAN1eKoTLtgtuXmFN+cTaeR wrYuppf583wL7r4nSqwiz3KiHw3ghRiQ1cmCzEylj6CV3TwP4dmgs+kQi3DPbXeIUuYC Dx9GBJ7VSy1FPEPIQbtNhQHRZx1TJqrwyZPzzR2fte78JAsLt20wuMbTMZosQYkLSImB 8BSf98iUL+dgqqCPndPRDnm76GcDQJYMTbMBBf65Bn7rBQFswjZAV2zLJoCM4YvS1hjW wWQg== X-Received: by 10.60.230.197 with SMTP id ta5mr3527891oec.16.1383757811533; Wed, 06 Nov 2013 09:10:11 -0800 (PST) Original-Received: by 10.76.131.116 with HTTP; Wed, 6 Nov 2013 09:10:11 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: 07GnXDFWXph4dp26IdJiIL4bZ90 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:165008 Archived-At: --001a11363f9ed14c3e04ea853885 Content-Type: multipart/alternative; boundary=001a11363f9ed14c3904ea853883 --001a11363f9ed14c3904ea853883 Content-Type: text/plain; charset=UTF-8 Here's a patch for making the comment format customizable. How does it look to you? I'll send later another patch with the always-utf8 customization we discussed. On 4 November 2013 15:40, Bozhidar Batsov wrote: > OK. I'll implement the discussed customizations. > > > On 3 November 2013 11:22, Dmitry Gutov wrote: > >> Bozhidar Batsov writes: >> >> > Sorry about the lack of clarity - I meant that if you have a Ruby 2.0 >> only project you likely don't >> > want the insertion of utf-8 coding comments. >> > >> > ... >> > >> > Yeah, I'm aware of that. In my open source projects I still keep 1.9 >> compatibility and generally >> > include those cookies in every file. Since I want them included >> unconditionally (AFAIK many other >> > Ruby programmers do this as well for the sake of consistency) the >> magic-comment functionality in >> > ruby-mode is quite useless to me even for Ruby 1.9. >> >> Now I get it, thanks for the explanation. >> >> > If we add the option to include the magic >> > comment unconditionally that might increase the usefulness of the >> > setting for some people. >> >> Sure, as long as it's not on by default. For example, add a new possible >> value of `ruby-insert-encoding-magic-comment': `always'. Or `always-utf8'. >> >> In this case, `ruby-mode-set-encoding' might short-circuit the whole >> encoding detection logic and just always write `coding: utf-8'. >> > > --001a11363f9ed14c3904ea853883 Content-Type: text/html; charset=UTF-8
Here's a patch for making the comment format customizable. How does it look to you?


I'll send later another patch with the always-utf8 customization we discussed.


On 4 November 2013 15:40, Bozhidar Batsov <bozhidar@batsov.com> wrote:
OK. I'll implement the discussed customizations.


On 3 November 2013 11:22, Dmitry Gutov <dgutov@yandex.ru> wrote:
Bozhidar Batsov <bozhidar@batsov.com> writes:

> Sorry about the lack of clarity - I meant that if you have a Ruby 2.0 only project you likely don't
> want the insertion of utf-8 coding comments.
>
> ...
>
> Yeah, I'm aware of that. In my open source projects I still keep 1.9 compatibility and generally
> include those cookies in every file. Since I want them included unconditionally (AFAIK many other
> Ruby programmers do this as well for the sake of consistency) the magic-comment functionality in
> ruby-mode is quite useless to me even for Ruby 1.9.

Now I get it, thanks for the explanation.

> If we add the option to include the magic
> comment unconditionally that might increase the usefulness of the
> setting for some people.

Sure, as long as it's not on by default. For example, add a new possible
value of `ruby-insert-encoding-magic-comment': `always'. Or `always-utf8'.

In this case, `ruby-mode-set-encoding' might short-circuit the whole
encoding detection logic and just always write `coding: utf-8'.


--001a11363f9ed14c3904ea853883-- --001a11363f9ed14c3e04ea853885 Content-Type: application/octet-stream; name="0001-lisp-progmodes-ruby-mode.el-ruby-mode-set-encoding.patch" Content-Disposition: attachment; filename="0001-lisp-progmodes-ruby-mode.el-ruby-mode-set-encoding.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hnotnujz0 RnJvbSAzMjAyNjI0YmI1MzM5NjhjYzFiZGQ3YjRhOGM4NjY5YTlmYzRmOTY3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBCb3poaWRhciBCYXRzb3YgPGJvemhpZGFyQGJhdHNvdi5jb20+ CkRhdGU6IFdlZCwgNiBOb3YgMjAxMyAxOTowNDozNCArMDIwMApTdWJqZWN0OiBbUEFUQ0hdICog bGlzcC9wcm9nbW9kZXMvcnVieS1tb2RlLmVsIChydWJ5LW1vZGUtc2V0LWVuY29kaW5nKTogIAog TWFrZSBlbmNvZGluZyBjb21tZW50IGZvcm1hdCBjdXN0b21pemFibGUgdmlhCiBgcnVieS1lbmNv ZGluZy1tYWdpYy1jb21tZW50LXRlbXBsYXRlJy4KCi0tLQogbGlzcC9wcm9nbW9kZXMvcnVieS1t b2RlLmVsIHwgOSArKysrKysrKy0KIDEgZmlsZSBjaGFuZ2VkLCA4IGluc2VydGlvbnMoKyksIDEg ZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9saXNwL3Byb2dtb2Rlcy9ydWJ5LW1vZGUuZWwgYi9s aXNwL3Byb2dtb2Rlcy9ydWJ5LW1vZGUuZWw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naWMtY29tbWVudAotICAgICAg ICAgICAgICAgICAgICAgKGluc2VydCAiIyAtKi0gY29kaW5nOiAiIGNvZGluZy1zeXN0ZW0gIiAt Ki1cbiIpKSkpCisgICAgICAgICAgICAgICAgICAgICAoaW5zZXJ0CisgICAgICAgICAgICAgICAg ICAgICAgIiMiCisgICAgICAgICAgICAgICAgICAgICAgKGZvcm1hdCBydWJ5LWVuY29kaW5nLW1h Z2ljLWNvbW1lbnQtdGVtcGxhdGUgY29kaW5nLXN5c3RlbSkKKyAgICAgICAgICAgICAgICAgICAg ICAiXG4iKSkpKQogICAgICAgICAgICh3aGVuIChidWZmZXItbW9kaWZpZWQtcCkKICAgICAgICAg ICAgIChiYXNpYy1zYXZlLWJ1ZmZlci0xKSkpKSkpKQogCi0tIAoxLjguNAoK --001a11363f9ed14c3e04ea853885--