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

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

Re: save-excursion doesn't restore point with json-pretty-print


From: Eli Zaretskii
Subject: Re: save-excursion doesn't restore point with json-pretty-print
Date: Fri, 01 Feb 2019 12:11:14 +0200

> Date: Fri, 1 Feb 2019 10:55:16 +0100
> From: <tomas@tuxteam.de>
> 
> AFAIK the mechanism for save-excursion is to set a special marker
> to return to after the excursion.
> 
> Now the pretty print probably replaces the whole region in the
> process: the marker can't be at the same place where it was. If
> you're lucky, it'll be at one of both region's borders.

Yes, erasing the buffer makes all the markers point to BOB, and then
save-excursion won't work as expected.

Perhaps json-pretty-print could use the new replace-buffer-contents
function?  Although I'm not sure this will cure the problem, at least
not in all cases.



reply via email to

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