emacs-devel
[Top][All Lists]
Advanced

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

Re: Subject: [PATCH] * lisp/progmodes/ruby-mode.el: Set `ruby-insert-enc


From: Bozhidar Batsov
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

On 6 November 2013 23:45, Dmitry Gutov <address@hidden> 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.


reply via email to

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