all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* pp.el: `pp-buffer' not pretty when `print-circle' non-nil
@ 2013-09-30 12:37 Klaus-Dieter Bauer
  0 siblings, 0 replies; only message in thread
From: Klaus-Dieter Bauer @ 2013-09-30 12:37 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 935 bytes --]

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 #1.2: Type: text/html, Size: 1536 bytes --]

[-- Attachment #2: 20130930-pp.el.patch --]
[-- Type: application/octet-stream, Size: 407 bytes --]

--- pp.el.orig	2013-09-30 12:17:41.290892200 +0200
+++ pp.el	2013-09-30 12:18:59.230454100 +0200
@@ -60,7 +60,7 @@
      ((ignore-errors (down-list 1) t)
       (save-excursion
         (backward-char 1)
-        (skip-chars-backward "'`#^")
+        (skip-chars-backward "'`#^=0123456789")
         (when (and (not (bobp)) (memq (char-before) '(?\s ?\t ?\n)))
           (delete-region
            (point)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-30 12:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 12:37 pp.el: `pp-buffer' not pretty when `print-circle' non-nil Klaus-Dieter Bauer

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.