From: Tassilo Horn <tsdh@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 34160@debbugs.gnu.org, emacs-devel@gnu.org
Subject: bug#34160: About commit bff64115a0ad081282e0f99305f41c8dd1917d67, bug#34160, json.el
Date: Wed, 31 Jul 2019 21:30:12 +0200 [thread overview]
Message-ID: <16c4982bea8.27dc.69bc538c4644581689883e654f15bce0__6606.06985199905$1564601476$gmane$org@gnu.org> (raw)
In-Reply-To: <87a7cuvyg3.fsf@mouse.gnus.org>
> 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
next prev parent reply other threads:[~2019-07-31 19:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 17:46 bug#34160: json-pretty-print deletes everything after first JSON object Albert Heinle
2019-07-09 18:41 ` Lars Ingebrigtsen
2019-07-10 8:53 ` Glenn Morris
2019-07-10 11:24 ` Lars Ingebrigtsen
[not found] ` <87ef26ac17.fsf@gnu.org>
2019-07-31 15:38 ` bug#34160: About commit bff64115a0ad081282e0f99305f41c8dd1917d67, bug#34160, json.el Eli Zaretskii
[not found] ` <837e7yi57y.fsf@gnu.org>
2019-07-31 18:40 ` Tassilo Horn
[not found] ` <16c4954f400.27dc.69bc538c4644581689883e654f15bce0@gnu.org>
2019-07-31 18:48 ` Eli Zaretskii
2019-07-31 18:41 ` Lars Ingebrigtsen
[not found] ` <87a7cuvyg3.fsf@mouse.gnus.org>
2019-07-31 19:30 ` Tassilo Horn [this message]
[not found] ` <16c4982bea8.27dc.69bc538c4644581689883e654f15bce0@gnu.org>
2019-07-31 20:21 ` Lars Ingebrigtsen
[not found] ` <87v9vinefd.fsf@mouse.gnus.org>
2019-08-01 4:54 ` Tassilo Horn
[not found] ` <877e7xjxjj.fsf@gnu.org>
2019-08-01 11:11 ` Lars Ingebrigtsen
[not found] ` <87ef25nns3.fsf@mouse.gnus.org>
2019-08-01 12:16 ` Tassilo Horn
[not found] ` <8736iljd31.fsf@gnu.org>
2019-08-02 16:16 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='16c4982bea8.27dc.69bc538c4644581689883e654f15bce0__6606.06985199905$1564601476$gmane$org@gnu.org' \
--to=tsdh@gnu.org \
--cc=34160@debbugs.gnu.org \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).