emacs-devel
[Top][All Lists]
Advanced

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

Re: trunk r115036: * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding


From: Bozhidar Batsov
Subject: Re: trunk r115036: * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding): Use
Date: Fri, 8 Nov 2013 20:23:02 +0200

On 8 November 2013 19:58, Dmitry Gutov <address@hidden> wrote:
Bozhidar Batsov <address@hidden> writes:

> ------------------------------------------------------------
> revno: 115036
> revision-id: address@hidden
> parent: address@hidden
> committer: Bozhidar Batsov <address@hidden>
> 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))))


reply via email to

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