summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--misc/ruby-mode.el31
-rw-r--r--version.h6
3 files changed, 29 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index e7326d5faf..26b516cdd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Jan 29 00:10:00 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-mode-set-encoding): updates magic comment.
+
Mon Jan 28 23:47:52 2008 NARUSE, Yui <naruse@ruby-lang.org>
* parse.y (rb_id2str, ripper_initialize, Init_ripper):
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index 20a81f26e1..59efd66f66 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -234,21 +234,34 @@ Also ignores spaces after parenthesis when 'space."
(make-local-variable 'paragraph-ignore-fill-prefix)
(setq paragraph-ignore-fill-prefix t))
+(eval-when-compile
+ (unless (fboundp 'coding-system-to-mime-charset)
+ (defun coding-system-to-mime-charset (coding-system)
+ (coding-system-change-eol-conversion coding-system nil))))
+
(defun ruby-mode-set-encoding ()
(save-excursion
(widen)
(goto-char (point-min))
(when (re-search-forward "[^\0-\177]" nil t)
(goto-char (point-min))
- (if (looking-at "^#![^\n]*ruby") (beginning-of-line 2))
- (unless (looking-at "\s*#\.*coding\s*[:=]")
- (insert "# -*- coding: "
- (let ((coding-system (coding-system-to-mime-charset (or coding-system-for-write
- buffer-file-coding-system))))
- (if coding-system
- (symbol-name coding-system)
- "ascii-8bit"))
- " -*-\n")))))
+ (let ((coding-system
+ (coding-system-to-mime-charset
+ (or coding-system-for-write
+ buffer-file-coding-system))))
+ (setq coding-system
+ (if coding-system
+ (symbol-name coding-system)
+ "ascii-8bit"))
+ (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)
+ (goto-char (match-beginning 2))
+ (delete-region (point) (match-end 2))
+ (insert coding-system)))
+ ((looking-at "\\s *#.*coding\\s *[:=]"))
+ (t (insert "# -*- coding: " coding-system " -*-\n"))
+ )))))
;;;###autoload
(defun ruby-mode ()
diff --git a/version.h b/version.h
index 8f7a23cde3..a73ee2b3dd 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2008-01-28"
+#define RUBY_RELEASE_DATE "2008-01-29"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20080128
+#define RUBY_RELEASE_CODE 20080129
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 1
-#define RUBY_RELEASE_DAY 28
+#define RUBY_RELEASE_DAY 29
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];