emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] delete-trailing-whitespace on active region


From: Johan Bockgård
Subject: Re: [PATCH] delete-trailing-whitespace on active region
Date: Thu, 10 Feb 2011 22:31:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Deniz Dogan <address@hidden> writes:

> +      (while (re-search-forward "\\s-$" end t)
> +        (skip-syntax-backward "-" (save-excursion (forward-line 0) (point)))
> +        ;; Don't delete formfeeds, even if they are considered whitespace.
> +        (save-match-data
> +          (if (looking-at ".*\f")
> +              (goto-char (match-end 0))))
> +        (delete-region (point) (match-end 0))))))

You can't use the value of `end' to limit the search like that, since
the deletion changes the size of the region. (Use narrowing or a
marker.)




reply via email to

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