bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12634: Patch for pretty-printing in json.el


From: Stefan Monnier
Subject: bug#12634: Patch for pretty-printing in json.el
Date: Tue, 30 Oct 2012 16:03:11 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

> 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 via email to

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