all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Ryan Crum <ryan.j.crum@gmail.com>
Cc: 12634@debbugs.gnu.org
Subject: bug#12634: Patch for pretty-printing in json.el
Date: Tue, 30 Oct 2012 16:03:11 -0400	[thread overview]
Message-ID: <jwvd302p1cz.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAMiu-qBKbohFN0KALZMUERxMD2ROr651gG8FSj2u=NSR=TC-PQ@mail.gmail.com> (Ryan Crum's message of "Sat, 27 Oct 2012 15:31:46 -0400")

> 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





  reply	other threads:[~2012-10-30 20:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13  8:39 bug#12634: 24.2; [FEATURE REQUEST] JSON pretty printer Leo
2012-10-13 21:56 ` Stefan Monnier
2012-10-18 21:18 ` bug#12634: existing implementation Aurélien Aptel
2012-10-19  1:37   ` Stefan Monnier
2012-10-19 16:20     ` Aurélien Aptel
2012-10-19 18:04       ` Stefan Monnier
2012-10-19 21:28         ` Stefan Monnier
2012-10-25 14:55 ` bug#12634: Patch for pretty-printing in json.el Ryan Crum
2012-10-25 18:08   ` Stefan Monnier
2012-10-27 19:31     ` Ryan Crum
2012-10-30 20:03       ` Stefan Monnier [this message]
2012-10-30 21:04         ` Ryan Crum
2012-11-15  1:56           ` Stefan Monnier
2012-11-17 17:37             ` Ryan Crum
2012-11-20 18:52               ` Stefan Monnier
2012-11-27 23:15                 ` Ryan Crum
2012-12-14  2:56 ` bug#12634: Patch Ryan Crum
2012-12-14 14:59   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvd302p1cz.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=12634@debbugs.gnu.org \
    --cc=ryan.j.crum@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.