From da4ad54e47972340399756467d682174601488ec Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 26 Apr 2007 04:54:01 +0000 Subject: [PATCH] * misc/ruby-style.el: new file. C/C++ style for ruby source code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ misc/ruby-style.el | 36 ++++++++++++++++++++++++++++++++++++ version.h | 6 +++--- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 misc/ruby-style.el diff --git a/ChangeLog b/ChangeLog index f7b6ecd1c9..51aa7cedde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Apr 26 13:54:51 2007 Nobuyoshi Nakada + + * misc/ruby-style.el: new file. C/C++ style for ruby source code. + Wed Apr 25 19:49:16 2007 Tanaka Akira * ext/socket/socket.c (unix_send_io, unix_recv_io): use CMSG_DATA to diff --git a/misc/ruby-style.el b/misc/ruby-style.el new file mode 100644 index 0000000000..1768789470 --- /dev/null +++ b/misc/ruby-style.el @@ -0,0 +1,36 @@ +;;; -*- emacs-lisp -*- +;;; C/C++ mode style for Ruby. + +(defun ruby-style-case-indent (x) + (save-excursion + (goto-char (cdr x)) + (if (looking-at "\\") + (- c-basic-offset + (% (current-column) c-basic-offset))))) + +(require 'cc-styles) +(c-add-style + "ruby" + '("bsd" + (c-basic-offset . 4) + (c-offsets-alist + (case-label . *) + (label . *) + (statement-case-intro . *) + (statement-case-open . *) + (statement-block-intro . (ruby-style-case-indent +)) + (access-label /) + ))) + +(defun ruby-style-c-mode () + (interactive) + (if (or (string-match "/ruby\\>" (buffer-file-name)) + (save-excursion + (goto-char (point-min)) + (let ((head (progn (forward-line 100) (point))) + (case-fold-search nil)) + (goto-char (point-min)) + (re-search-forward "Copyright (C) .* Yukihiro Matsumoto" head t)))) + (setq c-file-style "ruby"))) + +(provide 'ruby-style) diff --git a/version.h b/version.h index 9f8b0b6d10..31005db7c9 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-04-25" +#define RUBY_RELEASE_DATE "2007-04-26" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20070425 +#define RUBY_RELEASE_CODE 20070426 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 4 -#define RUBY_RELEASE_DAY 25 +#define RUBY_RELEASE_DAY 26 RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_release_date[];