GNU bug report logs - #15767
24.3; [patch] electric-indent-mode bug

Previous Next

Package: emacs;

Reported by: Dave Abrahams <dave <at> boostpro.com>

Date: Wed, 30 Oct 2013 23:43:02 UTC

Severity: minor

Tags: patch

Found in version 24.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 15767-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dave Abrahams <dave <at> boostpro.com>
Cc: 15767-done <at> debbugs.gnu.org
Subject: Re: bug#15767: 24.3; [patch] electric-indent-mode bug
Date: Mon, 04 Nov 2013 15:04:31 -0500
>   (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))))




This bug report was last modified 11 years and 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.