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: Thu, 7 Nov 2013 12:23:22 +0200 Message-ID: References: <61BBE6C8D4D349B6963A0F429237A3A8@gmail.com> <87txfvad0a.fsf@yandex.ru> <52755D62.1070700@yandex.ru> <87wqkpalgl.fsf@yandex.ru> <527AB880.4040207@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8fb1fbfec033d704ea93a775 X-Trace: ger.gmane.org 1383819811 29044 80.91.229.3 (7 Nov 2013 10:23:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Nov 2013 10:23:31 +0000 (UTC) Cc: emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 07 11:23:35 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 1VeMkP-0004q2-3e for ged-emacs-devel@m.gmane.org; Thu, 07 Nov 2013 11:23:33 +0100 Original-Received: from localhost ([::1]:39455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeMkO-0006GJ-NJ for ged-emacs-devel@m.gmane.org; Thu, 07 Nov 2013 05:23:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeMkK-0006GD-Ga for emacs-devel@gnu.org; Thu, 07 Nov 2013 05:23:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeMkI-0001AI-SO for emacs-devel@gnu.org; Thu, 07 Nov 2013 05:23:28 -0500 Original-Received: from mail-oa0-x229.google.com ([2607:f8b0:4003:c02::229]:41421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeMkI-0001A8-Kh for emacs-devel@gnu.org; Thu, 07 Nov 2013 05:23:26 -0500 Original-Received: by mail-oa0-f41.google.com with SMTP id m1so591917oag.0 for ; Thu, 07 Nov 2013 02:23:22 -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=NmNP1vmoLJxhaECr+IPJNLFPji7nMMfaxrLJapkon34=; b=aWTB+TaLFG5mspRwPrI6h1KNVPTjFz3DW4ReF29z8C26SM7PwtsVxl5vCkApNNUbH+ srFvj/aEgw8OWQQ2Kut12T3FNyuUVqqNzRt7gNI3POvYKasG6w2oSUFleYGiwZrHe68H DvL9a6c9odsFnziGvcQ9UWW3OrxQ2jsnuTpRmvBFisvZXhvghDXiGH1A/T0zcxF4dl7n tQub8YCadoG3X/C/m+V4TnaWUCNynlRgxooeGML6z6NuEsENXY+DLKarwnOMZgGLyAAi LkTe7pNG1Kebqrt9AMFsXUH6So+F7138F6MJpXykTEAZh92sptpxMPLySywngCnoZ7cd L3Zw== X-Received: by 10.182.129.42 with SMTP id nt10mr6013293obb.19.1383819802324; Thu, 07 Nov 2013 02:23:22 -0800 (PST) Original-Received: by 10.76.21.173 with HTTP; Thu, 7 Nov 2013 02:23:22 -0800 (PST) In-Reply-To: <527AB880.4040207@yandex.ru> X-Google-Sender-Auth: JnjYpxVkZngUsZp-Ha9f6p2PKa0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::229 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:165029 Archived-At: --e89a8fb1fbfec033d704ea93a775 Content-Type: text/plain; charset=UTF-8 On 6 November 2013 23:45, Dmitry Gutov wrote: > On 06.11.2013 19:10, Bozhidar Batsov wrote: > >> Here's a patch for making the comment format customizable. How does it >> look to you? >> > > There might be a problem with weird template formats a user would be > technically allowed to choose: if the template doesn't match either of the > regexps used in `ruby-mode-set-encoding', the coding comment will be added > at the first line of the buffer, even if it already contains (the > non-standard) one. Not sure if that's a real problem, but maybe we should > relax the regexps and/or reject all non-matching templates. > Yeah, I though of this, but decided we can assume that few people would run into this and they'll probably understand their mistake pretty soon. > > Other than that, looks fine to me. Possible improvements, if you like: > > 1. Move "#" also inside the template. It'll make the code a bit simpler > and get rid of the implicit requirement that the template starts with a > space. > Actually the template should not necessary start with a space, that why I did not put the `#` in it. A comment like #coding:utf-8 is perfectly valid (albeit it looks kind of ugly). But yeah, might be easier for people of the `#` was in the template itself. > > 2. Add predefined values to the customize widget? (:type (choice ...)) > Allow the user to choose between Emacs-style and Ruby-style. > Makes sense. Btw, Dimitry - please add some info the ruby-mode.el about running the tests. I tried evaluating and running them manually, but this crashed my Emacs (the tests hogged my CPU completely and I had to kill Emacs). Maybe there is something wrong with them right now, or perhaps they should invoked in some manner I'm not aware of. --e89a8fb1fbfec033d704ea93a775 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 6 November 2013 23:45, Dmitry Gutov &= lt;dgutov@yandex.ru> wrote:
On 06.11.2013 19:10, Bozhidar Batsov wrote:
Here's a patch for making the comment format customizable. How does it<= br> look to you?

There might be a problem with weird template formats a user would be techni= cally allowed to choose: if the template doesn't match either of the re= gexps used in `ruby-mode-set-encoding', the coding comment will be adde= d at the first line of the buffer, even if it already contains (the non-sta= ndard) one. Not sure if that's a real problem, but maybe we should rela= x the regexps and/or reject all non-matching templates.

Yeah, I though of this, but decided we can= assume that few people would run into this and they'll probably unders= tand their mistake pretty soon.
=C2=A0

Other than that, looks fine to me. Possible improvements, if you like:

1. Move "#" also inside the template. It'll make the code a b= it simpler and get rid of the implicit requirement that the template starts= with a space.

Actually the template sh= ould not necessary start with a space, that why I did not put the `#` in it= . A comment like #coding:utf-8 is perfectly valid (albeit it looks kind of = ugly). But yeah, might be easier for people of the `#` was in the template = itself.
=C2=A0

2. Add predefined values to the customize widget? (:type (choice ...)) Allo= w the user to choose between Emacs-style and Ruby-style.

Makes sense.

Btw, Dimitry - plea= se add some info the ruby-mode.el about running the tests. I tried evaluati= ng and running them manually, but this crashed my Emacs (the tests hogged m= y CPU completely and I had to kill Emacs). Maybe there is something wrong w= ith them right now, or perhaps they should invoked in some manner I'm n= ot aware of.

--e89a8fb1fbfec033d704ea93a775--