emacs-devel
[Top][All Lists]
Advanced

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

Re: bug#34160: About commit bff64115a0ad081282e0f99305f41c8dd1917d67, bu


From: Tassilo Horn
Subject: Re: bug#34160: About commit bff64115a0ad081282e0f99305f41c8dd1917d67, bug#34160, json.el
Date: Wed, 31 Jul 2019 21:30:12 +0200
User-agent: AquaMail/1.20.0-1462 (build: 102100002)

The user referred to
"http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/json.el#n740";,
which doesn't look like Emacs 24?

Ah, might be.

Could you please reinstall the feature or describe why it is not
feasible to keep it?

As the bug in question described -- pretty-printing a JSON region would
silently delete everything but the first JSON object, which doesn't seem
like optimal behaviour for a pretty-printing function.

Obviously not. :-)

If there's a problem where point is moved unnecessarily, then that
should be fixed, of course.  Do you have a test case?

It's not just moving point. replace-region-contents also keeps marks, text properties and fontification intact. So we should definitely be using it here.

The loop over all json objects in the region you've added is correct. It's just that I beg you to drop the delete-region / insert in favor of replace-region-contents.

json-read advances point until the end of the read json. This can be used to give the right region (not the complete region as I did) to the repeated replace-region-contents calls.

Feel free to give it a try. Otherwise I'll do it on the weekend.

For a test case for point keeping its position in the json: use my command from my original mail and an arbitrary json file and invoke it while point is somewhere inside the json object.

Bye,
 Tassilo





reply via email to

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