On 8 November 2013 19:58, Dmitry Gutov wrote: > Bozhidar Batsov writes: > > > ------------------------------------------------------------ > > revno: 115036 > > revision-id: bozhidar@batsov.com-20131108160155-qqqzvzyv7buc7r1v > > parent: dgutov@yandex.ru-20131108112252-g8bofo4jray5k45v > > committer: Bozhidar Batsov > > branch nick: master > > timestamp: Fri 2013-11-08 18:01:55 +0200 > > > +(defcustom ruby-encoding-magic-comment-style 'ruby > > I though we agreed that the default won't change: still Emacs. AFAIK, > it has the benefit of making sure Emacs uses the specified encoding. > > I could be wrong, though. > I had a last minute change of heart regarding this. Based on my observations much more Ruby hackers use ruby-style encoding comments, so I thought this makes more sense as a default. AFAIK the Emacs encoding comments made a lot of difference in the pre-Emacs 24 era, but are not that important now. I've never had problems with Emacs 24 using only Ruby-style comments. I might be missing something, though. > > > + "The style of the magic encoding comment to use." > > + :type '(choice > > + (const :tag "Emacs Style" emacs) > > + (const :tag "Ruby Style" ruby) > > + (const :tag "Custom Style" custom)) > > + :group 'ruby) > > + > > +(defcustom ruby-custom-encoding-magic-comment-template "# coding: %s" > > The way this template is duplicated below for the `ruby' case doesn't > look too nice. Since you went ahead with symbol-based customization, > why not drop the "custom" case? > I'm not sure what exactly the problem is with the current code. Someone might want to use a different encoding format, so the custom option seems reasonable to me. The default value of the custom template doesn't really matter as users interested in using a custom format will surely alter it. > > > - (insert "# -*- coding: " coding-system " -*-\n")))) > > + (let ((encoding-magic-comment-template > > + (case ruby-encoding-magic-comment-style > > + ('ruby "# coding: %s") > > + ('emacs "# -*- coding: %s -*-") > > + ('custom > ruby-custom-encoding-magic-comment-template)))) >