From ba2a19d9415d441398c174f97e17c3f40bc4d411 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: http://svn.ruby-lang.org/repos/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 609c7509b..659158110 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