From: Bill B. <wb...@gm...> - 2008-02-28 02:16:38
|
This is my second post about this. The first one got no response, and I have pretty much concluded that cc-mode is dead. But just in case, here's another go: The D programming language as a compile-time conditional construct that looks like this: static if (some_condition) { ... } else static if (other_condition) { ... } else { ... } Aside from the "static" everywhere it works just like a regular C if-then-else. The bug is that in cc-engine.el, c-add-stmt-syntax, it is making an assumption that all such constructs that need special handling for the else clauses start with an "if ---": ((and (eq step-type 'up) (>= (point) old-boi) (looking-at "else\\>[^_]") (save-excursion (goto-char old-pos) (looking-at "if\\>[^_]"))) ;; Special case to avoid deeper and deeper indentation ;; of "else if" clauses The (looking-at "if") part is the culprit. For D it needs to check for "if" or "static if". Changing to this fixes it: ((and (eq step-type 'up) (>= (point) old-boi) (looking-at "else\\>[^_]") (save-excursion (goto-char old-pos) ;;(looking-at "if\\>[^_]"))) (or (looking-at "if\\>[^_]") (looking-at "static\\>[^_]")))) ;; Special case to avoid deeper and deeper indentation ;; of "else if" clauses. // or "else static if" ) If there is some way to achieve the same effect in d-mode.el without changing cc-engine.el, then I'd be happy to hear it. This is cc-mode version 5.31.4. Regards, Bill Baxter |