5 ;;; C/C++ mode style for Ruby.
8 ;;; created at: Thu Apr 26 13:54:01 JST 2007
11 (defconst ruby-style-revision
"$Revision$"
12 "Ruby style revision string.")
14 (defconst ruby-style-version
16 (string-match "[0-9.]+" ruby-style-revision
)
17 (substring ruby-style-revision
(match-beginning 0) (match-end 0)))
18 "Ruby style version number.")
20 (defun ruby-style-case-indent (x)
23 (unless (progn (backward-up-list) (back-to-indentation)
26 (if (looking-at "\\<case\\|default\\>") '*))))
28 (defun ruby-style-label-indent (x)
31 (unless (progn (backward-up-list) (back-to-indentation)
38 (if (looking-at "\\<switch\\>") '/))
47 (indent-tabs-mode . t
)
50 (label .
(ruby-style-label-indent *))
51 (statement-case-intro .
*)
52 (statement-case-open .
*)
53 (statement-block-intro .
(ruby-style-case-indent +))
57 (defun ruby-style-c-mode ()
59 (if (or (string-match "/ruby\\>" (buffer-file-name))
61 (goto-char (point-min))
62 (let ((head (progn (forward-line 100) (point)))
63 (case-fold-search nil
))
64 (goto-char (point-min))
65 (re-search-forward "Copyright (C) .* Yukihiro Matsumoto" head t
))))
66 (setq c-file-style
"ruby")))