Commit 0b966e89 authored by Martin Stjernholm's avatar Martin Stjernholm
Browse files

(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.
parent 4036ed83
...@@ -498,10 +498,19 @@ This function does various newline cleanups based on the value of ...@@ -498,10 +498,19 @@ This function does various newline cleanups based on the value of
(when (save-excursion (when (save-excursion
(skip-chars-backward " \t") (skip-chars-backward " \t")
(not (bolp))) (not (bolp)))
(setq delete-temp-newline
(list (point-marker)))
(c-newline-and-indent) (c-newline-and-indent)
(setcdr delete-temp-newline (point-marker))) ;; 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
(cons (copy-marker (c-point 'eopl) t)
(point-marker))))
(unwind-protect (unwind-protect
(progn (progn
(if (eq last-command-char ?{) (if (eq last-command-char ?{)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment