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

ruby-changes:4283

From: ko1@a...
Date: Fri, 14 Mar 2008 11:24:52 +0900 (JST)
Subject: [ruby-changes:4283] nobu - Ruby:r15773 (trunk): * misc/ruby-mode.el (ruby-encoding-map, ruby-use-encoding-map): added

nobu	2008-03-14 11:24:32 +0900 (Fri, 14 Mar 2008)

  New Revision: 15773

  Modified files:
    trunk/ChangeLog
    trunk/misc/ruby-mode.el

  Log:
    * misc/ruby-mode.el (ruby-encoding-map, ruby-use-encoding-map): added
      to customize.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/ruby-mode.el?r1=15773&r2=15772&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15773&r2=15772&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15772)
+++ ChangeLog	(revision 15773)
@@ -1,3 +1,8 @@
+Fri Mar 14 11:24:30 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* misc/ruby-mode.el (ruby-encoding-map, ruby-use-encoding-map): added
+	  to customize.
+
 Fri Mar 14 10:37:15 2008  NARUSE, Yui  <naruse@r...>
 
 	* configure.in (int8_t, uint8_t,  int16_t,  uint16_t int32_t,
Index: misc/ruby-mode.el
===================================================================
--- misc/ruby-mode.el	(revision 15772)
+++ misc/ruby-mode.el	(revision 15773)
@@ -162,6 +162,14 @@
   "Default deep indent style."
   :options '(t nil space) :group 'ruby)
 
+(defcustom ruby-encoding-map '((shift_jis . cp932))
+  "Alist to map encoding name from emacs to ruby."
+  :group 'ruby)
+
+(defcustom ruby-use-encoding-map t
+  "*Use `ruby-encoding-map' to set encoding magic comment if this is non-nil."
+  :type 'boolean :group 'ruby)
+
 (eval-when-compile (require 'cl))
 (defun ruby-imenu-create-index-in-block (prefix beg end)
   (let ((index-alist '()) (case-fold-search nil)
@@ -251,11 +259,11 @@
 		  buffer-file-coding-system))))
 	(setq coding-system
 	      (if coding-system
-		  (symbol-name coding-system)
+		  (symbol-name
+		   (or (and ruby-use-encoding-map
+			    (cdr (assq coding-system ruby-encoding-map)))
+		       coding-system))
 		"ascii-8bit"))
-	;; special treat for compatibility with -Ks
-	(if (string-equal coding-system "shift_jis")
-	    (setq coding-system "cp932"))
 	(if (looking-at "^#![^\n]*ruby") (beginning-of-line 2))
 	(cond ((looking-at "\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]+\\)")
 	       (unless (string= (match-string 2) coding-system)

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

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