From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#34160: About commit bff64115a0ad081282e0f99305f41c8dd1917d67, bug#34160, json.el Date: Wed, 31 Jul 2019 21:30:12 +0200 Message-ID: <16c4982bea8.27dc.69bc538c4644581689883e654f15bce0__6606.06985199905$1564601476$gmane$org@gnu.org> References: <87ef26ac17.fsf@gnu.org> <87a7cuvyg3.fsf@mouse.gnus.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="us-ascii" Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="154428"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: AquaMail/1.20.0-1462 (build: 102100002) Cc: 34160@debbugs.gnu.org, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 31 21:31:10 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hsuJa-000e1S-5A for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Jul 2019 21:31:10 +0200 Original-Received: from localhost ([::1]:43916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsuJY-00066N-Mw for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Jul 2019 15:31:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41505) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsuJT-00066H-9g for bug-gnu-emacs@gnu.org; Wed, 31 Jul 2019 15:31:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsuJS-0005k1-7h for bug-gnu-emacs@gnu.org; Wed, 31 Jul 2019 15:31:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44289) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsuJS-0005jv-5P for bug-gnu-emacs@gnu.org; Wed, 31 Jul 2019 15:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hsuJS-0001E3-0m for bug-gnu-emacs@gnu.org; Wed, 31 Jul 2019 15:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 31 Jul 2019 19:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34160 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 34160-submit@debbugs.gnu.org id=B34160.15646014304667 (code B ref 34160); Wed, 31 Jul 2019 19:31:01 +0000 Original-Received: (at 34160) by debbugs.gnu.org; 31 Jul 2019 19:30:30 +0000 Original-Received: from localhost ([127.0.0.1]:53110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hsuIu-0001DA-AE for submit@debbugs.gnu.org; Wed, 31 Jul 2019 15:30:30 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57021) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hsuIr-0001Ct-F8 for 34160@debbugs.gnu.org; Wed, 31 Jul 2019 15:30:25 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hsuIi-00050p-BE; Wed, 31 Jul 2019 15:30:18 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:33567) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1hsuIi-0005Nb-2W; Wed, 31 Jul 2019 15:30:16 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 57D9D222C4; Wed, 31 Jul 2019 15:30:15 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 31 Jul 2019 15:30:15 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrleehgddufeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvfffkjghffgfugggtgfesthekgidttdervdenucfhrhhomhepvfgrshhs ihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucffohhmrghinhepghhnuh drohhrghenucfkphepgeeirdektddrjedtrddvheenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefke ejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhf mhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Original-Received: from [192.168.0.107] (p2e504619.dip0.t-ipconnect.de [46.80.70.25]) by mail.messagingengine.com (Postfix) with ESMTPA id 4F2ED80059; Wed, 31 Jul 2019 15:30:14 -0400 (EDT) In-Reply-To: <87a7cuvyg3.fsf@mouse.gnus.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:164185 Archived-At: > 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