summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--misc/ruby-style.el26
2 files changed, 28 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index a01cd93ae3..8b8dd22f65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Sep 21 04:58:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-style.el (ruby-style-label-indent): fix for function top
+ level labels.
+
Fri Sep 21 02:11:22 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* re.c (rb_reg_match_m): evaluate a block if match. it would make
diff --git a/misc/ruby-style.el b/misc/ruby-style.el
index e0ed41fbc9..609c7509ba 100644
--- a/misc/ruby-style.el
+++ b/misc/ruby-style.el
@@ -1,5 +1,22 @@
;;; -*- emacs-lisp -*-
+;;;
+;;; ruby-style.el -
+;;;
;;; C/C++ mode style for Ruby.
+;;;
+;;; $Author$
+;;; $Date$
+;;; created at: Thu Apr 26 13:54:01 JST 2007
+;;;
+
+(defconst ruby-style-revision "$Revision$"
+ "Ruby style revision string.")
+
+(defconst ruby-style-version
+ (progn
+ (string-match "[0-9.]+" ruby-style-revision)
+ (substring ruby-style-revision (match-beginning 0) (match-end 0)))
+ "Ruby style version number.")
(defun ruby-style-case-indent (x)
(save-excursion
@@ -9,9 +26,12 @@
(defun ruby-style-label-indent (x)
(save-excursion
(goto-char (cdr x))
- (backward-up-list)
- (backward-sexp 2)
- (if (looking-at "\\<switch\\>") '/)))
+ (condition-case ()
+ (progn
+ (backward-up-list)
+ (backward-sexp 2)
+ (if (looking-at "\\<switch\\>") '/))
+ (error))))
(require 'cc-styles)
(c-add-style