diff options
author | Juanma Barranquero <lekktu@gmail.com> | 2015-10-28 09:55:25 +0100 |
---|---|---|
committer | Juanma Barranquero <lekktu@gmail.com> | 2015-10-28 18:23:53 +0100 |
commit | 1f02cbea8b489ed7676110431aa36ad5abc47d9b (patch) | |
tree | 6ae651d3a02ed7d8a421b511e4e9efdffc7b8890 /lisp/simple.el | |
parent | 785c0d8326a5f82ca3b69d8e90ebb6fc5731e6d3 (diff) | |
download | emacs-1f02cbea8b489ed7676110431aa36ad5abc47d9b.tar.gz |
Fix bug#21766 and add test
* lisp/simple.el (delete-trailing-whitespace): Save match data when
calling `skip-syntax-backward'.
* test/automated/simple-test.el (simple-delete-trailing-whitespace):
New test.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 338a0600829..f6c580ffcd6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -609,7 +609,8 @@ buffer if the variable `delete-trailing-lines' is non-nil." (start (or start (point-min)))) (goto-char start) (while (re-search-forward "\\s-$" end-marker t) - (skip-syntax-backward "-" (line-beginning-position)) + (save-match-data + (skip-syntax-backward "-" (line-beginning-position))) ;; Don't delete formfeeds, even if they are considered whitespace. (if (looking-at-p ".*\f") (goto-char (match-end 0))) |