From 91851ae20af11011b1f018efe14f77aefabbfcad Mon Sep 17 00:00:00 2001 From: Jim Morris Date: Mon, 1 Feb 2010 23:22:03 -0800 Subject: [PATCH] disable brace lists entirely, now everything in braces will be handled as a statement list, fixing most of the indentation problems --- groovy-mode.el | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/groovy-mode.el b/groovy-mode.el index 2560298..a7df7d7 100644 --- a/groovy-mode.el +++ b/groovy-mode.el @@ -439,8 +439,7 @@ need for `java-font-lock-extra-types'.") ;; use defadvice to override the syntactic type if we have a ;; statement-cont, see if previous line has a virtual semicolon and if -;; so make it statement. if it is a brace-list, change to statement as -;; we don't have brace-lists in groovy they are usually closures +;; so make it statement. (defadvice c-guess-basic-syntax (after c-guess-basic-syntax-groovy activate) (save-excursion (let* ((ankpos (progn @@ -454,24 +453,21 @@ need for `java-font-lock-extra-types'.") (cond ((eq 'statement-cont curelem) (when (groovy-at-vsemi-p) ; if there is a virtual semi there then make it a statement + (message "changing from %s to statement" ad-return-value) (setq ad-return-value `((statement ,ankpos))))) ((eq 'topmost-intro-cont curelem) (when (groovy-at-vsemi-p) ; if there is a virtual semi there then make it a top-most-intro + (message "changing from %s to topmost-intro" ad-return-value) (setq ad-return-value `((topmost-intro ,ankpos))))) - ((eq 'brace-list-entry curelem) - (save-excursion (goto-char ankpos) - (if (looking-at c-label-kwds-regexp) ; if it is a case or default - (setq ad-return-value `((statement-case-intro ,ankpos))) - (setq ad-return-value `((statement ,ankpos)))))) ; else make statement - - ;; try to eliminate brace lists - ((eq 'brace-list-intro curelem) - (setq ad-return-value `((defun-block-intro ,ankpos)))) - )))) +;; This disables bracelists, as most of the time in groovy they are closures +(defadvice c-inside-bracelist-p (after c-inside-bracelist-p-groovy activate) + (setq ad-return-value nil)) + + ;; based on java-function-regexp ;; Complicated regexp to match method declarations in interfaces or classes ;; A nasty test case is: