From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 13 04:40:44 2012 Received: (at submit) by debbugs.gnu.org; 13 Oct 2012 08:40:44 +0000 Received: from localhost ([127.0.0.1]:41955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMxH2-0000Wq-5G for submit@debbugs.gnu.org; Sat, 13 Oct 2012 04:40:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53462) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMxGz-0000We-4j for submit@debbugs.gnu.org; Sat, 13 Oct 2012 04:40:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMxG0-0006tX-Mu for submit@debbugs.gnu.org; Sat, 13 Oct 2012 04:39:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:50973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMxG0-0006tT-JT for submit@debbugs.gnu.org; Sat, 13 Oct 2012 04:39:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMxFz-0007v5-S2 for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 04:39:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMxFy-0006sh-Sc for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 04:39:39 -0400 Received: from mail-da0-f41.google.com ([209.85.210.41]:47799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMxFy-0006sH-MN for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 04:39:38 -0400 Received: by mail-da0-f41.google.com with SMTP id i14so1898221dad.0 for ; Sat, 13 Oct 2012 01:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=QlJHikGN8GT1choJkkd4h/Il2lCzooA2rHHFz6/YtzY=; b=TVEAfeZkUnOkYKPxYs5JCVK8gZYgbVjV0H+HSdfiTYziBByXOVKEst/9bh/hdlY+95 O2lUth1LDRh5qSAvKJWSe912mfFqjbW2E+0SJTMz/GhBUlAtcVTWScKm9eOAf83oGdxk JelUbCnzheMiqjVsWWICFSMI9E9TZVIrLmHZJovSHXa2TwlliggTHUO80T5akW+aa7q5 TT+GoujXdCZyY5ejWOirhvh5aZPQaoL2gco1sw5JUTpvigQPimRalVzu+ED11rzr/2PU bMqUfj3uuE/uPG1PcVHJffeX5jQD/qgVUpx1oGfmVp7jNISAfek/Dac6caU3EJnaJb4r wjCg== Received: by 10.68.224.161 with SMTP id rd1mr20982215pbc.49.1350117577626; Sat, 13 Oct 2012 01:39:37 -0700 (PDT) Received: from localhost ([119.255.41.67]) by mx.google.com with ESMTPS id i2sm5674994pay.31.2012.10.13.01.39.34 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 13 Oct 2012 01:39:36 -0700 (PDT) From: Leo To: bug-gnu-emacs@gnu.org Subject: 24.2; [FEATURE REQUEST] JSON pretty printer Date: Sat, 13 Oct 2012 16:39:25 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) It would be lovely if the included json.el could do pretty printing. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 13 17:57:18 2012 Received: (at 12634) by debbugs.gnu.org; 13 Oct 2012 21:57:18 +0000 Received: from localhost ([127.0.0.1]:42864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TN9hu-0006W1-EN for submit@debbugs.gnu.org; Sat, 13 Oct 2012 17:57:18 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:38053) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TN9hs-0006Vp-Ug for 12634@debbugs.gnu.org; Sat, 13 Oct 2012 17:57:17 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09FpZ6O/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="201495342" Received: from 69-165-158-142.dsl.teksavvy.com (HELO ceviche.home) ([69.165.158.142]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Oct 2012 17:56:12 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 92192660E0; Sat, 13 Oct 2012 17:56:10 -0400 (EDT) From: Stefan Monnier To: Leo Subject: Re: bug#12634: 24.2; [FEATURE REQUEST] JSON pretty printer Message-ID: References: Date: Sat, 13 Oct 2012 17:56:10 -0400 In-Reply-To: (Leo's message of "Sat, 13 Oct 2012 16:39:25 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > It would be lovely if the included json.el could do pretty printing. Patch welcome, Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 18 17:20:17 2012 Received: (at 12634) by debbugs.gnu.org; 18 Oct 2012 21:20:18 +0000 Received: from localhost ([127.0.0.1]:50520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TOxVp-0005rS-JA for submit@debbugs.gnu.org; Thu, 18 Oct 2012 17:20:17 -0400 Received: from mail-qc0-f172.google.com ([209.85.216.172]:32848) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TOxVo-0005rB-44 for 12634@debbugs.gnu.org; Thu, 18 Oct 2012 17:20:16 -0400 Received: by mail-qc0-f172.google.com with SMTP id s14so7987318qcg.3 for <12634@debbugs.gnu.org>; Thu, 18 Oct 2012 14:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=bM5ZtVGzlFCXd6mwc0G5bnGKLB9RxQS6RTrQhNRYGAk=; b=OtmH7XuyOPkUmZFCS0oKTa7UYaFdjDu8G8yXFJ0Qx7uHdps3Mxr15ESZAmkHCve8BF 0XXouPvebj93A6TK8GQ6YvzPhqWEOCvqCbuDnp9nrFYXwi2yWHfJsDLnvZol8TCNwLuU lrdijmwlGRfprfSPXgxjXQxuIQo0QU5iREAIWrx/iJczPc4LOMLUVTmG2U4MFkgVLK1S 9Hx2oi8ZtsNxYh3S/0kuiA2xtTwMKln7Vimy3TQDjBGDFf0VMzCrqVjW71MrNl5NgWKh lCfGzaBTpjqDRITZE+TDu2auExRPLF1zMId078xY1S9OvJ7O3o33pFZb3dz5cXNQHCml fT9g== MIME-Version: 1.0 Received: by 10.224.78.141 with SMTP id l13mr34506551qak.25.1350595123711; Thu, 18 Oct 2012 14:18:43 -0700 (PDT) Received: by 10.49.48.65 with HTTP; Thu, 18 Oct 2012 14:18:43 -0700 (PDT) Date: Thu, 18 Oct 2012 23:18:43 +0200 Message-ID: Subject: existing implementation From: =?UTF-8?Q?Aur=C3=A9lien_Aptel?= To: 12634@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12634 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.1 (/) Someone already made a pretty-print patch [1] and other utility functions [2]. 1: https://github.com/thorstadt/json.el 2: https://github.com/thorstadt/json-pretty-print.el From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 18 21:39:15 2012 Received: (at 12634) by debbugs.gnu.org; 19 Oct 2012 01:39:15 +0000 Received: from localhost ([127.0.0.1]:50750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TP1YR-00054Y-Ij for submit@debbugs.gnu.org; Thu, 18 Oct 2012 21:39:15 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:58558) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TP1YP-00054L-My for 12634@debbugs.gnu.org; Thu, 18 Oct 2012 21:39:14 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCoeh/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFC7l6BJBEA6MzgViDBQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="202146639" Received: from 76-10-135-161.dsl.teksavvy.com (HELO pastel.home) ([76.10.135.161]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 18 Oct 2012 21:37:40 -0400 Received: by pastel.home (Postfix, from userid 20848) id BDE8359525; Thu, 18 Oct 2012 21:37:39 -0400 (EDT) From: Stefan Monnier To: =?iso-8859-1?Q?Aur=E9lien?= Aptel Subject: Re: bug#12634: existing implementation Message-ID: References: Date: Thu, 18 Oct 2012 21:37:39 -0400 In-Reply-To: (=?iso-8859-1?Q?=22Aur=E9lien?= Aptel"'s message of "Thu, 18 Oct 2012 23:18:43 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > Someone already made a pretty-print patch [1] and other utility > functions [2]. > 1: https://github.com/thorstadt/json.el > 2: https://github.com/thorstadt/json-pretty-print.el Would you be so kind and try to see if we can get the copyright cleared? Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 19 12:22:14 2012 Received: (at 12634) by debbugs.gnu.org; 19 Oct 2012 16:22:14 +0000 Received: from localhost ([127.0.0.1]:51955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TPFKu-0001bD-U8 for submit@debbugs.gnu.org; Fri, 19 Oct 2012 12:22:13 -0400 Received: from mail-vc0-f172.google.com ([209.85.220.172]:46281) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TPFKs-0001b1-A5 for 12634@debbugs.gnu.org; Fri, 19 Oct 2012 12:22:11 -0400 Received: by mail-vc0-f172.google.com with SMTP id fl11so792565vcb.3 for <12634@debbugs.gnu.org>; Fri, 19 Oct 2012 09:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RMD64T9eJphPv/8nuJn4T5MBnRqr1nemNkCaTCVGa2I=; b=wQ9Rz/pt5ABuMTBFDBVuDvum3TmSf30tc7U930bo9aA8KRcUPoqvLPqXfQimb8AIFB mclDyBfzGLrGbXJpTpp7N0D5yAlWs/gKXXf6sU0N9xYKk8TI/IbsJdbkhcVkM+SUnjvw QOV2tcNFRRq7nu/FVMR9nG0FtjeC231rclUavsCpfg/LxQtKtpQSzc3nmDrUNhfCuDnM krLNbjVctvTBdL+m+Revn4aXX9q/3cQ8qT1nc38QdfMXfnkYUNmhbQg55+F/eHiaDb7z m/9zs8R0ykxB+s4vCgp8c3MJCq53BS9RM+39PR9bLcFo3Cc77envfa0aq5NM71Aj+DsI 1HrQ== MIME-Version: 1.0 Received: by 10.52.179.2 with SMTP id dc2mr1830276vdc.50.1350663633325; Fri, 19 Oct 2012 09:20:33 -0700 (PDT) Received: by 10.58.161.145 with HTTP; Fri, 19 Oct 2012 09:20:33 -0700 (PDT) In-Reply-To: References: Date: Fri, 19 Oct 2012 18:20:33 +0200 Message-ID: Subject: Re: bug#12634: existing implementation From: =?UTF-8?Q?Aur=C3=A9lien_Aptel?= To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.1 (/) On Fri, Oct 19, 2012 at 3:37 AM, Stefan Monnier wrote: > Would you be so kind and try to see if we can get the copyright cleared? I've asked him via email (mentioning the url to this bug). I've also sent the instructions to get the assignment form. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 19 14:06:25 2012 Received: (at 12634) by debbugs.gnu.org; 19 Oct 2012 18:06:25 +0000 Received: from localhost ([127.0.0.1]:51993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TPGxl-0003xv-2S for submit@debbugs.gnu.org; Fri, 19 Oct 2012 14:06:25 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:49911) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TPGxj-0003xn-5m for 12634@debbugs.gnu.org; Fri, 19 Oct 2012 14:06:23 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q9JI4ocT026868; Fri, 19 Oct 2012 14:04:50 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 21836B40A1; Fri, 19 Oct 2012 14:04:50 -0400 (EDT) From: Stefan Monnier To: =?iso-8859-1?Q?Aur=E9lien?= Aptel Subject: Re: bug#12634: existing implementation Message-ID: References: Date: Fri, 19 Oct 2012 14:04:49 -0400 In-Reply-To: (=?iso-8859-1?Q?=22Aur=E9lien?= Aptel"'s message of "Fri, 19 Oct 2012 18:20:33 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4376=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4376> : streams <841415> : uri <1247363> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) >> Would you be so kind and try to see if we can get the copyright cleared? > I've asked him via email (mentioning the url to this bug). I've also > sent the instructions to get the assignment form. Great, thank you, Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 19 17:29:56 2012 Received: (at 12634) by debbugs.gnu.org; 19 Oct 2012 21:29:56 +0000 Received: from localhost ([127.0.0.1]:52204 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TPK8i-00013h-5j for submit@debbugs.gnu.org; Fri, 19 Oct 2012 17:29:56 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:15132) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TPK8f-00013S-Se for 12634@debbugs.gnu.org; Fri, 19 Oct 2012 17:29:54 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCoeh/2dsb2JhbABEtBGBCIIVAQEEAVYjEAs0EhQYDSSIHAW6CZBEA6MzgViDBYFD X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="202331335" Received: from 76-10-135-161.dsl.teksavvy.com (HELO ceviche.home) ([76.10.135.161]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 19 Oct 2012 17:28:16 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 8877C6613F; Fri, 19 Oct 2012 17:28:16 -0400 (EDT) From: Stefan Monnier To: =?iso-8859-1?Q?Aur=E9lien?= Aptel Subject: Re: bug#12634: existing implementation Message-ID: References: Date: Fri, 19 Oct 2012 17:28:16 -0400 In-Reply-To: (Stefan Monnier's message of "Fri, 19 Oct 2012 14:04:49 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) >>> Would you be so kind and try to see if we can get the copyright cleared? >> I've asked him via email (mentioning the url to this bug). I've also >> sent the instructions to get the assignment form. > Great, thank you, BTW, please make sure that he specifies "Emacs" (and not json.el for example) as the package for which he wants to sign the paperwork. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 25 11:48:46 2012 Received: (at 12634) by debbugs.gnu.org; 25 Oct 2012 15:48:46 +0000 Received: from localhost ([127.0.0.1]:33404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TRPfq-0007fg-Ds for submit@debbugs.gnu.org; Thu, 25 Oct 2012 11:48:46 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:33217) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TROsS-0006T0-VU for 12634@debbugs.gnu.org; Thu, 25 Oct 2012 10:57:45 -0400 Received: by mail-wg0-f46.google.com with SMTP id dt12so1229424wgb.15 for <12634@debbugs.gnu.org>; Thu, 25 Oct 2012 07:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=xyjSPuFEmQPLw0pQ1HwqHtqKekqs2XmDo573R6s6OCs=; b=U9JwM7prqIPVSUERMzYXcveYVA3UdXLKoeNra340tAkUXrvNAd3O7C6/N+AKTAD6Et hBLRs3CUAnpJ3M6lajeQNlMVQ517VXTRW7EDN9KSYL9pV/6mYj17zhAtngmUUy/iBiV1 ieHIq5qzGf9DE8vwgU7C1Fk5KkHhASEgVQR8qeQcoaQqUcWL8dyOPDZiD+q0cwxFfgHH WHORbDv6szqZIQtxQMKUG0ydGzEFuzu8AubidK6Ofrjg4EfX0ep/dV4L+mS3G671FUab ALKdxvXORRlpZh904NRj6TJGTyMSMkJRrMeIou4oL9MAvaBtUmorYH1fvmFv+0p0De8n 4s8w== MIME-Version: 1.0 Received: by 10.180.105.168 with SMTP id gn8mr14418446wib.10.1351176940022; Thu, 25 Oct 2012 07:55:40 -0700 (PDT) Received: by 10.194.44.40 with HTTP; Thu, 25 Oct 2012 07:55:39 -0700 (PDT) Date: Thu, 25 Oct 2012 10:55:39 -0400 Message-ID: Subject: Patch for pretty-printing in json.el From: Ryan Crum To: 12634@debbugs.gnu.org Content-Type: multipart/mixed; boundary=f46d0418271489e9ee04cce36581 X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12634 X-Mailman-Approved-At: Thu, 25 Oct 2012 11:48:44 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.1 (/) --f46d0418271489e9ee04cce36581 Content-Type: multipart/alternative; boundary=f46d0418271489e9e204cce3657f --f46d0418271489e9e204cce3657f Content-Type: text/plain; charset=UTF-8 Hi, I've consolidated my changes into json.el. I have not yet received the form for copyright assignment in the mail, but I have requested it. Please advise me if you'd like me to make any changes here, and I'll be happy to accomodate. Patch attached. Thanks, -Ryan --f46d0418271489e9e204cce3657f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi,

I've consolidated my changes into json.el. I have not yet re= ceived the form for copyright assignment in the mail, but I have requested = it. Please advise me if you'd like me to make any changes here, and I&#= 39;ll be happy to accomodate. Patch attached.

Thanks,

-Ryan
--f46d0418271489e9e204cce3657f-- --f46d0418271489e9ee04cce36581 Content-Type: application/octet-stream; name=pretty-printing-patch Content-Disposition: attachment; filename=pretty-printing-patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_h8pztcyo0 KioqIGEvanNvbi5lbAotLS0gYi9qc29uLmVsCioqKioqKioqKioqKioqKgoqKiogMyw5ICoqKioK ICA7OyBDb3B5cmlnaHQgKEMpIDIwMDYtMjAxMiBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sIElu Yy4KICAKICA7OyBBdXRob3I6IEVkd2FyZCBPJ0Nvbm5vciA8dGVkQG9jb25ub3IuY3g+CiEgOzsg VmVyc2lvbjogMS4zCiAgOzsgS2V5d29yZHM6IGNvbnZlbmllbmNlCiAgCiAgOzsgVGhpcyBmaWxl IGlzIHBhcnQgb2YgR05VIEVtYWNzLgotLS0gMyw5IC0tLS0KICA7OyBDb3B5cmlnaHQgKEMpIDIw MDYtMjAxMiBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sIEluYy4KICAKICA7OyBBdXRob3I6IEVk d2FyZCBPJ0Nvbm5vciA8dGVkQG9jb25ub3IuY3g+CiEgOzsgVmVyc2lvbjogMS40CiAgOzsgS2V5 d29yZHM6IGNvbnZlbmllbmNlCiAgCiAgOzsgVGhpcyBmaWxlIGlzIHBhcnQgb2YgR05VIEVtYWNz LgoqKioqKioqKioqKioqKioKKioqIDQ4LDUzICoqKioKLS0tIDQ4LDU0IC0tLS0KICA7OyAyMDA2 LTEyLTI5IC0gWEVtYWNzIHN1cHBvcnQsIGZyb20gQWlkYW4gS2Vob2UgPGtlaG9lYUBwYXJoYXNh cmQubmV0Pi4KICA7OyAyMDA4LTAyLTIxIC0gSW5zdGFsbGVkIGluIEdOVSBFbWFjcy4KICA7OyAy MDExLTEwLTE3IC0gUGF0Y2ggYGpzb24tYWxpc3QtcCcgYW5kIGBqc29uLXBsaXN0LXAnIHRvIGF2 b2lkIHJlY3Vyc2lvbiAtdHp6CisgOzsgMjAxMi0xMC0yNSAtIEFkZGVkIHByZXR0eS1wcmludGVk IHJlZm9ybWF0dGluZyAtUnlhbiBDcnVtIChyeWFuQHJ5YW5jcnVtLm9yZykKICAKICA7OzsgQ29k ZToKICAKKioqKioqKioqKioqKioqCioqKiA5OSwxMDQgKioqKiBJZiB0aGlzIGhhcyB0aGUgc2Ft ZSB2YWx1ZSBhcyBganNvbi1mYWxzZScsIHlvdSBtaWdodCBub3QgYmUgYWJsZSB0bwotLS0gMTAw LDEyMyAtLS0tCiAgdGVsbCB0aGUgZGlmZmVyZW5jZSBiZXR3ZWVuIGBmYWxzZScgYW5kIGBudWxs Jy4gIENvbnNpZGVyIGxldC1iaW5kaW5nCiAgdGhpcyBhcm91bmQgeW91ciBjYWxsIHRvIGBqc29u LXJlYWQnIGluc3RlYWQgb2YgYHNldHEnaW5nIGl0LiIpCiAgCisgKGRlZnZhciBqc29uLWVuY29k aW5nLWRlZmF1bHQtc2VwYXJhdG9yICIsICIKKyAgICJWYWx1ZSB0byB1c2UgYXMgYW4gZWxlbWVu dCBzZXBlcmF0b3Igd2hlbiBlbmNvZGluZy4iKQorIAorIChkZWZ2YXIganNvbi1lbmNvZGluZy1j dXJyZW50LXNlcGFyYXRvciBqc29uLWVuY29kaW5nLWRlZmF1bHQtc2VwYXJhdG9yCisgICAiVmFs dWUgdG8gdXNlIGFzIGFuIGVsZW1lbnQgc2VwZXJhdG9yIHdoZW4gZW5jb2RpbmcuIikKKyAKKyAo ZGVmdmFyIGpzb24tZW5jb2RpbmctZGVmYXVsdC1pbmRlbnRhdGlvbiAiICAiCisgICAiVGhlIGRl ZmF1bHQgaW5kZW50YXRpb24gbGV2ZWwgZm9yIGVuY29kaW5nLiBVc2VkIG9ubHkgd2hlbgorIGBq c29uLWVuY29kaW5nLXByZXR0eS1wcmludCcgaXMgbm9uLW5pbC4iKQorIAorIChkZWZ2YXIganNv bi1lbmNvZGluZy1jdXJyZW50LWluZGVudGF0aW9uICIiCisgICAiSW50ZXJuYWxseSB1c2VkIHRv IGtlZXAgdHJhY2sgb2YgdGhlIGN1cnJlbnQgaW5kZW50YXRpb24gbGV2ZWwgb2YKKyBlbmNvZGlu Zy4gVXNlZCBvbmx5IHdoZW4gYGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50JyBpcyBub24tbmls LiIpCisgCisgKGRlZnZhciBqc29uLWVuY29kaW5nLXByZXR0eS1wcmludCBuaWwKKyAgICJTZXR0 aW5nIHRoaXMgdG8gbm9uLW5pbCB3aWxsIHJlc3VsdCBpbiB0aGUgb3V0cHV0IG9mIGBqc29uLWVu Y29kZScKKyB0byBiZSBwcmV0dHktcHJpbnRlZC4iKQorIAogIAwKICAKICA7OzsgVXRpbGl0aWVz CioqKioqKioqKioqKioqKgoqKiogMzg5LDQyOSAqKioqIFBsZWFzZSBzZWUgdGhlIGRvY3VtZW50 YXRpb24gb2YgYGpzb24tb2JqZWN0LXR5cGUnIGFuZCBganNvbi1rZXktdHlwZScuIgogIAogIChk ZWZ1biBqc29uLWVuY29kZS1oYXNoLXRhYmxlIChoYXNoLXRhYmxlKQogICAgIlJldHVybiBhIEpT T04gcmVwcmVzZW50YXRpb24gb2YgSEFTSC1UQUJMRS4iCiEgICAoZm9ybWF0ICJ7JXN9IgogICAg ICAgICAgICAoanNvbi1qb2luCiAgICAgICAgICAgICAobGV0IChyKQohICAgICAgICAgICAgICAo bWFwaGFzaAohICAgICAgICAgICAgICAgKGxhbWJkYSAoayB2KQohICAgICAgICAgICAgICAgICAo cHVzaCAoZm9ybWF0ICIlczolcyIKISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoanNv bi1lbmNvZGUgaykKISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoanNvbi1lbmNvZGUg dikpCiEgICAgICAgICAgICAgICAgICAgICAgIHIpKQohICAgICAgICAgICAgICAgaGFzaC10YWJs ZSkKICAgICAgICAgICAgICAgcikKISAgICAgICAgICAgICIsICIpKSkKICAKICA7OyBMaXN0IGVu Y29kaW5nIChpbmNsdWRpbmcgYWxpc3RzIGFuZCBwbGlzdHMpCiAgCiAgKGRlZnVuIGpzb24tZW5j b2RlLWFsaXN0IChhbGlzdCkKICAgICJSZXR1cm4gYSBKU09OIHJlcHJlc2VudGF0aW9uIG9mIEFM SVNULiIKISAgIChmb3JtYXQgInslc30iCiEgICAgICAgICAgIChqc29uLWpvaW4gKG1hcGNhciAo bGFtYmRhIChjb25zKQohICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZm9ybWF0ICIl czolcyIKISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoanNvbi1lbmNv ZGUgKGNhciBjb25zKSkKISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo anNvbi1lbmNvZGUgKGNkciBjb25zKSkpKQohICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg YWxpc3QpCiEgICAgICAgICAgICAgICAgICAgICAgIiwgIikpKQogIAogIChkZWZ1biBqc29uLWVu Y29kZS1wbGlzdCAocGxpc3QpCiAgICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBvZiBQ TElTVC4iCiAgICAobGV0IChyZXN1bHQpCiAgICAgICh3aGlsZSBwbGlzdAohICAgICAgIChwdXNo IChjb25jYXQgKGpzb24tZW5jb2RlIChjYXIgcGxpc3QpKQohICAgICAgICAgICAgICAgICAgICAg IjoiCiEgICAgICAgICAgICAgICAgICAgICAoanNvbi1lbmNvZGUgKGNhZHIgcGxpc3QpKSkKISAg ICAgICAgICAgICByZXN1bHQpCiAgICAgICAgKHNldHEgcGxpc3QgKGNkZHIgcGxpc3QpKSkKISAg ICAgKGNvbmNhdCAieyIgKGpzb24tam9pbiAobnJldmVyc2UgcmVzdWx0KSAiLCAiKSAifSIpKSkK ICAKICAoZGVmdW4ganNvbi1lbmNvZGUtbGlzdCAobGlzdCkKICAgICJSZXR1cm4gYSBKU09OIHJl cHJlc2VudGF0aW9uIG9mIExJU1QuCi0tLSA0MDgsNDc5IC0tLS0KICAKICAoZGVmdW4ganNvbi1l bmNvZGUtaGFzaC10YWJsZSAoaGFzaC10YWJsZSkKICAgICJSZXR1cm4gYSBKU09OIHJlcHJlc2Vu dGF0aW9uIG9mIEhBU0gtVEFCTEUuIgohICAgKGZvcm1hdCAoaWYganNvbi1lbmNvZGluZy1wcmV0 dHktcHJpbnQgIntcbiVzXG4lc30iICJ7JXN9IikKICAgICAgICAgICAgKGpzb24tam9pbgogICAg ICAgICAgICAgKGxldCAocikKISAgICAgICAgICAgICAgKGxldCAoKGpzb24tZW5jb2RpbmctY3Vy cmVudC1pbmRlbnRhdGlvbgohICAgICAgICAgICAgICAgICAgICAgKGlmIGpzb24tZW5jb2Rpbmct cHJldHR5LXByaW50CiEgICAgICAgICAgICAgICAgICAgICAgICAgKGNvbmNhdCBqc29uLWVuY29k aW5nLWN1cnJlbnQtaW5kZW50YXRpb24KISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGpzb24tZW5jb2RpbmctZGVmYXVsdC1pbmRlbnRhdGlvbikKISAgICAgICAgICAgICAgICAgICAg ICAgIiIpKSkKISAgICAgICAgICAgICAgICAobWFwaGFzaAohICAgICAgICAgICAgICAgICAobGFt YmRhIChrIHYpCiEgICAgICAgICAgICAgICAgICAgKHB1c2ggKGZvcm1hdCAoaWYganNvbi1lbmNv ZGluZy1wcmV0dHktcHJpbnQgIiVzJXM6ICVzIiAiJXMlczolcyIpCiEgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24KISAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIChqc29uLWVuY29kZSBrKQohICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgKGpzb24tZW5jb2RlIHYpKQohICAgICAgICAgICAgICAgICAg ICAgICAgIHIpKQohICAgICAgICAgICAgICAgICBoYXNoLXRhYmxlKSkKICAgICAgICAgICAgICAg cikKISAgICAgICAgICAgIGpzb24tZW5jb2RpbmctY3VycmVudC1zZXBhcmF0b3IpCiEgICAgICAg ICAgIGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlvbikpCiAgCiAgOzsgTGlzdCBlbmNv ZGluZyAoaW5jbHVkaW5nIGFsaXN0cyBhbmQgcGxpc3RzKQogIAogIChkZWZ1biBqc29uLWVuY29k ZS1hbGlzdCAoYWxpc3QpCiAgICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBvZiBBTElT VC4iCiEgICAoZm9ybWF0IChpZiBqc29uLWVuY29kaW5nLXByZXR0eS1wcmludCAie1xuJXNcbiVz fSIgInslc30iKQohICAgICAgICAgICAoanNvbi1qb2luCiEgICAgICAgICAgICAobGV0ICgoanNv bi1lbmNvZGluZy1jdXJyZW50LWluZGVudGF0aW9uCiEgICAgICAgICAgICAgICAgICAgKGlmIGpz b24tZW5jb2RpbmctcHJldHR5LXByaW50CiEgICAgICAgICAgICAgICAgICAgICAgIChjb25jYXQg anNvbi1lbmNvZGluZy1jdXJyZW50LWluZGVudGF0aW9uCiEgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAganNvbi1lbmNvZGluZy1kZWZhdWx0LWluZGVudGF0aW9uKQohICAgICAgICAgICAg ICAgICAgICAgIiIpKSkKISAgICAgICAgICAgICAgKG1hcGNhciAobGFtYmRhIChjb25zKQohICAg ICAgICAgICAgICAgICAgICAgICAgKGZvcm1hdCAoaWYganNvbi1lbmNvZGluZy1wcmV0dHktcHJp bnQKISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIlcyVzOiAlcyIKISAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiJXMlczolcyIpCiEgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlvbgohICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAoanNvbi1lbmNvZGUgKGNhciBjb25zKSkKISAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgKGpzb24tZW5jb2RlIChjZHIgY29ucykpKSkKISAg ICAgICAgICAgICAgICAgICAgICBhbGlzdCkpCiEgICAgICAgICAgICAgICAgICAgICAganNvbi1l bmNvZGluZy1jdXJyZW50LXNlcGFyYXRvcikKISAgICAgICAgICAganNvbi1lbmNvZGluZy1jdXJy ZW50LWluZGVudGF0aW9uKSkKICAKICAoZGVmdW4ganNvbi1lbmNvZGUtcGxpc3QgKHBsaXN0KQog ICAgIlJldHVybiBhIEpTT04gcmVwcmVzZW50YXRpb24gb2YgUExJU1QuIgogICAgKGxldCAocmVz dWx0KQogICAgICAod2hpbGUgcGxpc3QKISAgICAgICAobGV0ICgoanNvbi1lbmNvZGluZy1jdXJy ZW50LWluZGVudGF0aW9uCiEgICAgICAgICAgICAgIChpZiBqc29uLWVuY29kaW5nLXByZXR0eS1w cmludAohICAgICAgICAgICAgICAgICAgKGNvbmNhdCBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5k ZW50YXRpb24KISAgICAgICAgICAgICAgICAgICAgICAgICAganNvbi1lbmNvZGluZy1kZWZhdWx0 LWluZGVudGF0aW9uKQohICAgICAgICAgICAgICAgICIiKSkpCiEgICAgICAgICAocHVzaCAoY29u Y2F0CiEgICAgICAgICAgICAgICAganNvbi1lbmNvZGluZy1jdXJyZW50LWluZGVudGF0aW9uCiEg ICAgICAgICAgICAgICAgKGpzb24tZW5jb2RlIChjYXIgcGxpc3QpKQohICAgICAgICAgICAgICAg IChpZiBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24KISAgICAgICAgICAgICAgICAg ICAgIjogIgohICAgICAgICAgICAgICAgICAgIjoiKQohICAgICAgICAgICAgICAgIChqc29uLWVu Y29kZSAoY2FkciBwbGlzdCkpKQohICAgICAgICAgICAgICAgcmVzdWx0KSkKICAgICAgICAoc2V0 cSBwbGlzdCAoY2RkciBwbGlzdCkpKQohICAgICAoY29uY2F0IChpZiBqc29uLWVuY29kaW5nLXBy ZXR0eS1wcmludCAie1xuIiAieyIpCiEgICAgICAgICAgICAgKGpzb24tam9pbiAobnJldmVyc2Ug cmVzdWx0KSBqc29uLWVuY29kaW5nLWN1cnJlbnQtc2VwYXJhdG9yKQohICAgICAgICAgICAgIChp ZiBqc29uLWVuY29kaW5nLXByZXR0eS1wcmludAohICAgICAgICAgICAgICAgICAoZm9ybWF0ICJc biVzIiBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24pCiEgICAgICAgICAgICAgICAi IikKISAgICAgICAgICAgICAifSIpKSkKICAKICAoZGVmdW4ganNvbi1lbmNvZGUtbGlzdCAobGlz dCkKICAgICJSZXR1cm4gYSBKU09OIHJlcHJlc2VudGF0aW9uIG9mIExJU1QuCioqKioqKioqKioq KioqKgoqKiogNDYyLDQ2OCAqKioqIGJlY29tZSBKU09OIG9iamVjdHMuIgogIAogIChkZWZ1biBq c29uLWVuY29kZS1hcnJheSAoYXJyYXkpCiAgICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlv biBvZiBBUlJBWS4iCiEgICAoY29uY2F0ICJbIiAobWFwY29uY2F0ICdqc29uLWVuY29kZSBhcnJh eSAiLCAiKSAiXSIpKQogIAogIAwKICAKLS0tIDUxMiw1MzAgLS0tLQogIAogIChkZWZ1biBqc29u LWVuY29kZS1hcnJheSAoYXJyYXkpCiAgICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBv ZiBBUlJBWS4iCiEgICAoaWYgKGFuZCBqc29uLWVuY29kaW5nLXByZXR0eS1wcmludAohICAgICAg ICAgICAgKD4gKGxlbmd0aCBhcnJheSkgMCkpCiEgICAgICAgKGNvbmNhdAohICAgICAgICAobGV0 ICgoanNvbi1lbmNvZGluZy1jdXJyZW50LWluZGVudGF0aW9uCiEgICAgICAgICAgICAgICAoY29u Y2F0IGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlvbgohICAgICAgICAgICAgICAgICAg ICAgICBqc29uLWVuY29kaW5nLWRlZmF1bHQtaW5kZW50YXRpb24pKSkKISAgICAgICAgICAoY29u Y2F0IChmb3JtYXQgIltcbiVzIiBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24pCiEg ICAgICAgICAgICAgICAgICAoanNvbi1qb2luIChtYXBjYXIgJ2pzb24tZW5jb2RlIGFycmF5KQoh ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZm9ybWF0ICIlcyVzIgohICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24tZW5jb2RpbmctY3VycmVudC1zZXBhcmF0b3IK ISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uLWVuY29kaW5nLWN1cnJl bnQtaW5kZW50YXRpb24pKSkpCiEgICAgICAgIChmb3JtYXQgIlxuJXNdIiBqc29uLWVuY29kaW5n LWN1cnJlbnQtaW5kZW50YXRpb24pKQohICAgICAoY29uY2F0ICJbIiAobWFwY29uY2F0ICdqc29u LWVuY29kZSBhcnJheSBqc29uLWVuY29kaW5nLWN1cnJlbnQtc2VwYXJhdG9yKSAiXSIpKSkKICAK ICAMCiAgCioqKioqKioqKioqKioqKgoqKiogNTE2LDUzMyAqKioqIEFkdmFuY2VzIHBvaW50IGp1 c3QgcGFzdCBKU09OIG9iamVjdC4iCiAgCiAgKGRlZnVuIGpzb24tZW5jb2RlIChvYmplY3QpCiAg ICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBvZiBPQkpFQ1QgYXMgYSBzdHJpbmcuIgoh ICAgKGNvbmQgKChtZW1xIG9iamVjdCAobGlzdCB0IGpzb24tbnVsbCBqc29uLWZhbHNlKSkKISAg ICAgICAgICAoanNvbi1lbmNvZGUta2V5d29yZCBvYmplY3QpKQohICAgICAgICAgKChzdHJpbmdw IG9iamVjdCkgICAgICAoanNvbi1lbmNvZGUtc3RyaW5nIG9iamVjdCkpCiEgICAgICAgICAoKGtl eXdvcmRwIG9iamVjdCkgICAgIChqc29uLWVuY29kZS1zdHJpbmcKISAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIChzdWJzdHJpbmcgKHN5bWJvbC1uYW1lIG9iamVjdCkgMSkpKQohICAg ICAgICAgKChzeW1ib2xwIG9iamVjdCkgICAgICAoanNvbi1lbmNvZGUtc3RyaW5nCiEgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAoc3ltYm9sLW5hbWUgb2JqZWN0KSkpCiEgICAgICAg ICAoKG51bWJlcnAgb2JqZWN0KSAgICAgIChqc29uLWVuY29kZS1udW1iZXIgb2JqZWN0KSkKISAg ICAgICAgICgoYXJyYXlwIG9iamVjdCkgICAgICAgKGpzb24tZW5jb2RlLWFycmF5IG9iamVjdCkp CiEgICAgICAgICAoKGhhc2gtdGFibGUtcCBvYmplY3QpIChqc29uLWVuY29kZS1oYXNoLXRhYmxl IG9iamVjdCkpCiEgICAgICAgICAoKGxpc3RwIG9iamVjdCkgICAgICAgIChqc29uLWVuY29kZS1s aXN0IG9iamVjdCkpCiEgICAgICAgICAodCAgICAgICAgICAgICAgICAgICAgIChzaWduYWwgJ2pz b24tZXJyb3IgKGxpc3Qgb2JqZWN0KSkpKSkKICAKICAocHJvdmlkZSAnanNvbikKICAKLS0tIDU3 OCw2MjIgLS0tLQogIAogIChkZWZ1biBqc29uLWVuY29kZSAob2JqZWN0KQogICAgIlJldHVybiBh IEpTT04gcmVwcmVzZW50YXRpb24gb2YgT0JKRUNUIGFzIGEgc3RyaW5nLiIKISAgIChsZXQgKChq c29uLWVuY29kaW5nLWN1cnJlbnQtc2VwYXJhdG9yCiEgICAgICAgICAgKGlmIGpzb24tZW5jb2Rp bmctcHJldHR5LXByaW50CiEgICAgICAgICAgICAgIChjb25jYXQganNvbi1lbmNvZGluZy1kZWZh dWx0LXNlcGFyYXRvciAiXG4iKQohICAgICAgICAgICAganNvbi1lbmNvZGluZy1kZWZhdWx0LXNl cGFyYXRvcikpKQohICAgICAoY29uZCAoKG1lbXEgb2JqZWN0IChsaXN0IHQganNvbi1udWxsIGpz b24tZmFsc2UpKQohICAgICAgICAgICAgKGpzb24tZW5jb2RlLWtleXdvcmQgb2JqZWN0KSkKISAg ICAgICAgICAgKChzdHJpbmdwIG9iamVjdCkgICAgICAoanNvbi1lbmNvZGUtc3RyaW5nIG9iamVj dCkpCiEgICAgICAgICAgICgoa2V5d29yZHAgb2JqZWN0KSAgICAgKGpzb24tZW5jb2RlLXN0cmlu ZwohICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoc3Vic3RyaW5nIChzeW1ib2wt bmFtZSBvYmplY3QpIDEpKSkKISAgICAgICAgICAgKChzeW1ib2xwIG9iamVjdCkgICAgICAoanNv bi1lbmNvZGUtc3RyaW5nCiEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChzeW1i b2wtbmFtZSBvYmplY3QpKSkKISAgICAgICAgICAgKChudW1iZXJwIG9iamVjdCkgICAgICAoanNv bi1lbmNvZGUtbnVtYmVyIG9iamVjdCkpCiEgICAgICAgICAgICgoYXJyYXlwIG9iamVjdCkgICAg ICAgKGpzb24tZW5jb2RlLWFycmF5IG9iamVjdCkpCiEgICAgICAgICAgICgoaGFzaC10YWJsZS1w IG9iamVjdCkgKGpzb24tZW5jb2RlLWhhc2gtdGFibGUgb2JqZWN0KSkKISAgICAgICAgICAgKChs aXN0cCBvYmplY3QpICAgICAgICAoanNvbi1lbmNvZGUtbGlzdCBvYmplY3QpKQohICAgICAgICAg ICAodCAgICAgICAgICAgICAgICAgICAgIChzaWduYWwgJ2pzb24tZXJyb3IgKGxpc3Qgb2JqZWN0 KSkpKSkpCiEgCiEgOzsgUHJldHR5IHByaW50aW5nCiEgCiEgKGRlZnVuIGpzb24tcHJldHR5LXBy aW50LWJ1ZmZlciAoKQohICAgIlByZXR0eS1wcmludCBjdXJyZW50IGJ1ZmZlci4iCiEgICAoaW50 ZXJhY3RpdmUpCiEgICAobGV0KiAoKGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50IHQpCiEgICAg ICAgICAgKGpzb24tc3RyaW5nIChqc29uLWVuY29kZSAoanNvbi1yZWFkLWZyb20tc3RyaW5nIChi dWZmZXItc3RyaW5nKSkpKQohICAgICAgICAgIChidWYgKGN1cnJlbnQtYnVmZmVyKSkpCiEgICAg ICh3aXRoLWN1cnJlbnQtYnVmZmVyIGJ1ZgohICAgICAgIChlcmFzZS1idWZmZXIpCiEgICAgICAg KGluc2VydCBqc29uLXN0cmluZykpKSkKISAKISAoZGVmdW4ganNvbi1wcmV0dHktcHJpbnQgKCkK ISAgICJQcmV0dHktcHJpbnQgc2VsZWN0ZWQgcmVnaW9uLiIKISAgIChpbnRlcmFjdGl2ZSkKISAg ICh1bmxlc3MgbWFyay1hY3RpdmUKISAgICAgKGVycm9yICJObyByZWdpb24gc2VsZWN0ZWQuIikp CiEgICAobGV0ICgoYmVnaW4gKHJlZ2lvbi1iZWdpbm5pbmcpKQohICAgICAgICAgKGVuZCAocmVn aW9uLWVuZCkpCiEgICAgICAgICAoanNvbi1lbmNvZGluZy1wcmV0dHktcHJpbnQgdCkpCiEgICAg IChraWxsLXJlZ2lvbiBiZWdpbiBlbmQpCiEgICAgIChpbnNlcnQgKGpzb24tZW5jb2RlIChqc29u LXJlYWQtZnJvbS1zdHJpbmcgKGN1cnJlbnQta2lsbCAwKSkpKSkpCiAgCiAgKHByb3ZpZGUgJ2pz b24pCiAgCg== --f46d0418271489e9ee04cce36581-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 25 14:11:13 2012 Received: (at 12634) by debbugs.gnu.org; 25 Oct 2012 18:11:14 +0000 Received: from localhost ([127.0.0.1]:33614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TRRth-0004Gd-Hz for submit@debbugs.gnu.org; Thu, 25 Oct 2012 14:11:13 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:48751) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TRRtc-0004GI-4E for 12634@debbugs.gnu.org; Thu, 25 Oct 2012 14:11:10 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q9PI90tn011324; Thu, 25 Oct 2012 14:09:00 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 58220B4278; Thu, 25 Oct 2012 14:09:00 -0400 (EDT) From: Stefan Monnier To: Ryan Crum Subject: Re: bug#12634: Patch for pretty-printing in json.el Message-ID: References: Date: Thu, 25 Oct 2012 14:08:59 -0400 In-Reply-To: (Ryan Crum's message of "Thu, 25 Oct 2012 10:55:39 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4382=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4382> : streams <845326> : uri <1252281> X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.6 (-) > I've consolidated my changes into json.el. I have not yet received > the form for copyright assignment in the mail, but I have > requested it. Great, thanks. > Please advise me if you'd like me to make any changes here, and I'll > be happy to accomodate. Patch attached. It looks OK overall, but I do have some comments: - it would be better not to re-compute json-encoding-current-separator every time we call json-encode, since that function is called all the time. IOW, build it once in an external caller. Or better yet: get rid of json-encoding-current-separator and add a "\n" at the beginning of json-encoding-current-indentation instead. - you can use the "json--" prefix to indicate it is an internal variable/function. - You could also prefer to place the closing ] at the end of the previous line, =E0 la Lisp ;-) Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 27 15:34:06 2012 Received: (at 12634) by debbugs.gnu.org; 27 Oct 2012 19:34:06 +0000 Received: from localhost ([127.0.0.1]:36066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TSC90-0005bv-CE for submit@debbugs.gnu.org; Sat, 27 Oct 2012 15:34:06 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:64925) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TSC8x-0005bm-7O for 12634@debbugs.gnu.org; Sat, 27 Oct 2012 15:34:04 -0400 Received: by mail-wg0-f46.google.com with SMTP id dt12so2595576wgb.15 for <12634@debbugs.gnu.org>; Sat, 27 Oct 2012 12:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=AagA1tOGzBo/ywltOiZT81R8CNovuL7hTYXo+oNkdRQ=; b=GoTDpMMkbMxHZNyFu3MKnI2JLjh2Qs4JG7j7VGLSTqoR68M0zqWn8qnDa3BqtsNVkR FbnvehbiRb+qT3NN2aOrzrtfkZsJfmXMvotGeovbrpYFyMZ28DgVb4Bqec+P0W1PLfm4 gkvsjAavt1IWM5fKEKW1qYkqg2wGZ5TI52yD8fyd4TguR5xmuFGfmnva8Y7wBaRy+GlG ymlaUXNqPrWKsIyIiBiYxLb/5ardtwCpsISruF+3PRiObcldxXN7jSG8Cwed10it6q8l a/Zh1aHAnkXpozNdsPRInp+gB+kCRRzxMZLpzfMhBsAxh7prsfxR9UhEF8WAgxxmPLbF D2hQ== MIME-Version: 1.0 Received: by 10.180.99.194 with SMTP id es2mr9425519wib.15.1351366306199; Sat, 27 Oct 2012 12:31:46 -0700 (PDT) Received: by 10.194.44.40 with HTTP; Sat, 27 Oct 2012 12:31:46 -0700 (PDT) In-Reply-To: References: Date: Sat, 27 Oct 2012 15:31:46 -0400 Message-ID: Subject: Re: bug#12634: Patch for pretty-printing in json.el From: Ryan Crum To: Stefan Monnier Content-Type: multipart/mixed; boundary=f46d044283d8a476f804cd0f7c62 X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.1 (/) --f46d044283d8a476f804cd0f7c62 Content-Type: multipart/alternative; boundary=f46d044283d8a476ef04cd0f7c60 --f46d044283d8a476ef04cd0f7c60 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cool, new patch attached. I've consolidated current-separator into current-indentation and created a little private helper function `json--current-whitespace' for the newline/indentation. I've also created a var called `json-encoding-lisp-style-closings' per your request. :-) Just let me know if there's anything else. Thanks, -Ryan On Thu, Oct 25, 2012 at 2:08 PM, Stefan Monnier w= rote: > It looks OK overall, but I do have some comments: > - it would be better not to re-compute json-encoding-current-separator > every time we call json-encode, since that function is called all > the time. > IOW, build it once in an external caller. Or better yet: get rid of > json-encoding-current-separator and add a "\n" at the beginning of > json-encoding-current-indentation instead. > - you can use the "json--" prefix to indicate it is an internal > variable/function. > - You could also prefer to place the closing ] at the end of the > previous line, =C3=A0 la Lisp ;-) > > > Stefan > --f46d044283d8a476ef04cd0f7c60 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cool, new patch attached. I've consolidated current-separator into curr= ent-indentation and created a little private helper function `json--current= -whitespace' for the newline/indentation.

I've also created = a var called `json-encoding-lisp-style-closings' per your request. :-)<= br>
Just let me know if there's anything else.

Thanks,

-R= yan

On Thu, Oct 25, 2012 at 2:08 PM, Stef= an Monnier <monnier@iro.umontreal.ca> wrote:
It looks OK overall, but I do have some comm= ents:
- it would be better not to re-compute json-encoding-current-separator
=C2=A0 every time we call json-encode, since that function is called all =C2=A0 the time.
=C2=A0 IOW, build it once in an external caller. =C2=A0Or better yet: get r= id of
=C2=A0 json-encoding-current-separator and add a "\n" at the begi= nning of
=C2=A0 json-encoding-current-indentation instead.
- you can use the "json--" prefix to indicate it is an internal =C2=A0 variable/function.
- You could also prefer to place the closing ] at the end of the
=C2=A0 previous line, =C3=A0 la Lisp ;-)


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--f46d044283d8a476ef04cd0f7c60-- --f46d044283d8a476f804cd0f7c62 Content-Type: application/octet-stream; name=json-pretty-printing Content-Disposition: attachment; filename=json-pretty-printing Content-Transfer-Encoding: base64 X-Attachment-Id: f_h8t4kupb0 KioqIGEvanNvbi5lbAotLS0gYi9qc29uLmVsCioqKioqKioqKioqKioqKgoqKiogMyw5ICoqKioK ICA7OyBDb3B5cmlnaHQgKEMpIDIwMDYtMjAxMiBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sIElu Yy4KICAKICA7OyBBdXRob3I6IEVkd2FyZCBPJ0Nvbm5vciA8dGVkQG9jb25ub3IuY3g+CiEgOzsg VmVyc2lvbjogMS4zCiAgOzsgS2V5d29yZHM6IGNvbnZlbmllbmNlCiAgCiAgOzsgVGhpcyBmaWxl IGlzIHBhcnQgb2YgR05VIEVtYWNzLgotLS0gMyw5IC0tLS0KICA7OyBDb3B5cmlnaHQgKEMpIDIw MDYtMjAxMiBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sIEluYy4KICAKICA7OyBBdXRob3I6IEVk d2FyZCBPJ0Nvbm5vciA8dGVkQG9jb25ub3IuY3g+CiEgOzsgVmVyc2lvbjogMS40CiAgOzsgS2V5 d29yZHM6IGNvbnZlbmllbmNlCiAgCiAgOzsgVGhpcyBmaWxlIGlzIHBhcnQgb2YgR05VIEVtYWNz LgoqKioqKioqKioqKioqKioKKioqIDQ4LDUzICoqKioKLS0tIDQ4LDU0IC0tLS0KICA7OyAyMDA2 LTEyLTI5IC0gWEVtYWNzIHN1cHBvcnQsIGZyb20gQWlkYW4gS2Vob2UgPGtlaG9lYUBwYXJoYXNh cmQubmV0Pi4KICA7OyAyMDA4LTAyLTIxIC0gSW5zdGFsbGVkIGluIEdOVSBFbWFjcy4KICA7OyAy MDExLTEwLTE3IC0gUGF0Y2ggYGpzb24tYWxpc3QtcCcgYW5kIGBqc29uLXBsaXN0LXAnIHRvIGF2 b2lkIHJlY3Vyc2lvbiAtdHp6CisgOzsgMjAxMi0xMC0yNSAtIEFkZGVkIHByZXR0eS1wcmludGVk IHJlZm9ybWF0dGluZyAtUnlhbiBDcnVtIChyeWFuQHJ5YW5jcnVtLm9yZykKICAKICA7OzsgQ29k ZToKICAKKioqKioqKioqKioqKioqCioqKiA5OSwxMDQgKioqKiBJZiB0aGlzIGhhcyB0aGUgc2Ft ZSB2YWx1ZSBhcyBganNvbi1mYWxzZScsIHlvdSBtaWdodCBub3QgYmUgYWJsZSB0bwotLS0gMTAw LDEyNCAtLS0tCiAgdGVsbCB0aGUgZGlmZmVyZW5jZSBiZXR3ZWVuIGBmYWxzZScgYW5kIGBudWxs Jy4gIENvbnNpZGVyIGxldC1iaW5kaW5nCiAgdGhpcyBhcm91bmQgeW91ciBjYWxsIHRvIGBqc29u LXJlYWQnIGluc3RlYWQgb2YgYHNldHEnaW5nIGl0LiIpCiAgCisgKGRlZnZhciBqc29uLWVuY29k aW5nLWRlZmF1bHQtc2VwYXJhdG9yICIsICIKKyAgICJWYWx1ZSB0byB1c2UgYXMgYW4gZWxlbWVu dCBzZXBlcmF0b3Igd2hlbiBlbmNvZGluZy4iKQorIAorIChkZWZ2YXIganNvbi1lbmNvZGluZy1k ZWZhdWx0LWluZGVudGF0aW9uICIgICIKKyAgICJUaGUgZGVmYXVsdCBpbmRlbnRhdGlvbiBsZXZl bCBmb3IgZW5jb2RpbmcuIFVzZWQgb25seSB3aGVuCisgYGpzb24tZW5jb2RpbmctcHJldHR5LXBy aW50JyBpcyBub24tbmlsLiIpCisgCisgKGRlZnZhciBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5k ZW50YXRpb24gIiIKKyAgICJJbnRlcm5hbGx5IHVzZWQgdG8ga2VlcCB0cmFjayBvZiB0aGUgY3Vy cmVudCBpbmRlbnRhdGlvbiBsZXZlbCBvZgorIGVuY29kaW5nLiBVc2VkIG9ubHkgd2hlbiBganNv bi1lbmNvZGluZy1wcmV0dHktcHJpbnQnIGlzIG5vbi1uaWwuIikKKyAKKyAoZGVmdmFyIGpzb24t ZW5jb2RpbmctcHJldHR5LXByaW50IG5pbAorICAgIlNldHRpbmcgdGhpcyB0byBub24tbmlsIHdp bGwgcmVzdWx0IGluIHRoZSBvdXRwdXQgb2YgYGpzb24tZW5jb2RlJworIHRvIGJlIHByZXR0eS1w cmludGVkLiIpCisgCisgKGRlZnZhciBqc29uLWVuY29kaW5nLWxpc3Atc3R5bGUtY2xvc2luZ3Mg bmlsCisgICAiU2V0dGluZyB0aGlzIHRvIGB0JyB3aWxsIGNhdXNlIF0gYW5kIH0gY2xvc2luZ3Mg dG8gaGFwcGVuIGxpc3Atc3R5bGUsCisgd2l0aG91dCBpbmRlbnRhdGlvbi4iKQorIAogIAwKICAK ICA7OzsgVXRpbGl0aWVzCioqKioqKioqKioqKioqKgoqKiogMzg3LDQyOSAqKioqIFBsZWFzZSBz ZWUgdGhlIGRvY3VtZW50YXRpb24gb2YgYGpzb24tb2JqZWN0LXR5cGUnIGFuZCBganNvbi1rZXkt dHlwZScuIgogIAogIDs7IEhhc2ggdGFibGUgZW5jb2RpbmcKICAKICAoZGVmdW4ganNvbi1lbmNv ZGUtaGFzaC10YWJsZSAoaGFzaC10YWJsZSkKICAgICJSZXR1cm4gYSBKU09OIHJlcHJlc2VudGF0 aW9uIG9mIEhBU0gtVEFCTEUuIgohICAgKGZvcm1hdCAieyVzfSIKICAgICAgICAgICAgKGpzb24t am9pbgogICAgICAgICAgICAgKGxldCAocikKISAgICAgICAgICAgICAgKG1hcGhhc2gKISAgICAg ICAgICAgICAgIChsYW1iZGEgKGsgdikKISAgICAgICAgICAgICAgICAgKHB1c2ggKGZvcm1hdCAi JXM6JXMiCiEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGpzb24tZW5jb2RlIGspCiEg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGpzb24tZW5jb2RlIHYpKQohICAgICAgICAg ICAgICAgICAgICAgICByKSkKISAgICAgICAgICAgICAgIGhhc2gtdGFibGUpCiAgICAgICAgICAg ICAgIHIpCiEgICAgICAgICAgICAiLCAiKSkpCiAgCiAgOzsgTGlzdCBlbmNvZGluZyAoaW5jbHVk aW5nIGFsaXN0cyBhbmQgcGxpc3RzKQogIAogIChkZWZ1biBqc29uLWVuY29kZS1hbGlzdCAoYWxp c3QpCiAgICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBvZiBBTElTVC4iCiEgICAoZm9y bWF0ICJ7JXN9IgohICAgICAgICAgICAoanNvbi1qb2luIChtYXBjYXIgKGxhbWJkYSAoY29ucykK ISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZvcm1hdCAiJXM6JXMiCiEgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGpzb24tZW5jb2RlIChjYXIgY29ucykp CiEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGpzb24tZW5jb2RlIChj ZHIgY29ucykpKSkKISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaXN0KQohICAgICAg ICAgICAgICAgICAgICAgICIsICIpKSkKICAKICAoZGVmdW4ganNvbi1lbmNvZGUtcGxpc3QgKHBs aXN0KQogICAgIlJldHVybiBhIEpTT04gcmVwcmVzZW50YXRpb24gb2YgUExJU1QuIgogICAgKGxl dCAocmVzdWx0KQogICAgICAod2hpbGUgcGxpc3QKISAgICAgICAocHVzaCAoY29uY2F0IChqc29u LWVuY29kZSAoY2FyIHBsaXN0KSkKISAgICAgICAgICAgICAgICAgICAgICI6IgohICAgICAgICAg ICAgICAgICAgICAgKGpzb24tZW5jb2RlIChjYWRyIHBsaXN0KSkpCiEgICAgICAgICAgICAgcmVz dWx0KQogICAgICAgIChzZXRxIHBsaXN0IChjZGRyIHBsaXN0KSkpCiEgICAgIChjb25jYXQgInsi IChqc29uLWpvaW4gKG5yZXZlcnNlIHJlc3VsdCkgIiwgIikgIn0iKSkpCiAgCiAgKGRlZnVuIGpz b24tZW5jb2RlLWxpc3QgKGxpc3QpCiAgICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBv ZiBMSVNULgotLS0gNDA3LDQ5MyAtLS0tCiAgCiAgOzsgSGFzaCB0YWJsZSBlbmNvZGluZwogIAor IChkZWZ1biBqc29uLS1jdXJyZW50LXdoaXRlc3BhY2UgKCkKKyAgIChpZiBqc29uLWVuY29kaW5n LXByZXR0eS1wcmludAorICAgICAgIChjb25jYXQgIlxuIiBqc29uLWVuY29kaW5nLWN1cnJlbnQt aW5kZW50YXRpb24pCisgICAgICIiKSkKKyAKICAoZGVmdW4ganNvbi1lbmNvZGUtaGFzaC10YWJs ZSAoaGFzaC10YWJsZSkKICAgICJSZXR1cm4gYSBKU09OIHJlcHJlc2VudGF0aW9uIG9mIEhBU0gt VEFCTEUuIgohICAgKGZvcm1hdCAoaWYganNvbi1lbmNvZGluZy1wcmV0dHktcHJpbnQgInslcyVz fSIgInslc30iKQogICAgICAgICAgICAoanNvbi1qb2luCiAgICAgICAgICAgICAobGV0IChyKQoh ICAgICAgICAgICAgICAobGV0ICgoanNvbi1lbmNvZGluZy1jdXJyZW50LWluZGVudGF0aW9uCiEg ICAgICAgICAgICAgICAgICAgICAoaWYganNvbi1lbmNvZGluZy1wcmV0dHktcHJpbnQKISAgICAg ICAgICAgICAgICAgICAgICAgICAoY29uY2F0IGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRh dGlvbgohICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbi1lbmNvZGluZy1kZWZh dWx0LWluZGVudGF0aW9uKQohICAgICAgICAgICAgICAgICAgICAgICAiIikpKQohICAgICAgICAg ICAgICAgIChtYXBoYXNoCiEgICAgICAgICAgICAgICAgIChsYW1iZGEgKGsgdikKISAgICAgICAg ICAgICAgICAgICAocHVzaCAoZm9ybWF0CiEgICAgICAgICAgICAgICAgICAgICAgICAgIChpZiBq c29uLWVuY29kaW5nLXByZXR0eS1wcmludAohICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IiVzJXM6ICVzIgohICAgICAgICAgICAgICAgICAgICAgICAgICAgICIlcyVzOiVzIikKISAgICAg ICAgICAgICAgICAgICAgICAgICAgKGpzb24tLWN1cnJlbnQtd2hpdGVzcGFjZSkKISAgICAgICAg ICAgICAgICAgICAgICAgICAgKGpzb24tZW5jb2RlIGspCiEgICAgICAgICAgICAgICAgICAgICAg ICAgIChqc29uLWVuY29kZSB2KSkKISAgICAgICAgICAgICAgICAgICAgICAgICByKSkKISAgICAg ICAgICAgICAgICAgaGFzaC10YWJsZSkpCiAgICAgICAgICAgICAgIHIpCiEgICAgICAgICAgICBq c29uLWVuY29kaW5nLWRlZmF1bHQtc2VwYXJhdG9yKQohICAgICAgICAgICAoaWYganNvbi1lbmNv ZGluZy1saXNwLXN0eWxlLWNsb3NpbmdzCiEgICAgICAgICAgICAgICAiIgohICAgICAgICAgICAg ICAgKGpzb24tLWN1cnJlbnQtd2hpdGVzcGFjZSkpKSkKICAKICA7OyBMaXN0IGVuY29kaW5nIChp bmNsdWRpbmcgYWxpc3RzIGFuZCBwbGlzdHMpCiAgCiAgKGRlZnVuIGpzb24tZW5jb2RlLWFsaXN0 IChhbGlzdCkKICAgICJSZXR1cm4gYSBKU09OIHJlcHJlc2VudGF0aW9uIG9mIEFMSVNULiIKISAg IChmb3JtYXQgKGlmIGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50ICJ7JXMlc30iICJ7JXN9IikK ISAgICAgICAgICAgKGpzb24tam9pbgohICAgICAgICAgICAgKGxldCAoKGpzb24tZW5jb2Rpbmct Y3VycmVudC1pbmRlbnRhdGlvbgohICAgICAgICAgICAgICAgICAgIChpZiBqc29uLWVuY29kaW5n LXByZXR0eS1wcmludAohICAgICAgICAgICAgICAgICAgICAgICAoY29uY2F0IGpzb24tZW5jb2Rp bmctY3VycmVudC1pbmRlbnRhdGlvbgohICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpz b24tZW5jb2RpbmctZGVmYXVsdC1pbmRlbnRhdGlvbikKISAgICAgICAgICAgICAgICAgICAgICIi KSkpCiEgICAgICAgICAgICAgIChtYXBjYXIgKGxhbWJkYSAoY29ucykKISAgICAgICAgICAgICAg ICAgICAgICAgIChmb3JtYXQgKGlmIGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50CiEgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiJXMlczogJXMiCiEgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIiVzJXM6JXMiKQohICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAoanNvbi0tY3VycmVudC13aGl0ZXNwYWNlKQohICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAoanNvbi1lbmNvZGUgKGNhciBjb25zKSkKISAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgKGpzb24tZW5jb2RlIChjZHIgY29ucykpKSkKISAgICAgICAgICAgICAgICAgICAg ICBhbGlzdCkpCiEgICAgICAgICAgICAgICAgICAgICAganNvbi1lbmNvZGluZy1kZWZhdWx0LXNl cGFyYXRvcikKISAgICAgICAgICAgKGlmIGpzb24tZW5jb2RpbmctbGlzcC1zdHlsZS1jbG9zaW5n cwohICAgICAgICAgICAgICAgIiIKISAgICAgICAgICAgICAoanNvbi0tY3VycmVudC13aGl0ZXNw YWNlKSkpKQogIAogIChkZWZ1biBqc29uLWVuY29kZS1wbGlzdCAocGxpc3QpCiAgICAiUmV0dXJu IGEgSlNPTiByZXByZXNlbnRhdGlvbiBvZiBQTElTVC4iCiAgICAobGV0IChyZXN1bHQpCiAgICAg ICh3aGlsZSBwbGlzdAohICAgICAgIChsZXQgKChqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50 YXRpb24KISAgICAgICAgICAgICAgKGlmIGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50CiEgICAg ICAgICAgICAgICAgICAoY29uY2F0IGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlvbgoh ICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uLWVuY29kaW5nLWRlZmF1bHQtaW5kZW50YXRp b24pCiEgICAgICAgICAgICAgICAgIiIpKSkKISAgICAgICAgIChwdXNoIChjb25jYXQKISAgICAg ICAgICAgICAgICAoanNvbi1lbmNvZGluZy1jdXJyZW50LWluZGVudGF0aW9uKQohICAgICAgICAg ICAgICAgIChqc29uLWVuY29kZSAoY2FyIHBsaXN0KSkKISAgICAgICAgICAgICAgICAoaWYganNv bi1lbmNvZGluZy1wcmV0dHktcHJpbnQKISAgICAgICAgICAgICAgICAgICAgIjogIgohICAgICAg ICAgICAgICAgICAgIjoiKQohICAgICAgICAgICAgICAgIChqc29uLWVuY29kZSAoY2FkciBwbGlz dCkpKQohICAgICAgICAgICAgICAgcmVzdWx0KSkKICAgICAgICAoc2V0cSBwbGlzdCAoY2RkciBw bGlzdCkpKQohICAgICAoY29uY2F0ICJ7IgohICAgICAgICAgICAgIChqc29uLWpvaW4gKG5yZXZl cnNlIHJlc3VsdCkganNvbi1lbmNvZGluZy1kZWZhdWx0LXNlcGFyYXRvcikKISAgICAgICAgICAg ICAoaWYgKGFuZCBqc29uLWVuY29kaW5nLXByZXR0eS1wcmludAohICAgICAgICAgICAgICAgICAg ICAgIChub3QganNvbi1lbmNvZGluZy1saXNwLXN0eWxlLWNsb3NpbmdzKSkKISAgICAgICAgICAg ICAgICAgKGZvcm1hdCAiJXMiIChqc29uLS1jdXJyZW50LXdoaXRlc3BhY2UpKQohICAgICAgICAg ICAgICAgIiIpCiEgICAgICAgICAgICAgIn0iKSkpCiAgCiAgKGRlZnVuIGpzb24tZW5jb2RlLWxp c3QgKGxpc3QpCiAgICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBvZiBMSVNULgoqKioq KioqKioqKioqKioKKioqIDQ2Miw0NjggKioqKiBiZWNvbWUgSlNPTiBvYmplY3RzLiIKICAKICAo ZGVmdW4ganNvbi1lbmNvZGUtYXJyYXkgKGFycmF5KQogICAgIlJldHVybiBhIEpTT04gcmVwcmVz ZW50YXRpb24gb2YgQVJSQVkuIgohICAgKGNvbmNhdCAiWyIgKG1hcGNvbmNhdCAnanNvbi1lbmNv ZGUgYXJyYXkgIiwgIikgIl0iKSkKICAKICAMCiAgCi0tLSA1MjYsNTQ5IC0tLS0KICAKICAoZGVm dW4ganNvbi1lbmNvZGUtYXJyYXkgKGFycmF5KQogICAgIlJldHVybiBhIEpTT04gcmVwcmVzZW50 YXRpb24gb2YgQVJSQVkuIgohICAgKGlmIChhbmQganNvbi1lbmNvZGluZy1wcmV0dHktcHJpbnQK ISAgICAgICAgICAgICg+IChsZW5ndGggYXJyYXkpIDApKQohICAgICAgIChjb25jYXQKISAgICAg ICAgKGxldCAoKGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlvbgohICAgICAgICAgICAg ICAgKGNvbmNhdCBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24KISAgICAgICAgICAg ICAgICAgICAgICAganNvbi1lbmNvZGluZy1kZWZhdWx0LWluZGVudGF0aW9uKSkpCiEgICAgICAg ICAgKGNvbmNhdCAoZm9ybWF0ICJbJXMiIChqc29uLS1jdXJyZW50LXdoaXRlc3BhY2UpKQohICAg ICAgICAgICAgICAgICAgKGpzb24tam9pbiAobWFwY2FyICdqc29uLWVuY29kZSBhcnJheSkKISAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZvcm1hdCAiJXMlcyIKISAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBqc29uLWVuY29kaW5nLWRlZmF1bHQtc2VwYXJhdG9yCiEg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGpzb24tLWN1cnJlbnQtd2hpdGVz cGFjZSkpKSkpCiEgICAgICAgIChmb3JtYXQgIiVzXSIKISAgICAgICAgICAgICAgICAoaWYganNv bi1lbmNvZGluZy1saXNwLXN0eWxlLWNsb3NpbmdzCiEgICAgICAgICAgICAgICAgICAgICIiCiEg ICAgICAgICAgICAgICAgICAoanNvbi0tY3VycmVudC13aGl0ZXNwYWNlKSkpKQohICAgICAoY29u Y2F0ICJbIgohICAgICAgICAgICAgIChtYXBjb25jYXQgJ2pzb24tZW5jb2RlIGFycmF5IGpzb24t ZW5jb2RpbmctZGVmYXVsdC1zZXBhcmF0b3IpCiEgICAgICAgICAgICAgIl0iKSkpCiAgCiAgDAog IAoqKioqKioqKioqKioqKioKKioqIDUyOSw1MzQgKioqKiBBZHZhbmNlcyBwb2ludCBqdXN0IHBh c3QgSlNPTiBvYmplY3QuIgotLS0gNjEwLDYzOCAtLS0tCiAgICAgICAgICAoKGxpc3RwIG9iamVj dCkgICAgICAgIChqc29uLWVuY29kZS1saXN0IG9iamVjdCkpCiAgICAgICAgICAodCAgICAgICAg ICAgICAgICAgICAgIChzaWduYWwgJ2pzb24tZXJyb3IgKGxpc3Qgb2JqZWN0KSkpKSkKICAKKyA7 OyBQcmV0dHkgcHJpbnRpbmcKKyAKKyAoZGVmdW4ganNvbi1wcmV0dHktcHJpbnQtYnVmZmVyICgp CisgICAiUHJldHR5LXByaW50IGN1cnJlbnQgYnVmZmVyLiIKKyAgIChpbnRlcmFjdGl2ZSkKKyAg IChsZXQqICgoanNvbi1lbmNvZGluZy1wcmV0dHktcHJpbnQgdCkKKyAgICAgICAgICAoanNvbi1z dHJpbmcgKGpzb24tZW5jb2RlIChqc29uLXJlYWQtZnJvbS1zdHJpbmcgKGJ1ZmZlci1zdHJpbmcp KSkpCisgICAgICAgICAgKGJ1ZiAoY3VycmVudC1idWZmZXIpKSkKKyAgICAgKHdpdGgtY3VycmVu dC1idWZmZXIgYnVmCisgICAgICAgKGVyYXNlLWJ1ZmZlcikKKyAgICAgICAoaW5zZXJ0IGpzb24t c3RyaW5nKSkpKQorIAorIChkZWZ1biBqc29uLXByZXR0eS1wcmludCAoKQorICAgIlByZXR0eS1w cmludCBzZWxlY3RlZCByZWdpb24uIgorICAgKGludGVyYWN0aXZlKQorICAgKHVubGVzcyBtYXJr LWFjdGl2ZQorICAgICAoZXJyb3IgIk5vIHJlZ2lvbiBzZWxlY3RlZC4iKSkKKyAgIChsZXQgKChi ZWdpbiAocmVnaW9uLWJlZ2lubmluZykpCisgICAgICAgICAoZW5kIChyZWdpb24tZW5kKSkKKyAg ICAgICAgIChqc29uLWVuY29kaW5nLXByZXR0eS1wcmludCB0KSkKKyAgICAgKGtpbGwtcmVnaW9u IGJlZ2luIGVuZCkKKyAgICAgKGluc2VydCAoanNvbi1lbmNvZGUgKGpzb24tcmVhZC1mcm9tLXN0 cmluZyAoY3VycmVudC1raWxsIDApKSkpKSkKKyAKICAocHJvdmlkZSAnanNvbikKICAKICA7Ozsg anNvbi5lbCBlbmRzIGhlcmUK --f46d044283d8a476f804cd0f7c62-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 30 16:05:50 2012 Received: (at 12634) by debbugs.gnu.org; 30 Oct 2012 20:05:50 +0000 Received: from localhost ([127.0.0.1]:40118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TTI4M-0000dJ-0f for submit@debbugs.gnu.org; Tue, 30 Oct 2012 16:05:50 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:45098) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TTI4K-0000dC-6g for 12634@debbugs.gnu.org; Tue, 30 Oct 2012 16:05:49 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu0/O+LET/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOjM4FYgwU X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="203178009" Received: from 206-248-177-19.dsl.teksavvy.com (HELO pastel.home) ([206.248.177.19]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 30 Oct 2012 16:03:12 -0400 Received: by pastel.home (Postfix, from userid 20848) id 9E0C259419; Tue, 30 Oct 2012 16:03:11 -0400 (EDT) From: Stefan Monnier To: Ryan Crum Subject: Re: bug#12634: Patch for pretty-printing in json.el Message-ID: References: Date: Tue, 30 Oct 2012 16:03:11 -0400 In-Reply-To: (Ryan Crum's message of "Sat, 27 Oct 2012 15:31:46 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > Cool, new patch attached. I've consolidated current-separator into > current-indentation and created a little private helper function > `json--current-whitespace' for the newline/indentation. Thanks. More questions/remarks: - Your patch does not apply to the trunk version of json.el where alist/plist keys are encoded with a new json-encode-key. - I don't understand this helper function. Why not store the leading "\n" directly in json-encoding-current-indentation so that we can use json-encoding-current-indentation directly instead of calling json--current-whitespace? - BTW your patch calls json-encoding-current-indentation as a function in json-encode-plist. - OTOH, I wouldn't mind a helper function/macro to consolidate all the (let ((json-encoding-current-indentation (if json-encoding-pretty-print (concat json-encoding-current-indentation json-encoding-default-indentation) ""))) in a single spot. - Why use ", " rather than "," for json-encoding-default-separator? - json-encoding-default-separator is a bad name since it holds the *current* separator, rather than the default. - Why (format "%s" (json--current-whitespace)) rather than (json--current-whitespace)? > I've also created a var called `json-encoding-lisp-style-closings' per your > request. :-) Thanks. > Just let me know if there's anything else. I think that's enough nitpicking for now. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 30 17:07:30 2012 Received: (at 12634) by debbugs.gnu.org; 30 Oct 2012 21:07:31 +0000 Received: from localhost ([127.0.0.1]:40200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TTJ22-0002GX-FM for submit@debbugs.gnu.org; Tue, 30 Oct 2012 17:07:30 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:40267) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TTJ1z-0002GO-69 for 12634@debbugs.gnu.org; Tue, 30 Oct 2012 17:07:28 -0400 Received: by mail-wi0-f180.google.com with SMTP id hm4so552361wib.15 for <12634@debbugs.gnu.org>; Tue, 30 Oct 2012 14:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7szhEfW/6DgjmwW9TdsIOeN8F+/U2vuB4NPCfu0/dgI=; b=bRGNX4mJBUpytEtUK193TiNi/HysRh1aQHdGJ3wBVCH3R6OqLjYYlhV9QOPceDuulx hGbm6j/ww41dqbmC+t+L0mT3Yv1WrXPDdPvpOOODfZAfEMcmvIKRTZZk2rK/a96QwnSw 8FkibeNjfjV5F1FhyYlvBKbCdzyJP+FGDiOrAOqTAksLPt7yH2IgPl1fbXVGoSHItmz9 wfn51U7DoTGruoBeJDAQDxuRIgdpI35DyU/Z/Sg9azO3P7iz22AKS1fg2ACWNqK8os/x G3LebR+5CatszauffvbMQ/SOF+Jf7Jv5ZG0lOkMLp43zoZTcGRMsltFfODITPe9YUwMh rqiQ== MIME-Version: 1.0 Received: by 10.216.193.136 with SMTP id k8mr17972490wen.188.1351631092945; Tue, 30 Oct 2012 14:04:52 -0700 (PDT) Received: by 10.194.44.40 with HTTP; Tue, 30 Oct 2012 14:04:52 -0700 (PDT) In-Reply-To: References: Date: Tue, 30 Oct 2012 17:04:52 -0400 Message-ID: Subject: Re: bug#12634: Patch for pretty-printing in json.el From: Ryan Crum To: Stefan Monnier Content-Type: multipart/mixed; boundary=001636c92cfd2994f304cd4d234f X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.1 (/) --001636c92cfd2994f304cd4d234f Content-Type: multipart/alternative; boundary=001636c92cfd2994ed04cd4d234d --001636c92cfd2994ed04cd4d234d Content-Type: text/plain; charset=UTF-8 OK, let's try this again. New patch attached. On Tue, Oct 30, 2012 at 4:03 PM, Stefan Monnier wrote: > - Your patch does not apply to the trunk version of json.el where > alist/plist keys are encoded with a new json-encode-key. > Oops. Fixed. > > - I don't understand this helper function. Why not store the leading "\n" > directly in json-encoding-current-indentation so that > we can use json-encoding-current-indentation directly instead of > calling json--current-whitespace? > Yeah, I see what you mean. Fixed. > > - BTW your patch calls json-encoding-current-indentation as a function in > json-encode-plist. > Foggy-headed. Fixed. > > - OTOH, I wouldn't mind a helper function/macro to consolidate all the > > (let ((json-encoding-current-indentation > (if json-encoding-pretty-print > (concat json-encoding-current-indentation > json-encoding-default-indentation) > ""))) > > in a single spot. > I created a little macro for this (json--with-indentation). > > - Why use ", " rather than "," for json-encoding-default-separator? > Vestigial code from a much older version of this patch. Fixed. > > - json-encoding-default-separator is a bad name since it holds the > *current* separator, rather than the default. > Renamed to json-encoding-separator. This was also vestigial (at one point it only used line-breaks if lists were beyond a certain length; overly complex). > - Why (format "%s" (json--current-whitespace)) rather than > (json--current-whitespace)? > Yeah, good question. Fixed. --001636c92cfd2994ed04cd4d234d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable OK, let's try this again.

New patch attached.

On Tue, Oct 30, 2012 at 4:03 PM, Stefan Monnier <= monnier@iro.umontreal.ca> wrote:
- Your patch does not apply to the trunk version of json.el where
=C2=A0 alist/plist keys are encoded with a new json-encode-key.

Oops. Fixed.
=C2=A0

- I don't understand this helper function. =C2=A0Why not store the lead= ing "\n"
=C2=A0 directly in json-encoding-current-indentation so that
=C2=A0 we can use json-encoding-current-indentation directly instead of
=C2=A0 calling json--current-whitespace?

Yeah, I s= ee what you mean. Fixed.
=C2=A0

- BTW your patch calls json-encoding-current-indentation as a function in =C2=A0 json-encode-plist.

Foggy-headed. Fixed.
= =C2=A0

- OTOH, I wouldn't mind a helper function/macro to consolidate all the<= br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((json-encoding-current-indentation=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if json-enco= ding-pretty-print
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(concat json-encoding-current-indentation
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0json-encoding-default-indentation)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"= ")))

=C2=A0 in a single spot.

I created a little macro = for this (json--with-indentation).
=C2=A0

- Why use ", " rather than "," for json-encoding-defaul= t-separator?

Vestigial code from a much older vers= ion of this patch. Fixed.
=C2=A0

- json-encoding-default-separator is a bad name since it holds the
=C2=A0 *current* separator, rather than the default.
<= br>Renamed to json-encoding-separator. This was also vestigial (at one poin= t it only used line-breaks if lists were beyond a certain length; overly co= mplex).
=C2=A0
- Why (format "%s" (json--current-whitespace)) rather than
=C2=A0 (json--current-whitespace)?

Yeah, good ques= tion. Fixed.

--001636c92cfd2994ed04cd4d234d-- --001636c92cfd2994f304cd4d234f Content-Type: application/octet-stream; name="json-pretty-printing.diff" Content-Disposition: attachment; filename="json-pretty-printing.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h8xi792o0 KioqIGEvanNvbi5lbAotLS0gYi9qc29uLmVsCioqKioqKioqKioqKioqKgoqKiogMyw5ICoqKioK ICA7OyBDb3B5cmlnaHQgKEMpIDIwMDYtMjAxMiBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sIElu Yy4KICAKICA7OyBBdXRob3I6IEVkd2FyZCBPJ0Nvbm5vciA8dGVkQG9jb25ub3IuY3g+CiEgOzsg VmVyc2lvbjogMS4zCiAgOzsgS2V5d29yZHM6IGNvbnZlbmllbmNlCiAgCiAgOzsgVGhpcyBmaWxl IGlzIHBhcnQgb2YgR05VIEVtYWNzLgotLS0gMyw5IC0tLS0KICA7OyBDb3B5cmlnaHQgKEMpIDIw MDYtMjAxMiBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sIEluYy4KICAKICA7OyBBdXRob3I6IEVk d2FyZCBPJ0Nvbm5vciA8dGVkQG9jb25ub3IuY3g+CiEgOzsgVmVyc2lvbjogMS40CiAgOzsgS2V5 d29yZHM6IGNvbnZlbmllbmNlCiAgCiAgOzsgVGhpcyBmaWxlIGlzIHBhcnQgb2YgR05VIEVtYWNz LgoqKioqKioqKioqKioqKioKKioqIDQ4LDUzICoqKioKLS0tIDQ4LDU0IC0tLS0KICA7OyAyMDA2 LTEyLTI5IC0gWEVtYWNzIHN1cHBvcnQsIGZyb20gQWlkYW4gS2Vob2UgPGtlaG9lYUBwYXJoYXNh cmQubmV0Pi4KICA7OyAyMDA4LTAyLTIxIC0gSW5zdGFsbGVkIGluIEdOVSBFbWFjcy4KICA7OyAy MDExLTEwLTE3IC0gUGF0Y2ggYGpzb24tYWxpc3QtcCcgYW5kIGBqc29uLXBsaXN0LXAnIHRvIGF2 b2lkIHJlY3Vyc2lvbiAtdHp6CisgOzsgMjAxMi0xMC0yNSAtIEFkZGVkIHByZXR0eS1wcmludGVk IHJlZm9ybWF0dGluZyAtUnlhbiBDcnVtIChyeWFuQHJ5YW5jcnVtLm9yZykKICAKICA7OzsgQ29k ZToKICAKKioqKioqKioqKioqKioqCioqKiA5OSwxMDQgKioqKiBJZiB0aGlzIGhhcyB0aGUgc2Ft ZSB2YWx1ZSBhcyBganNvbi1mYWxzZScsIHlvdSBtaWdodCBub3QgYmUgYWJsZSB0bwotLS0gMTAw LDEyNCAtLS0tCiAgdGVsbCB0aGUgZGlmZmVyZW5jZSBiZXR3ZWVuIGBmYWxzZScgYW5kIGBudWxs Jy4gIENvbnNpZGVyIGxldC1iaW5kaW5nCiAgdGhpcyBhcm91bmQgeW91ciBjYWxsIHRvIGBqc29u LXJlYWQnIGluc3RlYWQgb2YgYHNldHEnaW5nIGl0LiIpCiAgCisgKGRlZnZhciBqc29uLWVuY29k aW5nLXNlcGFyYXRvciAiLCIKKyAgICJWYWx1ZSB0byB1c2UgYXMgYW4gZWxlbWVudCBzZXBlcmF0 b3Igd2hlbiBlbmNvZGluZy4iKQorIAorIChkZWZ2YXIganNvbi1lbmNvZGluZy1kZWZhdWx0LWlu ZGVudGF0aW9uICIgICIKKyAgICJUaGUgZGVmYXVsdCBpbmRlbnRhdGlvbiBsZXZlbCBmb3IgZW5j b2RpbmcuIFVzZWQgb25seSB3aGVuCisgYGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50JyBpcyBu b24tbmlsLiIpCisgCisgKGRlZnZhciBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24g IlxuIgorICAgIkludGVybmFsbHkgdXNlZCB0byBrZWVwIHRyYWNrIG9mIHRoZSBjdXJyZW50IGlu ZGVudGF0aW9uIGxldmVsIG9mCisgZW5jb2RpbmcuIFVzZWQgb25seSB3aGVuIGBqc29uLWVuY29k aW5nLXByZXR0eS1wcmludCcgaXMgbm9uLW5pbC4iKQorIAorIChkZWZ2YXIganNvbi1lbmNvZGlu Zy1wcmV0dHktcHJpbnQgbmlsCisgICAiU2V0dGluZyB0aGlzIHRvIG5vbi1uaWwgd2lsbCByZXN1 bHQgaW4gdGhlIG91dHB1dCBvZiBganNvbi1lbmNvZGUnCisgdG8gYmUgcHJldHR5LXByaW50ZWQu IikKKyAKKyAoZGVmdmFyIGpzb24tZW5jb2RpbmctbGlzcC1zdHlsZS1jbG9zaW5ncyBuaWwKKyAg ICJTZXR0aW5nIHRoaXMgdG8gYHQnIHdpbGwgY2F1c2UgXSBhbmQgfSBjbG9zaW5ncyB0byBoYXBw ZW4gbGlzcC1zdHlsZSwKKyB3aXRob3V0IGluZGVudGF0aW9uLiIpCisgCiAgDAogIAogIDs7OyBV dGlsaXRpZXMKKioqKioqKioqKioqKioqCioqKiAxMjQsMTI5ICoqKiogdGhpcyBhcm91bmQgeW91 ciBjYWxsIHRvIGBqc29uLXJlYWQnIGluc3RlYWQgb2YgYHNldHEnaW5nIGl0LiIpCi0tLSAxNDQs MTU3IC0tLS0KICAgICAgICAgICAgICAgICAgICdub3QtcGxpc3QpKSkKICAgIChudWxsIGxpc3Qp KQogIAorIChkZWZtYWNybyBqc29uLS13aXRoLWluZGVudGF0aW9uIChib2R5KQorICAgYChsZXQg KChqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24KKyAgICAgICAgICAgKGlmIGpzb24t ZW5jb2RpbmctcHJldHR5LXByaW50CisgICAgICAgICAgICAgICAoY29uY2F0IGpzb24tZW5jb2Rp bmctY3VycmVudC1pbmRlbnRhdGlvbgorICAgICAgICAgICAgICAgICAgICAgICBqc29uLWVuY29k aW5nLWRlZmF1bHQtaW5kZW50YXRpb24pCisgICAgICAgICAgICAgIiIpKSkKKyAgICAgICxib2R5 KSkKKyAKICA7OyBSZWFkZXIgdXRpbGl0aWVzCiAgCiAgKGRlZnN1YnN0IGpzb24tYWR2YW5jZSAo Jm9wdGlvbmFsIG4pCioqKioqKioqKioqKioqKgoqKiogNDAyLDQ0MiAqKioqIFBsZWFzZSBzZWUg dGhlIGRvY3VtZW50YXRpb24gb2YgYGpzb24tb2JqZWN0LXR5cGUnIGFuZCBganNvbi1rZXktdHlw ZScuIgogIAogIChkZWZ1biBqc29uLWVuY29kZS1oYXNoLXRhYmxlIChoYXNoLXRhYmxlKQogICAg IlJldHVybiBhIEpTT04gcmVwcmVzZW50YXRpb24gb2YgSEFTSC1UQUJMRS4iCiEgICAoZm9ybWF0 ICJ7JXN9IgogICAgICAgICAgICAoanNvbi1qb2luCiAgICAgICAgICAgICAobGV0IChyKQohICAg ICAgICAgICAgICAobWFwaGFzaAohICAgICAgICAgICAgICAgKGxhbWJkYSAoayB2KQohICAgICAg ICAgICAgICAgICAocHVzaCAoZm9ybWF0ICIlczolcyIKISAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAoanNvbi1lbmNvZGUta2V5IGspCiEgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgKGpzb24tZW5jb2RlIHYpKQohICAgICAgICAgICAgICAgICAgICAgICByKSkKISAgICAgICAg ICAgICAgIGhhc2gtdGFibGUpCiAgICAgICAgICAgICAgIHIpCiEgICAgICAgICAgICAiLCAiKSkp CiAgCiAgOzsgTGlzdCBlbmNvZGluZyAoaW5jbHVkaW5nIGFsaXN0cyBhbmQgcGxpc3RzKQogIAog IChkZWZ1biBqc29uLWVuY29kZS1hbGlzdCAoYWxpc3QpCiAgICAiUmV0dXJuIGEgSlNPTiByZXBy ZXNlbnRhdGlvbiBvZiBBTElTVC4iCiEgICAoZm9ybWF0ICJ7JXN9IgohICAgICAgICAgICAoanNv bi1qb2luIChtYXBjYXIgKGxhbWJkYSAoY29ucykKISAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgKGZvcm1hdCAiJXM6JXMiCiEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgKGpzb24tZW5jb2RlLWtleSAoY2FyIGNvbnMpKQohICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIChqc29uLWVuY29kZSAoY2RyIGNvbnMpKSkpCiEgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICBhbGlzdCkKISAgICAgICAgICAgICAgICAgICAgICAiLCAiKSkp CiAgCiAgKGRlZnVuIGpzb24tZW5jb2RlLXBsaXN0IChwbGlzdCkKICAgICJSZXR1cm4gYSBKU09O IHJlcHJlc2VudGF0aW9uIG9mIFBMSVNULiIKICAgIChsZXQgKHJlc3VsdCkKISAgICAgKHdoaWxl IHBsaXN0CiEgICAgICAgKHB1c2ggKGNvbmNhdCAoanNvbi1lbmNvZGUta2V5IChjYXIgcGxpc3Qp KQohICAgICAgICAgICAgICAgICAgICAgIjoiCiEgICAgICAgICAgICAgICAgICAgICAoanNvbi1l bmNvZGUgKGNhZHIgcGxpc3QpKSkKISAgICAgICAgICAgICByZXN1bHQpCiEgICAgICAgKHNldHEg cGxpc3QgKGNkZHIgcGxpc3QpKSkKISAgICAgKGNvbmNhdCAieyIgKGpzb24tam9pbiAobnJldmVy c2UgcmVzdWx0KSAiLCAiKSAifSIpKSkKICAKICAoZGVmdW4ganNvbi1lbmNvZGUtbGlzdCAobGlz dCkKICAgICJSZXR1cm4gYSBKU09OIHJlcHJlc2VudGF0aW9uIG9mIExJU1QuCi0tLSA0MzAsNDk3 IC0tLS0KICAKICAoZGVmdW4ganNvbi1lbmNvZGUtaGFzaC10YWJsZSAoaGFzaC10YWJsZSkKICAg ICJSZXR1cm4gYSBKU09OIHJlcHJlc2VudGF0aW9uIG9mIEhBU0gtVEFCTEUuIgohICAgKGZvcm1h dCAoaWYganNvbi1lbmNvZGluZy1wcmV0dHktcHJpbnQgInslcyVzfSIgInslc30iKQogICAgICAg ICAgICAoanNvbi1qb2luCiAgICAgICAgICAgICAobGV0IChyKQohICAgICAgICAgICAgICAoanNv bi0td2l0aC1pbmRlbnRhdGlvbgohICAgICAgICAgICAgICAgIChtYXBoYXNoCiEgICAgICAgICAg ICAgICAgIChsYW1iZGEgKGsgdikKISAgICAgICAgICAgICAgICAgICAocHVzaCAoZm9ybWF0CiEg ICAgICAgICAgICAgICAgICAgICAgICAgIChpZiBqc29uLWVuY29kaW5nLXByZXR0eS1wcmludAoh ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiVzJXM6ICVzIgohICAgICAgICAgICAgICAg ICAgICAgICAgICAgICIlcyVzOiVzIikKISAgICAgICAgICAgICAgICAgICAgICAgICAganNvbi1l bmNvZGluZy1jdXJyZW50LWluZGVudGF0aW9uCiEgICAgICAgICAgICAgICAgICAgICAgICAgIChq c29uLWVuY29kZS1rZXkgaykKISAgICAgICAgICAgICAgICAgICAgICAgICAgKGpzb24tZW5jb2Rl IHYpKQohICAgICAgICAgICAgICAgICAgICAgICAgIHIpKQohICAgICAgICAgICAgICAgICBoYXNo LXRhYmxlKSkKICAgICAgICAgICAgICAgcikKISAgICAgICAgICAgIGpzb24tZW5jb2Rpbmctc2Vw YXJhdG9yKQohICAgICAgICAgICAoaWYganNvbi1lbmNvZGluZy1saXNwLXN0eWxlLWNsb3Npbmdz CiEgICAgICAgICAgICAgICAiIgohICAgICAgICAgICAgICAganNvbi1lbmNvZGluZy1jdXJyZW50 LWluZGVudGF0aW9uKSkpCiAgCiAgOzsgTGlzdCBlbmNvZGluZyAoaW5jbHVkaW5nIGFsaXN0cyBh bmQgcGxpc3RzKQogIAogIChkZWZ1biBqc29uLWVuY29kZS1hbGlzdCAoYWxpc3QpCiAgICAiUmV0 dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBvZiBBTElTVC4iCiEgICAoZm9ybWF0IChpZiBqc29u LWVuY29kaW5nLXByZXR0eS1wcmludCAieyVzJXN9IiAieyVzfSIpCiEgICAgICAgICAgIChqc29u LWpvaW4KISAgICAgICAgICAgIChqc29uLS13aXRoLWluZGVudGF0aW9uCiEgICAgICAgICAgICAg IChtYXBjYXIgKGxhbWJkYSAoY29ucykKISAgICAgICAgICAgICAgICAgICAgICAgIChmb3JtYXQg KGlmIGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50CiEgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAiJXMlczogJXMiCiEgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IiVzJXM6JXMiKQohICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uLWVuY29kaW5n LWN1cnJlbnQtaW5kZW50YXRpb24KISAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGpz b24tZW5jb2RlLWtleSAoY2FyIGNvbnMpKQohICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAoanNvbi1lbmNvZGUgKGNkciBjb25zKSkpKQohICAgICAgICAgICAgICAgICAgICAgIGFsaXN0 KSkKISAgICAgICAgICAgICAgICAgICAgICBqc29uLWVuY29kaW5nLXNlcGFyYXRvcikKISAgICAg ICAgICAgKGlmIGpzb24tZW5jb2RpbmctbGlzcC1zdHlsZS1jbG9zaW5ncwohICAgICAgICAgICAg ICAgIiIKISAgICAgICAgICAgICBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24pKSkK ICAKICAoZGVmdW4ganNvbi1lbmNvZGUtcGxpc3QgKHBsaXN0KQogICAgIlJldHVybiBhIEpTT04g cmVwcmVzZW50YXRpb24gb2YgUExJU1QuIgogICAgKGxldCAocmVzdWx0KQohICAgICAoanNvbi0t d2l0aC1pbmRlbnRhdGlvbgohICAgICAgICh3aGlsZSBwbGlzdAohICAgICAgICAgKHB1c2ggKGNv bmNhdAohICAgICAgICAgICAgICAgIGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlvbgoh ICAgICAgICAgICAgICAgIChqc29uLWVuY29kZS1rZXkgKGNhciBwbGlzdCkpCiEgICAgICAgICAg ICAgICAgKGlmIGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50CiEgICAgICAgICAgICAgICAgICAg ICI6ICIKISAgICAgICAgICAgICAgICAgICI6IikKISAgICAgICAgICAgICAgICAoanNvbi1lbmNv ZGUgKGNhZHIgcGxpc3QpKSkKISAgICAgICAgICAgICAgIHJlc3VsdCkKISAgICAgICAgIChzZXRx IHBsaXN0IChjZGRyIHBsaXN0KSkpKQohICAgICAoY29uY2F0ICJ7IgohICAgICAgICAgICAgIChq c29uLWpvaW4gKG5yZXZlcnNlIHJlc3VsdCkganNvbi1lbmNvZGluZy1zZXBhcmF0b3IpCiEgICAg ICAgICAgICAgKGlmIChhbmQganNvbi1lbmNvZGluZy1wcmV0dHktcHJpbnQKISAgICAgICAgICAg ICAgICAgICAgICAobm90IGpzb24tZW5jb2RpbmctbGlzcC1zdHlsZS1jbG9zaW5ncykpCiEgICAg ICAgICAgICAgICAgIGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlvbgohICAgICAgICAg ICAgICAgIiIpCiEgICAgICAgICAgICAgIn0iKSkpCiAgCiAgKGRlZnVuIGpzb24tZW5jb2RlLWxp c3QgKGxpc3QpCiAgICAiUmV0dXJuIGEgSlNPTiByZXByZXNlbnRhdGlvbiBvZiBMSVNULgoqKioq KioqKioqKioqKioKKioqIDQ3NSw0ODEgKioqKiBiZWNvbWUgSlNPTiBvYmplY3RzLiIKICAKICAo ZGVmdW4ganNvbi1lbmNvZGUtYXJyYXkgKGFycmF5KQogICAgIlJldHVybiBhIEpTT04gcmVwcmVz ZW50YXRpb24gb2YgQVJSQVkuIgohICAgKGNvbmNhdCAiWyIgKG1hcGNvbmNhdCAnanNvbi1lbmNv ZGUgYXJyYXkgIiwgIikgIl0iKSkKICAKICAMCiAgCi0tLSA1MzAsNTUzIC0tLS0KICAKICAoZGVm dW4ganNvbi1lbmNvZGUtYXJyYXkgKGFycmF5KQogICAgIlJldHVybiBhIEpTT04gcmVwcmVzZW50 YXRpb24gb2YgQVJSQVkuIgohICAgKGlmIChhbmQganNvbi1lbmNvZGluZy1wcmV0dHktcHJpbnQK ISAgICAgICAgICAgICg+IChsZW5ndGggYXJyYXkpIDApKQohICAgICAgIChjb25jYXQKISAgICAg ICAgKGxldCAoKGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlvbgohICAgICAgICAgICAg ICAgKGNvbmNhdCBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24KISAgICAgICAgICAg ICAgICAgICAgICAganNvbi1lbmNvZGluZy1kZWZhdWx0LWluZGVudGF0aW9uKSkpCiEgICAgICAg ICAgKGNvbmNhdCAoZm9ybWF0ICJbJXMiIGpzb24tZW5jb2RpbmctY3VycmVudC1pbmRlbnRhdGlv bikKISAgICAgICAgICAgICAgICAgIChqc29uLWpvaW4gKG1hcGNhciAnanNvbi1lbmNvZGUgYXJy YXkpCiEgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmb3JtYXQgIiVzJXMiCiEgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbi1lbmNvZGluZy1zZXBhcmF0b3IKISAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uLWVuY29kaW5nLWN1cnJlbnQt aW5kZW50YXRpb24pKSkpCiEgICAgICAgIChmb3JtYXQgIiVzXSIKISAgICAgICAgICAgICAgICAo aWYganNvbi1lbmNvZGluZy1saXNwLXN0eWxlLWNsb3NpbmdzCiEgICAgICAgICAgICAgICAgICAg ICIiCiEgICAgICAgICAgICAgICAgICBqc29uLWVuY29kaW5nLWN1cnJlbnQtaW5kZW50YXRpb24p KSkKISAgICAgKGNvbmNhdCAiWyIKISAgICAgICAgICAgICAobWFwY29uY2F0ICdqc29uLWVuY29k ZSBhcnJheSBqc29uLWVuY29kaW5nLXNlcGFyYXRvcikKISAgICAgICAgICAgICAiXSIpKSkKICAK ICAMCiAgCioqKioqKioqKioqKioqKgoqKiogNTQyLDU0NyAqKioqIEFkdmFuY2VzIHBvaW50IGp1 c3QgcGFzdCBKU09OIG9iamVjdC4iCi0tLSA2MTQsNjQyIC0tLS0KICAgICAgICAgICgobGlzdHAg b2JqZWN0KSAgICAgICAgKGpzb24tZW5jb2RlLWxpc3Qgb2JqZWN0KSkKICAgICAgICAgICh0ICAg ICAgICAgICAgICAgICAgICAgKHNpZ25hbCAnanNvbi1lcnJvciAobGlzdCBvYmplY3QpKSkpKQog IAorIDs7IFByZXR0eSBwcmludGluZworIAorIChkZWZ1biBqc29uLXByZXR0eS1wcmludC1idWZm ZXIgKCkKKyAgICJQcmV0dHktcHJpbnQgY3VycmVudCBidWZmZXIuIgorICAgKGludGVyYWN0aXZl KQorICAgKGxldCogKChqc29uLWVuY29kaW5nLXByZXR0eS1wcmludCB0KQorICAgICAgICAgIChq c29uLXN0cmluZyAoanNvbi1lbmNvZGUgKGpzb24tcmVhZC1mcm9tLXN0cmluZyAoYnVmZmVyLXN0 cmluZykpKSkKKyAgICAgICAgICAoYnVmIChjdXJyZW50LWJ1ZmZlcikpKQorICAgICAod2l0aC1j dXJyZW50LWJ1ZmZlciBidWYKKyAgICAgICAoZXJhc2UtYnVmZmVyKQorICAgICAgIChpbnNlcnQg anNvbi1zdHJpbmcpKSkpCisgCisgKGRlZnVuIGpzb24tcHJldHR5LXByaW50ICgpCisgICAiUHJl dHR5LXByaW50IHNlbGVjdGVkIHJlZ2lvbi4iCisgICAoaW50ZXJhY3RpdmUpCisgICAodW5sZXNz IG1hcmstYWN0aXZlCisgICAgIChlcnJvciAiTm8gcmVnaW9uIHNlbGVjdGVkLiIpKQorICAgKGxl dCAoKGJlZ2luIChyZWdpb24tYmVnaW5uaW5nKSkKKyAgICAgICAgIChlbmQgKHJlZ2lvbi1lbmQp KQorICAgICAgICAgKGpzb24tZW5jb2RpbmctcHJldHR5LXByaW50IHQpKQorICAgICAoa2lsbC1y ZWdpb24gYmVnaW4gZW5kKQorICAgICAoaW5zZXJ0IChqc29uLWVuY29kZSAoanNvbi1yZWFkLWZy b20tc3RyaW5nIChjdXJyZW50LWtpbGwgMCkpKSkpKQorIAogIChwcm92aWRlICdqc29uKQogIAog IDs7OyBqc29uLmVsIGVuZHMgaGVyZQo= --001636c92cfd2994f304cd4d234f-- From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 14 20:57:13 2012 Received: (at 12634) by debbugs.gnu.org; 15 Nov 2012 01:57:13 +0000 Received: from localhost ([127.0.0.1]:43178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TYohc-00059h-Bw for submit@debbugs.gnu.org; Wed, 14 Nov 2012 20:57:13 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:1030) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TYoha-00059a-8o for 12634@debbugs.gnu.org; Wed, 14 Nov 2012 20:57:10 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09sr+ZY/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kiBwFugmQRAOIQppxgViDBw X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="207643746" Received: from 108-175-230-88.dsl.teksavvy.com (HELO pastel.home) ([108.175.230.88]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 14 Nov 2012 20:56:31 -0500 Received: by pastel.home (Postfix, from userid 20848) id 04F11594C8; Wed, 14 Nov 2012 20:56:30 -0500 (EST) From: Stefan Monnier To: Ryan Crum Subject: Re: bug#12634: Patch for pretty-printing in json.el Message-ID: References: Date: Wed, 14 Nov 2012 20:56:30 -0500 In-Reply-To: (Ryan Crum's message of "Tue, 30 Oct 2012 17:04:52 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > OK, let's try this again. > New patch attached. Getting there. But still waiting for the copyright paperwork. Since we still have time, here are some further nitpicks. > @@ -99,6 +100,25 @@ > tell the difference between `false' and `null'. Consider let-binding > this around your call to `json-read' instead of `setq'ing it.") > +(defvar json-encoding-separator "," > + "Value to use as an element seperator when encoding.") > + > +(defvar json-encoding-default-indentation " " > + "The default indentation level for encoding. Used only when > +`json-encoding-pretty-print' is non-nil.") > + > +(defvar json-encoding-current-indentation "\n" > + "Internally used to keep track of the current indentation level of > +encoding. Used only when `json-encoding-pretty-print' is non-nil.") Use a "json--" prefix, since it's a convention we use to express that something is internal. > +(defvar json-encoding-pretty-print nil > + "Setting this to non-nil will result in the output of `json-encode' > +to be pretty-printed.") > + > +(defvar json-encoding-lisp-style-closings nil > + "Setting this to `t' will cause ] and } closings to happen lisp-style, > +without indentation.") The first line of a docstring should "stand on it own", i.e. it shouldn't end in the middle of a sentence. Try C-u M-x checkdoc-current-buffer. Rather than "Setting this to will cause ", we usually just say "If , ". E.g. "If non-nil, the output of `json-encode' will be pretty-printed." Also, contrary to all other symbols, t (like nil) is written without `...' quoting. > +(defmacro json--with-indentation (body) > + `(let ((json-encoding-current-indentation > + (if json-encoding-pretty-print > + (concat json-encoding-current-indentation > + json-encoding-default-indentation) > + ""))) > + ,body)) Good. > (defun json-encode-hash-table (hash-table) > "Return a JSON representation of HASH-TABLE." > - (format "{%s}" > + (format (if json-encoding-pretty-print "{%s%s}" "{%s}") Hmm... if json-encoding-pretty-print is nil, we still pass 2 args, and the second is always "", so we can always use "{%s%s}", right? > (json-join > (let (r) > - (maphash > - (lambda (k v) > - (push (format "%s:%s" > - (json-encode-key k) > - (json-encode v)) > - r)) > - hash-table) > + (json--with-indentation > + (maphash > + (lambda (k v) > + (push (format > + (if json-encoding-pretty-print > + "%s%s: %s" > + "%s%s:%s") > + json-encoding-current-indentation > + (json-encode-key k) > + (json-encode v)) > + r)) > + hash-table)) > r) > - ", "))) > + json-encoding-separator) > + (if json-encoding-lisp-style-closings > + "" > + json-encoding-current-indentation))) [ It just occurs to me, that the json printer should print to a buffer, rather than to a string. But let's keep this issue for later. ] > - (concat "[" (mapconcat 'json-encode array ", ") "]")) > + (if (and json-encoding-pretty-print > + (> (length array) 0)) > + (concat > + (let ((json-encoding-current-indentation > + (concat json-encoding-current-indentation > + json-encoding-default-indentation))) Use json--with-indentation here (even if it performs an extra redundant test of json-encoding-pretty-print). Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 17 13:45:50 2012 Received: (at 12634) by debbugs.gnu.org; 17 Nov 2012 18:45:50 +0000 Received: from localhost ([127.0.0.1]:51232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TZnOn-0008NV-Pg for submit@debbugs.gnu.org; Sat, 17 Nov 2012 13:45:50 -0500 Received: from mail-gh0-f172.google.com ([209.85.160.172]:47893) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TZmLO-0006rh-CR for 12634@debbugs.gnu.org; Sat, 17 Nov 2012 12:38:16 -0500 Received: by mail-gh0-f172.google.com with SMTP id g10so723429ghb.3 for <12634@debbugs.gnu.org>; Sat, 17 Nov 2012 09:37:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to:x-mailer:x-gm-message-state; bh=e5WYfgIwe230rv57TR1HzTxMJyY0LpnQWxBx0PDmtwI=; b=RQqrNH5gLlj3mOfDExVVpMFYKw8+QRdU9WCvej3hIp6bd0ZNGx8LMoXK53EZvPqxuZ hy8hzfovmrHOuP3Vl615snpWhWYW4NpzXuUnatN70wEfOdtsHAt8cR5/fp+mfm8z2twU GHEl1wh8Ah0Ei/HpZusSqNM95yVvhSbW6CKZmLlGhWw1VeAb2C7gHt+lhg7wxAQhgCcJ Yhwd6eKknX8M5H7yBoKx510tQrL6iEoCWWcQXhqqZUH2um5qJQfsX0UikhCL70DLPp7Y mHwYTe9riM0DLVwB046DE5bCdonXywY6BMyXCYsroztb9X5dpYt++zn5JgVj1zf8VJZK Rg8A== Received: by 10.236.87.208 with SMTP id y56mr7825292yhe.9.1353173839706; Sat, 17 Nov 2012 09:37:19 -0800 (PST) Received: from [192.168.1.55] ([24.49.197.147]) by mx.google.com with ESMTPS id s21sm4845082yhb.5.2012.11.17.09.37.18 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 17 Nov 2012 09:37:18 -0800 (PST) Subject: Re: bug#12634: Patch for pretty-printing in json.el Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/mixed; boundary="Apple-Mail=_B93A5F8F-358D-43B5-ABD5-2FBB43A6C19B" From: Ryan Crum In-Reply-To: Date: Sat, 17 Nov 2012 12:37:17 -0500 Message-Id: <9E9C89A9-FACE-47A9-BCC7-3AC5ABC64518@gmail.com> References: To: Stefan Monnier X-Mailer: Apple Mail (2.1278) X-Gm-Message-State: ALoCoQkVOED6oMgW2zytAkIO39Krnfneu7ejNrZkqYniO+YdTlAzCOxEOYWJWheNFGRPSOCO5OHO X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12634 X-Mailman-Approved-At: Sat, 17 Nov 2012 13:45:48 -0500 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.7 (/) --Apple-Mail=_B93A5F8F-358D-43B5-ABD5-2FBB43A6C19B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi Stefan, I actually have not yet received anything regarding copyright assignment = in the mail, so I resubmitted the questionnaire to assign@gnu.org today. New patch attached. --Apple-Mail=_B93A5F8F-358D-43B5-ABD5-2FBB43A6C19B Content-Disposition: attachment; filename=json-pretty-print.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="json-pretty-print.diff" Content-Transfer-Encoding: quoted-printable ***=20a/json.el=0A---=20b/json.el=0A***************=0A***=203,9=20****=0A= =20=20;;=20Copyright=20(C)=202006-2012=20Free=20Software=20Foundation,=20= Inc.=0A=20=20=0A=20=20;;=20Author:=20Edward=20O'Connor=20= =0A!=20;;=20Version:=201.3=0A=20=20;;=20Keywords:=20= convenience=0A=20=20=0A=20=20;;=20This=20file=20is=20part=20of=20GNU=20= Emacs.=0A---=203,9=20----=0A=20=20;;=20Copyright=20(C)=202006-2012=20= Free=20Software=20Foundation,=20Inc.=0A=20=20=0A=20=20;;=20Author:=20= Edward=20O'Connor=20=0A!=20;;=20Version:=201.4=0A=20=20= ;;=20Keywords:=20convenience=0A=20=20=0A=20=20;;=20This=20file=20is=20= part=20of=20GNU=20Emacs.=0A***************=0A***=2048,53=20****=0A---=20= 48,54=20----=0A=20=20;;=202006-12-29=20-=20XEmacs=20support,=20from=20= Aidan=20Kehoe=20.=0A=20=20;;=202008-02-21=20-=20= Installed=20in=20GNU=20Emacs.=0A=20=20;;=202011-10-17=20-=20Patch=20= `json-alist-p'=20and=20`json-plist-p'=20to=20avoid=20recursion=20-tzz=0A= +=20;;=202012-10-25=20-=20Added=20pretty-printed=20reformatting=20-Ryan=20= Crum=20(ryan@ryancrum.org)=0A=20=20=0A=20=20;;;=20Code:=0A=20=20=0A= ***************=0A***=2099,104=20****=20If=20this=20has=20the=20same=20= value=20as=20`json-false',=20you=20might=20not=20be=20able=20to=0A---=20= 100,122=20----=0A=20=20tell=20the=20difference=20between=20`false'=20and=20= `null'.=20=20Consider=20let-binding=0A=20=20this=20around=20your=20call=20= to=20`json-read'=20instead=20of=20`setq'ing=20it.")=0A=20=20=0A+=20= (defvar=20json-encoding-separator=20","=0A+=20=20=20"Value=20to=20use=20= as=20an=20element=20seperator=20when=20encoding.")=0A+=20=0A+=20(defvar=20= json-encoding-default-indentation=20"=20=20"=0A+=20=20=20"The=20default=20= indentation=20level=20for=20encoding.=0A+=20Used=20only=20when=20= `json-encoding-pretty-print'=20is=20non-nil.")=0A+=20=0A+=20(defvar=20= json--encoding-current-indentation=20"\n"=0A+=20=20=20"Internally=20used=20= to=20keep=20track=20of=20the=20current=20indentation=20level=20of=20= encoding.=0A+=20Used=20only=20when=20`json-encoding-pretty-print'=20is=20= non-nil.")=0A+=20=0A+=20(defvar=20json-encoding-pretty-print=20nil=0A+=20= =20=20"If=20non-nil,=20then=20the=20output=20of=20`json-encode'=20will=20= be=20pretty-printed.")=0A+=20=0A+=20(defvar=20= json-encoding-lisp-style-closings=20nil=0A+=20=20=20"If=20non-nil,=20]=20= and=20}=20closings=20will=20be=20formatted=20lisp-style,=20without=20= indentation.")=0A+=20=0A=20=20=0C=0A=20=20=0A=20=20;;;=20Utilities=0A= ***************=0A***=20124,129=20****=20this=20around=20your=20call=20= to=20`json-read'=20instead=20of=20`setq'ing=20it.")=0A---=20142,155=20= ----=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= 'not-plist)))=0A=20=20=20=20(null=20list))=0A=20=20=0A+=20(defmacro=20= json--with-indentation=20(body)=0A+=20=20=20`(let=20= ((json--encoding-current-indentation=0A+=20=20=20=20=20=20=20=20=20=20=20= (if=20json-encoding-pretty-print=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(concat=20json--encoding-current-indentation=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= json-encoding-default-indentation)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20"")))=0A+=20=20=20=20=20=20,body))=0A+=20=0A=20=20;;=20Reader=20= utilities=0A=20=20=0A=20=20(defsubst=20json-advance=20(&optional=20n)=0A= ***************=0A***=20402,442=20****=20Please=20see=20the=20= documentation=20of=20`json-object-type'=20and=20`json-key-type'."=0A=20=20= =0A=20=20(defun=20json-encode-hash-table=20(hash-table)=0A=20=20=20=20= "Return=20a=20JSON=20representation=20of=20HASH-TABLE."=0A!=20=20=20= (format=20"{%s}"=0A=20=20=20=20=20=20=20=20=20=20=20=20(json-join=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20(let=20(r)=0A!=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(maphash=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (lambda=20(k=20v)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (push=20(format=20"%s:%s"=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(json-encode-key=20k)=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(json-encode=20v))=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20r))=0A!=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20hash-table)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20r)=0A!=20=20=20=20=20=20=20=20=20=20=20=20",=20")))=0A=20=20=0A=20=20= ;;=20List=20encoding=20(including=20alists=20and=20plists)=0A=20=20=0A=20= =20(defun=20json-encode-alist=20(alist)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20ALIST."=0A!=20=20=20(format=20"{%s}"=0A!=20=20=20=20= =20=20=20=20=20=20=20(json-join=20(mapcar=20(lambda=20(cons)=0A!=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(format=20"%s:%s"=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(json-encode-key=20(car=20cons))=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(json-encode=20(cdr=20cons))))=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20alist)=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20",=20")))=0A= =20=20=0A=20=20(defun=20json-encode-plist=20(plist)=0A=20=20=20=20= "Return=20a=20JSON=20representation=20of=20PLIST."=0A=20=20=20=20(let=20= (result)=0A!=20=20=20=20=20(while=20plist=0A!=20=20=20=20=20=20=20(push=20= (concat=20(json-encode-key=20(car=20plist))=0A!=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20":"=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(json-encode=20(cadr=20plist)))=0A!=20=20= =20=20=20=20=20=20=20=20=20=20=20result)=0A!=20=20=20=20=20=20=20(setq=20= plist=20(cddr=20plist)))=0A!=20=20=20=20=20(concat=20"{"=20(json-join=20= (nreverse=20result)=20",=20")=20"}")))=0A=20=20=0A=20=20(defun=20= json-encode-list=20(list)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20LIST.=0A---=20428,497=20----=0A=20=20=0A=20=20= (defun=20json-encode-hash-table=20(hash-table)=0A=20=20=20=20"Return=20a=20= JSON=20representation=20of=20HASH-TABLE."=0A!=20=20=20(format=20"{%s%s}"=0A= =20=20=20=20=20=20=20=20=20=20=20=20(json-join=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20(let=20(r)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (json--with-indentation=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (maphash=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(lambda=20(k=20= v)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(push=20= (format=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(if=20json-encoding-pretty-print=0A!=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"%s%s:=20%s"=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"%s%s:%s")=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20json--encoding-current-indentation=0A!=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (json-encode-key=20k)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(json-encode=20v))=0A!=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20r))=0A!=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20hash-table))=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20r)=0A!=20=20=20=20=20=20=20=20=20=20=20=20= json-encoding-separator)=0A!=20=20=20=20=20=20=20=20=20=20=20(if=20(or=20= (not=20json-encoding-pretty-print)=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20json-encoding-lisp-style-closings)=0A!=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20""=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= json--encoding-current-indentation)))=0A=20=20=0A=20=20;;=20List=20= encoding=20(including=20alists=20and=20plists)=0A=20=20=0A=20=20(defun=20= json-encode-alist=20(alist)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20ALIST."=0A!=20=20=20(format=20"{%s%s}"=0A!=20=20=20= =20=20=20=20=20=20=20=20(json-join=0A!=20=20=20=20=20=20=20=20=20=20=20=20= (json--with-indentation=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= (mapcar=20(lambda=20(cons)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(format=20(if=20json-encoding-pretty-print=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20"%s%s:=20%s"=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "%s%s:%s")=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20json--encoding-current-indentation=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(json-encode-key=20(car=20cons))=0A!=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (json-encode=20(cdr=20cons))))=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20alist))=0A!=20=20=20=20=20=20=20=20=20=20=20=20= json-encoding-separator)=0A!=20=20=20=20=20=20=20=20=20=20=20(if=20(or=20= (not=20json-encoding-pretty-print)=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20json-encoding-lisp-style-closings)=0A!=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20""=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= json--encoding-current-indentation)))=0A=20=20=0A=20=20(defun=20= json-encode-plist=20(plist)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20PLIST."=0A=20=20=20=20(let=20(result)=0A!=20=20=20=20= =20(json--with-indentation=0A!=20=20=20=20=20=20=20(while=20plist=0A!=20=20= =20=20=20=20=20=20=20(push=20(concat=0A!=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20json--encoding-current-indentation=0A!=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(json-encode-key=20(car=20plist))=0A!=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(if=20json-encoding-pretty-print=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20":=20"=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20":")=0A!=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(json-encode=20(cadr=20plist)))=0A!=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20result)=0A!=20=20=20=20=20=20=20=20= =20(setq=20plist=20(cddr=20plist))))=0A!=20=20=20=20=20(concat=20"{"=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20(json-join=20(nreverse=20result)=20= json-encoding-separator)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20= (and=20json-encoding-pretty-print=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(not=20json-encoding-lisp-style-closings))=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= json--encoding-current-indentation=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"")=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20"}")))=0A=20=20=0A= =20=20(defun=20json-encode-list=20(list)=0A=20=20=20=20"Return=20a=20= JSON=20representation=20of=20LIST.=0A***************=0A***=20475,481=20= ****=20become=20JSON=20objects."=0A=20=20=0A=20=20(defun=20= json-encode-array=20(array)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20ARRAY."=0A!=20=20=20(concat=20"["=20(mapconcat=20= 'json-encode=20array=20",=20")=20"]"))=0A=20=20=0A=20=20=0C=0A=20=20=0A= ---=20530,551=20----=0A=20=20=0A=20=20(defun=20json-encode-array=20= (array)=0A=20=20=20=20"Return=20a=20JSON=20representation=20of=20ARRAY."=0A= !=20=20=20(if=20(and=20json-encoding-pretty-print=0A!=20=20=20=20=20=20=20= =20=20=20=20=20(>=20(length=20array)=200))=0A!=20=20=20=20=20=20=20= (concat=0A!=20=20=20=20=20=20=20=20(json--with-indentation=0A!=20=20=20=20= =20=20=20=20=20=20(concat=20(format=20"[%s"=20= json--encoding-current-indentation)=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(json-join=20(mapcar=20'json-encode=20array)=0A!=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(format=20"%s%s"=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= json-encoding-separator=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= json--encoding-current-indentation))))=0A!=20=20=20=20=20=20=20=20= (format=20"%s]"=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20= json-encoding-lisp-style-closings=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20""=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20json--encoding-current-indentation)))=0A!=20=20=20=20=20(concat=20= "["=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20(mapconcat=20'json-encode=20= array=20json-encoding-separator)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= "]")))=0A=20=20=0A=20=20=0C=0A=20=20=0A***************=0A***=20542,547=20= ****=20Advances=20point=20just=20past=20JSON=20object."=0A---=20612,644=20= ----=0A=20=20=20=20=20=20=20=20=20=20((listp=20object)=20=20=20=20=20=20=20= =20(json-encode-list=20object))=0A=20=20=20=20=20=20=20=20=20=20(t=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(signal=20= 'json-error=20(list=20object)))))=0A=20=20=0A+=20;;=20Pretty=20printing=0A= +=20=0A+=20(defun=20json-pretty-print-buffer=20()=0A+=20=20=20= "Pretty-print=20current=20buffer."=0A+=20=20=20(interactive)=0A+=20=20=20= (let*=20((json-encoding-pretty-print=20t)=0A+=20=20=20=20=20=20=20=20=20=20= (json-string=20(json-encode=20(json-read-from-string=20= (buffer-string))))=0A+=20=20=20=20=20=20=20=20=20=20(buf=20= (current-buffer)))=0A+=20=20=20=20=20(with-current-buffer=20buf=0A+=20=20= =20=20=20=20=20(erase-buffer)=0A+=20=20=20=20=20=20=20(insert=20= json-string))))=0A+=20=0A+=20(defun=20json-pretty-print=20()=0A+=20=20=20= "Pretty-print=20selected=20region."=0A+=20=20=20(interactive)=0A+=20=20=20= (unless=20mark-active=0A+=20=20=20=20=20(error=20"No=20region=20= selected."))=0A+=20=20=20(let=20((begin=20(region-beginning))=0A+=20=20=20= =20=20=20=20=20=20(end=20(region-end))=0A+=20=20=20=20=20=20=20=20=20= (json-encoding-pretty-print=20t))=0A+=20=20=20=20=20(kill-region=20begin=20= end)=0A+=20=20=20=20=20(condition-case-unless-debug=20err=0A+=20=20=20=20= =20=20=20=20=20(insert=20(json-encode=20(json-read-from-string=20= (current-kill=200))))=0A+=20=20=20=20=20=20=20(error=0A+=20=20=20=20=20=20= =20=20=20(insert=20(current-kill=200))=0A+=20=20=20=20=20=20=20=20=20= (error=20"Unable=20to=20parse=20JSON.")))))=0A+=20=0A=20=20(provide=20= 'json)=0A=20=20=0A=20=20;;;=20json.el=20ends=20here=0A= --Apple-Mail=_B93A5F8F-358D-43B5-ABD5-2FBB43A6C19B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Nov 14, 2012, at 8:56 PM, Stefan Monnier wrote: > Use a "json--" prefix, since it's a convention we use to express that > something is internal. Fixed. > The first line of a docstring should "stand on it own", i.e. it > shouldn't end in the middle of a sentence. > Try C-u M-x checkdoc-current-buffer. Ah, cool feature. Fixed. >=20 >> (defun json-encode-hash-table (hash-table) >> "Return a JSON representation of HASH-TABLE." >> - (format "{%s}" >> + (format (if json-encoding-pretty-print "{%s%s}" "{%s}") >=20 > Hmm... if json-encoding-pretty-print is nil, we still pass 2 args, and > the second is always "", so we can always use "{%s%s}", right? Not exactly, since json--encoding-current-indentation defaults to = newline. I've tweaked this part to shift the complexity down into the = second clause, however, instead of specifying 2 formats with a = potentially unused second argument. >> - (concat "[" (mapconcat 'json-encode array ", ") "]")) >> + (if (and json-encoding-pretty-print >> + (> (length array) 0)) >> + (concat >> + (let ((json-encoding-current-indentation >> + (concat json-encoding-current-indentation >> + json-encoding-default-indentation))) >=20 > Use json--with-indentation here (even if it performs an extra = redundant > test of json-encoding-pretty-print). Agreed, fixed. I've also added an error handling clause to fix a bug I noticed where if = you attempt to `json-pretty-print' some invalid JSON your text gets = killed but formatting fails and it doesn't get replaced. Is there a more = idiomatic way of doing this? I considered using copy-region-as-kill and = then only killing the text if the call to json-encode succeeds, but that = seemed more awkward. Thanks for your help! -Ryan= --Apple-Mail=_B93A5F8F-358D-43B5-ABD5-2FBB43A6C19B-- From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 20 13:53:40 2012 Received: (at 12634) by debbugs.gnu.org; 20 Nov 2012 18:53:40 +0000 Received: from localhost ([127.0.0.1]:57283 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tasx2-0000Pv-9B for submit@debbugs.gnu.org; Tue, 20 Nov 2012 13:53:40 -0500 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:49085) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Taswz-0000Pm-Us for 12634@debbugs.gnu.org; Tue, 20 Nov 2012 13:53:38 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id qAKIqMeZ014268; Tue, 20 Nov 2012 13:52:22 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 1E739B4278; Tue, 20 Nov 2012 13:52:22 -0500 (EST) From: Stefan Monnier To: Ryan Crum Subject: Re: bug#12634: Patch for pretty-printing in json.el Message-ID: References: <9E9C89A9-FACE-47A9-BCC7-3AC5ABC64518@gmail.com> Date: Tue, 20 Nov 2012 13:52:22 -0500 In-Reply-To: <9E9C89A9-FACE-47A9-BCC7-3AC5ABC64518@gmail.com> (Ryan Crum's message of "Sat, 17 Nov 2012 12:37:17 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4408=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4408> : streams <862316> : uri <1272939> X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.2 (-) > I actually have not yet received anything regarding copyright assignment in > the mail, so I resubmitted the questionnaire to assign@gnu.org today. Hmm... AFAIK nowadays, you should receive the paperwork by email (it used to be that it had to be printed by the FSF on their own paper, but last I heard they now just send a PDF which you can print yourself), so that should be fairly quick. > New patch attached. Looks fine, thank you. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 27 18:17:48 2012 Received: (at 12634) by debbugs.gnu.org; 27 Nov 2012 23:17:48 +0000 Received: from localhost ([127.0.0.1]:42319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TdUPT-0003xu-R9 for submit@debbugs.gnu.org; Tue, 27 Nov 2012 18:17:48 -0500 Received: from mail-ye0-f172.google.com ([209.85.213.172]:40789) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TdUPS-0003xm-68 for 12634@debbugs.gnu.org; Tue, 27 Nov 2012 18:17:47 -0500 Received: by mail-ye0-f172.google.com with SMTP id m14so1869381yen.3 for <12634@debbugs.gnu.org>; Tue, 27 Nov 2012 15:15:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=0kLBa+UjeYm3eJhNPPbHQDcROeE60sJlUYfnw6rJ//0=; b=PYm91SdLpUwYxMMymJLR6QzXzGxOdKQIGSOTSxYSPz9HuaJbeLvl4sBwO1qjXZxfDf mfjfRfdmSzL1SS36JUAlYCfwKK+9IYQ3TdsY5PPT05t+BWns7gtKdNebAzV1IQBNpVZa 5ULXpthbCl/9rPhFKm3ncajIaYKLQUzq1u3+1mZcnJbg6pnw6d0pFWzqavQlLx0vebfp apjciVTP3vO5njLff3nYZQaX9C64bO/xkpRSb8LkDQLrXxj/4E/JfvN7Wp8aQ7+wgMhx jWNTikaNBeOhqZ1nTcEbPSMTGLWMC7Z2vRB4FBf10du/gT0iR9Y4p6HJwsjXv8gLyfVA 4xBg== Received: by 10.101.133.15 with SMTP id k15mr4706927ann.64.1354058152713; Tue, 27 Nov 2012 15:15:52 -0800 (PST) Received: from [192.168.1.55] ([24.49.197.147]) by mx.google.com with ESMTPS id l17sm17950595ank.4.2012.11.27.15.15.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Nov 2012 15:15:51 -0800 (PST) Subject: Re: bug#12634: Patch for pretty-printing in json.el Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Ryan Crum In-Reply-To: Date: Tue, 27 Nov 2012 18:15:49 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9E9C89A9-FACE-47A9-BCC7-3AC5ABC64518@gmail.com> To: Stefan Monnier X-Mailer: Apple Mail (2.1278) X-Gm-Message-State: ALoCoQlntmqdmm7H9P7j9812LDociQkp4eFk8oJznKtpikio/nnr5QNddFnkrlDXAPAg0fl5X7P5 X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12634 Cc: 12634@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.1 (/) Thanks. FYI, I've sent the signed paperwork in. On Nov 20, 2012, at 1:52 PM, Stefan Monnier wrote: >> I actually have not yet received anything regarding copyright = assignment in >> the mail, so I resubmitted the questionnaire to assign@gnu.org today. >=20 > Hmm... AFAIK nowadays, you should receive the paperwork by email (it > used to be that it had to be printed by the FSF on their own paper, = but > last I heard they now just send a PDF which you can print yourself), = so > that should be fairly quick. >=20 >> New patch attached. >=20 > Looks fine, thank you. >=20 >=20 > Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 13 22:01:56 2012 Received: (at 12634) by debbugs.gnu.org; 14 Dec 2012 03:01:56 +0000 Received: from localhost ([127.0.0.1]:41597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TjLX8-0008S1-KU for submit@debbugs.gnu.org; Thu, 13 Dec 2012 22:01:55 -0500 Received: from mail-gg0-f172.google.com ([209.85.161.172]:61348) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TjLX4-0008Rr-Fh for 12634@debbugs.gnu.org; Thu, 13 Dec 2012 22:01:51 -0500 Received: by mail-gg0-f172.google.com with SMTP id r1so629660ggn.3 for <12634@debbugs.gnu.org>; Thu, 13 Dec 2012 19:00:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:content-type:subject:date:message-id:to:mime-version:x-mailer :x-gm-message-state; bh=w6GXgqXdQW+J/whzTPB8HCJ2VV30aW7aSVm8Wkf+cPw=; b=eoeyDapWTLwCOmboqPPdl0C7A32ga1fAcX4TbcCtQrO61HVL/rTitu6oMQ/akioMS5 IC0HHq904RFAt3q5gRTzVJDnSlC3rPRI9AzN96o/xMVjiIsB2vQ2eoCryR6VcwHFAS/w KMntyxIn+lJY02dpIhYYSpcPPZB+BKK51CaUBZjQc73CN8qGnIiyIF7YvJuExvt4agiD gp/PSFY2dEiABCFSKphN9Ys68HXaJ+op+dVobcyFifOX4JfjVIoZeZ1/JBIKJeil84Ye iU++yekjGT+jcxhdqEB+V4MC5qOQEmqM0YaKndmFCjafTwBXsQWIT6bomjNBInj2gF40 Huhw== Received: by 10.236.131.239 with SMTP id m75mr4407765yhi.2.1355454053356; Thu, 13 Dec 2012 19:00:53 -0800 (PST) Received: from [192.168.1.46] ([24.49.197.147]) by mx.google.com with ESMTPS id u49sm3397749yhd.18.2012.12.13.19.00.52 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 19:00:52 -0800 (PST) From: Ryan Crum Content-Type: multipart/mixed; boundary="Apple-Mail=_CDED852E-242B-40C4-B201-C5F03B1319FB" Subject: Patch Date: Thu, 13 Dec 2012 21:56:16 -0500 Message-Id: <9DBAAE5C-F22D-43BB-9CBE-79A2AECCD881@ryancrum.org> To: 12634@debbugs.gnu.org Mime-Version: 1.0 (Apple Message framework v1278) X-Mailer: Apple Mail (2.1278) X-Gm-Message-State: ALoCoQlbrysIlBubgcwni9AGqEzBY5UxiduJBjEFEbgepGJEbprTrOiAB9zP40+hHrAKvPfQ03NK X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 12634 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) --Apple-Mail=_CDED852E-242B-40C4-B201-C5F03B1319FB Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii The attached patch applied successfully for me against trunk at rev. 111221. --Apple-Mail=_CDED852E-242B-40C4-B201-C5F03B1319FB Content-Disposition: attachment; filename=json-pretty-print.diff Content-Type: application/octet-stream; name="json-pretty-print.diff" Content-Transfer-Encoding: quoted-printable ***=20a/json.el=0A---=20b/json.el=0A***************=0A***=203,9=20****=0A= =20=20;;=20Copyright=20(C)=202006-2012=20Free=20Software=20Foundation,=20= Inc.=0A=20=20=0A=20=20;;=20Author:=20Edward=20O'Connor=20= =0A!=20;;=20Version:=201.3=0A=20=20;;=20Keywords:=20= convenience=0A=20=20=0A=20=20;;=20This=20file=20is=20part=20of=20GNU=20= Emacs.=0A---=203,9=20----=0A=20=20;;=20Copyright=20(C)=202006-2012=20= Free=20Software=20Foundation,=20Inc.=0A=20=20=0A=20=20;;=20Author:=20= Edward=20O'Connor=20=0A!=20;;=20Version:=201.4=0A=20=20= ;;=20Keywords:=20convenience=0A=20=20=0A=20=20;;=20This=20file=20is=20= part=20of=20GNU=20Emacs.=0A***************=0A***=2048,53=20****=0A---=20= 48,54=20----=0A=20=20;;=202006-12-29=20-=20XEmacs=20support,=20from=20= Aidan=20Kehoe=20.=0A=20=20;;=202008-02-21=20-=20= Installed=20in=20GNU=20Emacs.=0A=20=20;;=202011-10-17=20-=20Patch=20= `json-alist-p'=20and=20`json-plist-p'=20to=20avoid=20recursion=20-tzz=0A= +=20;;=202012-10-25=20-=20Added=20pretty-printed=20reformatting=20-Ryan=20= Crum=20(ryan@ryancrum.org)=0A=20=20=0A=20=20;;;=20Code:=0A=20=20=0A= ***************=0A***=2099,104=20****=20If=20this=20has=20the=20same=20= value=20as=20`json-false',=20you=20might=20not=20be=20able=20to=0A---=20= 100,122=20----=0A=20=20tell=20the=20difference=20between=20`false'=20and=20= `null'.=20=20Consider=20let-binding=0A=20=20this=20around=20your=20call=20= to=20`json-read'=20instead=20of=20`setq'ing=20it.")=0A=20=20=0A+=20= (defvar=20json-encoding-separator=20","=0A+=20=20=20"Value=20to=20use=20= as=20an=20element=20seperator=20when=20encoding.")=0A+=20=0A+=20(defvar=20= json-encoding-default-indentation=20"=20=20"=0A+=20=20=20"The=20default=20= indentation=20level=20for=20encoding.=0A+=20Used=20only=20when=20= `json-encoding-pretty-print'=20is=20non-nil.")=0A+=20=0A+=20(defvar=20= json--encoding-current-indentation=20"\n"=0A+=20=20=20"Internally=20used=20= to=20keep=20track=20of=20the=20current=20indentation=20level=20of=20= encoding.=0A+=20Used=20only=20when=20`json-encoding-pretty-print'=20is=20= non-nil.")=0A+=20=0A+=20(defvar=20json-encoding-pretty-print=20nil=0A+=20= =20=20"If=20non-nil,=20then=20the=20output=20of=20`json-encode'=20will=20= be=20pretty-printed.")=0A+=20=0A+=20(defvar=20= json-encoding-lisp-style-closings=20nil=0A+=20=20=20"If=20non-nil,=20]=20= and=20}=20closings=20will=20be=20formatted=20lisp-style,=20without=20= indentation.")=0A+=20=0A=20=20=0C=0A=20=20=0A=20=20;;;=20Utilities=0A= ***************=0A***=20124,129=20****=20this=20around=20your=20call=20= to=20`json-read'=20instead=20of=20`setq'ing=20it.")=0A---=20142,155=20= ----=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= 'not-plist)))=0A=20=20=20=20(null=20list))=0A=20=20=0A+=20(defmacro=20= json--with-indentation=20(body)=0A+=20=20=20`(let=20= ((json--encoding-current-indentation=0A+=20=20=20=20=20=20=20=20=20=20=20= (if=20json-encoding-pretty-print=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(concat=20json--encoding-current-indentation=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= json-encoding-default-indentation)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20"")))=0A+=20=20=20=20=20=20,body))=0A+=20=0A=20=20;;=20Reader=20= utilities=0A=20=20=0A=20=20(defsubst=20json-advance=20(&optional=20n)=0A= ***************=0A***=20402,442=20****=20Please=20see=20the=20= documentation=20of=20`json-object-type'=20and=20`json-key-type'."=0A=20=20= =0A=20=20(defun=20json-encode-hash-table=20(hash-table)=0A=20=20=20=20= "Return=20a=20JSON=20representation=20of=20HASH-TABLE."=0A!=20=20=20= (format=20"{%s}"=0A=20=20=20=20=20=20=20=20=20=20=20=20(json-join=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20(let=20(r)=0A!=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(maphash=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (lambda=20(k=20v)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (push=20(format=20"%s:%s"=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(json-encode-key=20k)=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(json-encode=20v))=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20r))=0A!=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20hash-table)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20r)=0A!=20=20=20=20=20=20=20=20=20=20=20=20",=20")))=0A=20=20=0A=20=20= ;;=20List=20encoding=20(including=20alists=20and=20plists)=0A=20=20=0A=20= =20(defun=20json-encode-alist=20(alist)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20ALIST."=0A!=20=20=20(format=20"{%s}"=0A!=20=20=20=20= =20=20=20=20=20=20=20(json-join=20(mapcar=20(lambda=20(cons)=0A!=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(format=20"%s:%s"=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(json-encode-key=20(car=20cons))=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(json-encode=20(cdr=20cons))))=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20alist)=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20",=20")))=0A= =20=20=0A=20=20(defun=20json-encode-plist=20(plist)=0A=20=20=20=20= "Return=20a=20JSON=20representation=20of=20PLIST."=0A=20=20=20=20(let=20= (result)=0A!=20=20=20=20=20(while=20plist=0A!=20=20=20=20=20=20=20(push=20= (concat=20(json-encode-key=20(car=20plist))=0A!=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20":"=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(json-encode=20(cadr=20plist)))=0A!=20=20= =20=20=20=20=20=20=20=20=20=20=20result)=0A!=20=20=20=20=20=20=20(setq=20= plist=20(cddr=20plist)))=0A!=20=20=20=20=20(concat=20"{"=20(json-join=20= (nreverse=20result)=20",=20")=20"}")))=0A=20=20=0A=20=20(defun=20= json-encode-list=20(list)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20LIST.=0A---=20428,497=20----=0A=20=20=0A=20=20= (defun=20json-encode-hash-table=20(hash-table)=0A=20=20=20=20"Return=20a=20= JSON=20representation=20of=20HASH-TABLE."=0A!=20=20=20(format=20"{%s%s}"=0A= =20=20=20=20=20=20=20=20=20=20=20=20(json-join=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20(let=20(r)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (json--with-indentation=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (maphash=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(lambda=20(k=20= v)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(push=20= (format=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(if=20json-encoding-pretty-print=0A!=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"%s%s:=20%s"=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"%s%s:%s")=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20json--encoding-current-indentation=0A!=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (json-encode-key=20k)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(json-encode=20v))=0A!=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20r))=0A!=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20hash-table))=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20r)=0A!=20=20=20=20=20=20=20=20=20=20=20=20= json-encoding-separator)=0A!=20=20=20=20=20=20=20=20=20=20=20(if=20(or=20= (not=20json-encoding-pretty-print)=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20json-encoding-lisp-style-closings)=0A!=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20""=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= json--encoding-current-indentation)))=0A=20=20=0A=20=20;;=20List=20= encoding=20(including=20alists=20and=20plists)=0A=20=20=0A=20=20(defun=20= json-encode-alist=20(alist)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20ALIST."=0A!=20=20=20(format=20"{%s%s}"=0A!=20=20=20= =20=20=20=20=20=20=20=20(json-join=0A!=20=20=20=20=20=20=20=20=20=20=20=20= (json--with-indentation=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= (mapcar=20(lambda=20(cons)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(format=20(if=20json-encoding-pretty-print=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20"%s%s:=20%s"=0A!=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "%s%s:%s")=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20json--encoding-current-indentation=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(json-encode-key=20(car=20cons))=0A!=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (json-encode=20(cdr=20cons))))=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20alist))=0A!=20=20=20=20=20=20=20=20=20=20=20=20= json-encoding-separator)=0A!=20=20=20=20=20=20=20=20=20=20=20(if=20(or=20= (not=20json-encoding-pretty-print)=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20json-encoding-lisp-style-closings)=0A!=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20""=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= json--encoding-current-indentation)))=0A=20=20=0A=20=20(defun=20= json-encode-plist=20(plist)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20PLIST."=0A=20=20=20=20(let=20(result)=0A!=20=20=20=20= =20(json--with-indentation=0A!=20=20=20=20=20=20=20(while=20plist=0A!=20=20= =20=20=20=20=20=20=20(push=20(concat=0A!=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20json--encoding-current-indentation=0A!=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(json-encode-key=20(car=20plist))=0A!=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(if=20json-encoding-pretty-print=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20":=20"=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20":")=0A!=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(json-encode=20(cadr=20plist)))=0A!=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20result)=0A!=20=20=20=20=20=20=20=20= =20(setq=20plist=20(cddr=20plist))))=0A!=20=20=20=20=20(concat=20"{"=0A!=20= =20=20=20=20=20=20=20=20=20=20=20=20(json-join=20(nreverse=20result)=20= json-encoding-separator)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20= (and=20json-encoding-pretty-print=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(not=20json-encoding-lisp-style-closings))=0A= !=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= json--encoding-current-indentation=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"")=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20"}")))=0A=20=20=0A= =20=20(defun=20json-encode-list=20(list)=0A=20=20=20=20"Return=20a=20= JSON=20representation=20of=20LIST.=0A***************=0A***=20475,481=20= ****=20become=20JSON=20objects."=0A=20=20=0A=20=20(defun=20= json-encode-array=20(array)=0A=20=20=20=20"Return=20a=20JSON=20= representation=20of=20ARRAY."=0A!=20=20=20(concat=20"["=20(mapconcat=20= 'json-encode=20array=20",=20")=20"]"))=0A=20=20=0A=20=20=0C=0A=20=20=0A= ---=20530,551=20----=0A=20=20=0A=20=20(defun=20json-encode-array=20= (array)=0A=20=20=20=20"Return=20a=20JSON=20representation=20of=20ARRAY."=0A= !=20=20=20(if=20(and=20json-encoding-pretty-print=0A!=20=20=20=20=20=20=20= =20=20=20=20=20(>=20(length=20array)=200))=0A!=20=20=20=20=20=20=20= (concat=0A!=20=20=20=20=20=20=20=20(json--with-indentation=0A!=20=20=20=20= =20=20=20=20=20=20(concat=20(format=20"[%s"=20= json--encoding-current-indentation)=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(json-join=20(mapcar=20'json-encode=20array)=0A!=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(format=20"%s%s"=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= json-encoding-separator=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= json--encoding-current-indentation))))=0A!=20=20=20=20=20=20=20=20= (format=20"%s]"=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20= json-encoding-lisp-style-closings=0A!=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20""=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20json--encoding-current-indentation)))=0A!=20=20=20=20=20(concat=20= "["=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20(mapconcat=20'json-encode=20= array=20json-encoding-separator)=0A!=20=20=20=20=20=20=20=20=20=20=20=20=20= "]")))=0A=20=20=0A=20=20=0C=0A=20=20=0A***************=0A***=20542,547=20= ****=20Advances=20point=20just=20past=20JSON=20object."=0A---=20612,644=20= ----=0A=20=20=20=20=20=20=20=20=20=20((listp=20object)=20=20=20=20=20=20=20= =20(json-encode-list=20object))=0A=20=20=20=20=20=20=20=20=20=20(t=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(signal=20= 'json-error=20(list=20object)))))=0A=20=20=0A+=20;;=20Pretty=20printing=0A= +=20=0A+=20(defun=20json-pretty-print-buffer=20()=0A+=20=20=20= "Pretty-print=20current=20buffer."=0A+=20=20=20(interactive)=0A+=20=20=20= (let*=20((json-encoding-pretty-print=20t)=0A+=20=20=20=20=20=20=20=20=20=20= (json-string=20(json-encode=20(json-read-from-string=20= (buffer-string))))=0A+=20=20=20=20=20=20=20=20=20=20(buf=20= (current-buffer)))=0A+=20=20=20=20=20(with-current-buffer=20buf=0A+=20=20= =20=20=20=20=20(erase-buffer)=0A+=20=20=20=20=20=20=20(insert=20= json-string))))=0A+=20=0A+=20(defun=20json-pretty-print=20()=0A+=20=20=20= "Pretty-print=20selected=20region."=0A+=20=20=20(interactive)=0A+=20=20=20= (unless=20mark-active=0A+=20=20=20=20=20(error=20"No=20region=20= selected."))=0A+=20=20=20(let=20((begin=20(region-beginning))=0A+=20=20=20= =20=20=20=20=20=20(end=20(region-end))=0A+=20=20=20=20=20=20=20=20=20= (json-encoding-pretty-print=20t))=0A+=20=20=20=20=20(kill-region=20begin=20= end)=0A+=20=20=20=20=20(condition-case-unless-debug=20err=0A+=20=20=20=20= =20=20=20=20=20(insert=20(json-encode=20(json-read-from-string=20= (current-kill=200))))=0A+=20=20=20=20=20=20=20(error=0A+=20=20=20=20=20=20= =20=20=20(insert=20(current-kill=200))=0A+=20=20=20=20=20=20=20=20=20= (error=20"Unable=20to=20parse=20JSON.")))))=0A+=20=0A=20=20(provide=20= 'json)=0A=20=20=0A=20=20;;;=20json.el=20ends=20here=0A= --Apple-Mail=_CDED852E-242B-40C4-B201-C5F03B1319FB Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_CDED852E-242B-40C4-B201-C5F03B1319FB-- From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 14 10:00:11 2012 Received: (at 12634-done) by debbugs.gnu.org; 14 Dec 2012 15:00:11 +0000 Received: from localhost ([127.0.0.1]:42692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TjWkF-0004Zi-C2 for submit@debbugs.gnu.org; Fri, 14 Dec 2012 10:00:11 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:39421) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TjWkC-0004Za-O0 for 12634-done@debbugs.gnu.org; Fri, 14 Dec 2012 10:00:09 -0500 Received: from 216-123-190-91.dedicated.allstream.net ([216.123.190.91]:64615 helo=ceviche.home) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1TjWjF-0006Gu-Oh; Fri, 14 Dec 2012 09:59:10 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 356A1660E0; Fri, 14 Dec 2012 09:59:07 -0500 (EST) From: Stefan Monnier To: Ryan Crum Subject: Re: bug#12634: Patch Message-ID: References: <9DBAAE5C-F22D-43BB-9CBE-79A2AECCD881@ryancrum.org> Date: Fri, 14 Dec 2012 09:59:07 -0500 In-Reply-To: <9DBAAE5C-F22D-43BB-9CBE-79A2AECCD881@ryancrum.org> (Ryan Crum's message of "Thu, 13 Dec 2012 21:56:16 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 12634-done Cc: 12634-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.3 (----) > The attached patch applied successfully for me against trunk at rev. 111221. Thanks, installed, tho with the two commands rewritten (so as to not affect the kill-ring, and so as to follow the usual convention of receiving interactive args via the `interactive' spec, and so as to use atomic-change-group). Stefan From unknown Sat Aug 16 16:18:01 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 12 Jan 2013 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator