bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35254: 27.0.50; cc-mode/electric-pair-mode/electric-layout-mode: bad


From: Alan Mackenzie
Subject: bug#35254: 27.0.50; cc-mode/electric-pair-mode/electric-layout-mode: bad trailing whitespace behavior in cc-mode
Date: Tue, 14 May 2019 09:34:15 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Stefan.

On Mon, May 13, 2019 at 19:32:49 -0400, Stefan Monnier wrote:
> >> Electric indent mode's post-self-insert hook entry has 3 effects:

> >> 1. Indent the previous line.
> >> 2. Remove trailing whitespace from the previous line.
> >> 3. Indent the current line (when at beginning of line).

> Note that `newline` itself already does some subset of 2 (before running
> electric-indent's post-self-insert hook).

Speaking of `newline', there's a strange regexp around this part:

            ;; If the newline leaves the previous line blank, and we
            ;; have a left margin, delete that from the blank line.
            (save-excursion
              (goto-char beforepos)
              (beginning-of-line)
              (and (looking-at "[ \t]$")      <=========================
                   (> (current-left-margin) 0)
                   (delete-region (point)
                                  (line-end-position))))


It's trying to match a single WS character.  Shouldn't this, perhaps, be
"[ \t]+$"?

[ .... ]

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]