[前][次][番号順一覧][スレッド一覧]

ruby-changes:31108

From: knu <ko1@a...>
Date: Tue, 8 Oct 2013 04:03:09 +0900 (JST)
Subject: [ruby-changes:31108] knu:r43187 (trunk): * misc/ruby-additional.el (ruby-mode-set-encoding): Use

knu	2013-10-08 04:03:03 +0900 (Tue, 08 Oct 2013)

  New Revision: 43187

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43187

  Log:
    * misc/ruby-additional.el (ruby-mode-set-encoding): Use
      `default-buffer-file-coding-system` if the :prefer-utf-8
      property is not available.
    
    * misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
    
    * misc/ruby-additional.el (ruby-encoding-map): Override the
      default value.

  Modified files:
    trunk/ChangeLog
    trunk/misc/ruby-additional.el
    trunk/misc/ruby-mode.el
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43186)
+++ ChangeLog	(revision 43187)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Oct  8 03:57:34 2013  Akinori MUSHA  <knu@i...>
+
+	* misc/ruby-additional.el (ruby-mode-set-encoding): Use
+	  `default-buffer-file-coding-system` if the :prefer-utf-8
+	  property is not available.
+
+	* misc/ruby-mode.el (ruby-mode-set-encoding): Ditto.
+
+	* misc/ruby-additional.el (ruby-encoding-map): Override the
+	  default value.
+
 Tue Oct  8 03:19:19 2013  Akinori MUSHA  <knu@i...>
 
 	* misc/ruby-additional.el (ruby-mode-set-encoding): Add support
Index: misc/ruby-mode.el
===================================================================
--- misc/ruby-mode.el	(revision 43186)
+++ misc/ruby-mode.el	(revision 43187)
@@ -355,8 +355,10 @@ Emacs to Ruby." https://github.com/ruby/ruby/blob/trunk/misc/ruby-mode.el#L355
                 (let ((coding-type (coding-system-get coding-system :coding-type)))
                   (cond ((eq coding-type 'undecided)
                          (if nonascii
-                             (if (coding-system-get coding-system :prefer-utf-8)
-                                 'utf-8 'ascii-8bit)))
+                             (or (and (coding-system-get coding-system :prefer-utf-8)
+                                      'utf-8)
+                                 (coding-system-get default-buffer-file-coding-system :coding-type)
+                                 'ascii-8bit)))
                         ((memq coding-type '(utf-8 shift-jis))
                          coding-type))))))
          (coding-system
Index: misc/ruby-additional.el
===================================================================
--- misc/ruby-additional.el	(revision 43186)
+++ misc/ruby-additional.el	(revision 43187)
@@ -73,12 +73,17 @@ https://github.com/ruby/ruby/blob/trunk/misc/ruby-additional.el#L73
        (or (ruby-brace-to-do-end)
            (ruby-do-end-to-brace)))
 
-     (defcustom ruby-encoding-map
+     (defconst ruby-default-encoding-map
        '((us-ascii       . nil)       ;; Do not put coding: us-ascii
          (utf-8          . nil)       ;; Do not put coding: utf-8
          (shift-jis      . cp932)     ;; Emacs charset name of Shift_JIS
          (shift_jis      . cp932)     ;; MIME charset name of Shift_JIS
          (japanese-cp932 . cp932))    ;; Emacs charset name of CP932
+       )
+
+     (custom-set-default 'ruby-encoding-map ruby-default-encoding-map)
+
+     (defcustom ruby-encoding-map ruby-default-encoding-map
        "Alist to map encoding name from Emacs to Ruby.
 Associating an encoding name with nil means it needs not be
 explicitly declared in magic comment."
@@ -107,8 +112,10 @@ Emacs to Ruby." https://github.com/ruby/ruby/blob/trunk/misc/ruby-additional.el#L112
                      (let ((coding-type (coding-system-get coding-system :coding-type)))
                        (cond ((eq coding-type 'undecided)
                               (if nonascii
-                                  (if (coding-system-get coding-system :prefer-utf-8)
-                                      'utf-8 'ascii-8bit)))
+                                  (or (and (coding-system-get coding-system :prefer-utf-8)
+                                           'utf-8)
+                                      (coding-system-get default-buffer-file-coding-system :coding-type)
+                                      'ascii-8bit)))
                              ((memq coding-type '(utf-8 shift-jis))
                               coding-type))))))
               (coding-system

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]