On 06.11.2013 19:10, Bozhidar Batsov wrote: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.
Here's a patch for making the comment format customizable. How does it
look to you?
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.
2. Add predefined values to the customize widget? (:type (choice ...)) Allow the user to choose between Emacs-style and Ruby-style.