GNU bug report logs - #13115
prettier pretty-printing for eieio

Previous Next

Package: emacs;

Reported by: Jonas Bernoulli <jonas <at> bernoul.li>

Date: Fri, 7 Dec 2012 16:56:01 UTC

Severity: wishlist

Tags: patch

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: bug-gnu-emacs <at> gnu.org
Subject: prettier pretty-printing for eieio
Date: Fri, 07 Dec 2012 17:54:51 +0100
[Message part 1 (text/plain, inline)]
Hello

The attached patch implements prettier pretty-printing in eieio.

* don't quote keywords and booleans
* don't insert needless newlines (empty lines, and before closing
  parents)
* align values that are objects with the slot keyword instead of putting
  it's beginning on the same line as the slot keyword.
* similar for lists of objects

Prettier pp:

,----
| (eieio-pp-demo "top"
|   :keyword :keyword
|   :boolean nil
|   :object
|   (eieio-pp-demo "subsub"
|     :list '(a b c))
|   :list '(a b c)
|   :object-list
|   (list
|     (eieio-pp-demo "sub"
|       :keyword :keyword
|       :object
|       (eieio-pp-demo "subsub"
|         :list '(a b c))
|       :list '(a b c))
|     'non-object
|     (eieio-pp-demo "sub"
|       :keyword :keyword
|       :object
|       (eieio-pp-demo "subsub"
|         :list '(a b c))
|       :list '(a b c))))
`----

Not so pretty pp:

,----
| (eieio-pp-demo "top"
|   :keyword ':keyword
|   :boolean 'nil
|   :object   (eieio-pp-demo "subsub"
|     :list '(a b c)
|     )
| 
|   :list '(a b c)
|   :object-list (list 
|    (eieio-pp-demo "sub"
|     :keyword ':keyword
|     :object     (eieio-pp-demo "subsub"
|       :list '(a b c)
|       )
| 
|     :list '(a b c)
|     )
|  'non-object   (eieio-pp-demo "sub"
|     :keyword ':keyword
|     :object     (eieio-pp-demo "subsub"
|       :list '(a b c)
|       )
| 
|     :list '(a b c)
|     )
|    )
|   )
`----

The demo code is also attached.

I have used this code to save the metadata extracted from all packages
on the Emacsmirror without any problems for several months now.

  Please consider merging this, thanks
  Jonas

[prettier-eieio-pp.patch (text/x-diff, attachment)]
[eieio-pp-demo.el (application/emacs-lisp, attachment)]

This bug report was last modified 12 years and 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.