* 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
This commit is contained in:
parent
24af397fcd
commit
da4ad54e47
@ -1,3 +1,7 @@
|
|||||||
|
Thu Apr 26 13:54:51 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* misc/ruby-style.el: new file. C/C++ style for ruby source code.
|
||||||
|
|
||||||
Wed Apr 25 19:49:16 2007 Tanaka Akira <akr@fsij.org>
|
Wed Apr 25 19:49:16 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/socket.c (unix_send_io, unix_recv_io): use CMSG_DATA to
|
* ext/socket/socket.c (unix_send_io, unix_recv_io): use CMSG_DATA to
|
||||||
|
36
misc/ruby-style.el
Normal file
36
misc/ruby-style.el
Normal file
@ -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 "\\<case\\|default\\>")
|
||||||
|
(- 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)
|
@ -1,7 +1,7 @@
|
|||||||
#define RUBY_VERSION "1.9.0"
|
#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_VERSION_CODE 190
|
||||||
#define RUBY_RELEASE_CODE 20070425
|
#define RUBY_RELEASE_CODE 20070426
|
||||||
#define RUBY_PATCHLEVEL 0
|
#define RUBY_PATCHLEVEL 0
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2007
|
#define RUBY_RELEASE_YEAR 2007
|
||||||
#define RUBY_RELEASE_MONTH 4
|
#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_version[];
|
||||||
RUBY_EXTERN const char ruby_release_date[];
|
RUBY_EXTERN const char ruby_release_date[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user