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 15:09:54 +0200

> From: Robert Pluim <rpluim@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Fri, 01 Feb 2019 11:33:23 +0100
> 
> > 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.
> 
> replace-buffer-contents would be a lot easier to use in this context
> if it could take a string. Otherwise you have to create a buffer,
> select it, insert a string, then pass that buffer to
> replace-buffer-contents, delete the buffer.

json-read-from-string uses a temporary buffer anyway, so a couple of
trivial changes in json-pretty-print should do the trick.

IOW, we have buffer text to begin with, so going through strings is
the part that should be eliminated, not the other way around, IMO.



reply via email to

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