emacs-devel
[Top][All Lists]
Advanced

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

pp.el: `pp-buffer' not pretty when `print-circle' non-nil


From: Klaus-Dieter Bauer
Subject: pp.el: `pp-buffer' not pretty when `print-circle' non-nil
Date: Mon, 30 Sep 2013 14:37:33 +0200

Hello!

When working on a double-linked list data structure I noticed that in the current implementation `pp-buffer' and therefore `pp-to-string' and `pp' produce not-so-pretty output:

;; -----
[mu-queue 3 #1=[mu-queue--node 1 nil #2=[mu-queue--node 2 #1# #3=[mu-queue--node 3 #2# nil]]]
    #3#]
;; -----

Applying the attached patch would result in the form: 

;; -----
[mu-queue 3
    #1=[mu-queue--node 1 nil
  #2=[mu-queue--node 2 #1#
 #3=[mu-queue--node 3 #2# nil]]]
    #3#]
;; -----

which corresponds better to the behaviour withouut `print-circle'. Since there should be whitespace before the #1=(...) forms, the change also should not break existing behaviour. 

kind regards, Klaus-Dieter Bauer


PS: Without `print-circle' the data structure reads

[mu-queue 3
 [mu-queue--node 1 nil
  [mu-queue--node 2 #1
   [mu-queue--node 3 #2 nil]]]
 [mu-queue--node 3
  [mu-queue--node 2
   [mu-queue--node 1 nil #2]
   #1]
  nil]]

Attachment: 20130930-pp.el.patch
Description: Binary data


reply via email to

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