# HG changeset patch # User Martin Stjernholm # Date 1061898603 0 # Node ID ea32bf7cfca163042a9abeb51a02e4269c090d2f # Parent 9bdd2608958eb6263eaff27ba41bbf180e618009 (c-electric-brace): Work around for a misfeature in `expand-abbrev' which caused electric keywords like "else" to disappear if an open brace was typed directly afterwards. diff -r 9bdd2608958e -r ea32bf7cfca1 lisp/progmodes/cc-cmds.el --- a/lisp/progmodes/cc-cmds.el Tue Aug 26 08:58:11 2003 +0000 +++ b/lisp/progmodes/cc-cmds.el Tue Aug 26 11:50:03 2003 +0000 @@ -498,10 +498,19 @@ (when (save-excursion (skip-chars-backward " \t") (not (bolp))) + (c-newline-and-indent) + ;; Set markers around the newline and indention inserted + ;; above. We insert the start marker here and not before + ;; the call to kludge around a misfeature in expand-abbrev: + ;; If the line contains e.g. "else" then expand-abbrev will + ;; be called when c-newline-and-indent inserts the newline. + ;; That function first removes the abbrev "else" and then + ;; inserts the expansion, which is an identical "else" in + ;; this case. So the marker that we put after "else" would + ;; end up before it. (setq delete-temp-newline - (list (point-marker))) - (c-newline-and-indent) - (setcdr delete-temp-newline (point-marker))) + (cons (copy-marker (c-point 'eopl) t) + (point-marker)))) (unwind-protect (progn (if (eq last-command-char ?{)