From 661aa5c75ce7897653f8b662599452e7f746836a Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Fri, 20 Jul 2001 09:40:27 +0000 Subject: [PATCH] (delete-trailing-whitespace): Save match data around looking-at. From Markus Rost . --- lisp/simple.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index dec66469c10..51887986f60 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -239,8 +239,9 @@ A formfeed is not considered whitespace by this function." (while (re-search-forward "\\s-$" nil t) (skip-syntax-backward "-" (save-excursion (forward-line 0) (point))) ;; Don't delete formfeeds, even if they are considered whitespace. - (if (looking-at ".*\f") - (goto-char (match-end 0))) + (save-match-data + (if (looking-at ".*\f") + (goto-char (match-end 0)))) (delete-region (point) (match-end 0)))))) (defun newline-and-indent () -- 2.39.5