From 32865ef821a045b1bf14c4cfcfc52c70125b3794 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 26 Oct 2007 06:00:52 +0000 Subject: * misc/ruby-style.el (ruby-style-{case,label}-indent): adjust for labels inside switch block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- misc/ruby-style.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'misc/ruby-style.el') diff --git a/misc/ruby-style.el b/misc/ruby-style.el index 609c7509ba..6591581103 100644 --- a/misc/ruby-style.el +++ b/misc/ruby-style.el @@ -20,18 +20,22 @@ (defun ruby-style-case-indent (x) (save-excursion - (goto-char (cdr x)) - (if (looking-at "\\") '*))) + (unless (progn (backward-up-list) (back-to-indentation) + (> (point) (cdr x))) + (goto-char (cdr x)) + (if (looking-at "\\") '*)))) (defun ruby-style-label-indent (x) (save-excursion - (goto-char (cdr x)) - (condition-case () - (progn - (backward-up-list) - (backward-sexp 2) - (if (looking-at "\\") '/)) - (error)))) + (unless (progn (backward-up-list) (back-to-indentation) + (> (point) (cdr x))) + (goto-char (cdr x)) + (condition-case () + (progn + (backward-up-list) + (backward-sexp 2) + (if (looking-at "\\") '/)) + (error))))) (require 'cc-styles) (c-add-style -- cgit v1.2.3