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

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

Re: delete all whitespace (space) in a region


From: Michael Heerdegen
Subject: Re: delete all whitespace (space) in a region
Date: Tue, 14 Nov 2023 10:33:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> The latter updates the end, whereas the previous keeps the old limit,
> which may do unexpected deletions.

Indeed.  In such cases using markers is useful:

  (unless (markerp end)
    (setq end (copy-marker end)))

If you want to be kind to the gc, invalidate the marker at the end of
the function:

  (move-marker end nil)


Michael.




reply via email to

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