[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whi
From: |
martin rudalics |
Subject: |
bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace |
Date: |
Tue, 27 Oct 2015 09:05:52 +0100 |
> Now, the question is, should skip-syntax-backward preserve the
> match data, or must delete-trailing-whitespace be coded defensively?
The latter.
> The
> usual policy has been that code that needs the match data preserved should
> make sure itself that it is so.
Shouldn't we remove that "\\s-$" rigmarole? Something like the largely
untested
(let ((end-marker (copy-marker (or end (point-max))))
old-bol new-eol new-bol)
(goto-char (or start (point-min)))
(while (re-search-forward "\\\n" end-marker t)
(setq new-bol (point))
(goto-char (setq new-eol (match-beginning 0)))
(if (or (zerop (skip-syntax-backward
"-" (or old-bol (line-beginning-position))))
(looking-at-p ".*\f"))
(goto-char new-bol)
(delete-region (point) new-eol)
(forward-char))
(setq old-bol (point)))
It's still not very clean (should line-beginning-position be allowed to
go before START?) so if someone wants to polish it up ....
martin
- bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace, Markus Triska, 2015/10/26
- bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace, Andreas Schwab, 2015/10/27
- bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace, Juanma Barranquero, 2015/10/27
- bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace, martin rudalics, 2015/10/27
- bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace, Andreas Schwab, 2015/10/27
- bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace, Juanma Barranquero, 2015/10/27
- bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace, Juanma Barranquero, 2015/10/27
- bug#21766: 25.0.50; delete-trailing-whitespace sometimes deletes non-whitespace, Stephen Leake, 2015/10/27