Subject: Re: bug#15767: 24.3; [patch] electric-indent-mode bug
From: Stefan Monnier <[email-masked]>
To: Dave Abrahams <[email-masked]>
Cc: [email-masked]
Date: Mon, 04 Nov 2013 15:04:31 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

>   (electric-indent-mode)
>   (electric-layout-mode)
>   (setq electric-indent-chars (append "{}" electric-indent-chars))
>   (setq electric-layout-rules '((?\{ . after) (?\} . before)))

> 3. type `f o o SPC {'

Thanks.  Your patch defeated a useful case, so I replaced it with the
one below,

        Stefan

--- lisp/electric.el	2013-10-07 18:51:26 +0000
+++ lisp/electric.el	2013-11-04 20:01:20 +0000
@@ -251,9 +251,10 @@
             ;; whereas we need `move after insertion', so we do the
             ;; save/restore by hand.
             (goto-char before)
+	    (when (eolp)
             ;; Remove the trailing whitespace after indentation because
             ;; indentation may (re)introduce the whitespace.
-            (delete-horizontal-space t))))
+	      (delete-horizontal-space t)))))
       (unless (or (memq indent-line-function '(indent-to-left-margin))
                   (and electric-indent-inhibit
                        (> pos (line-beginning-position))))