all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Klaus-Dieter Bauer <bauer.klaus.dieter@gmail.com>
To: emacs-devel@gnu.org
Subject: pp.el: `pp-buffer' not pretty when `print-circle' non-nil
Date: Mon, 30 Sep 2013 14:37:33 +0200	[thread overview]
Message-ID: <CANtbJLFA4iXhsTo-62eqcyETKPAKXA7J3vYSeK_sBYCDyp8CJw@mail.gmail.com> (raw)


[-- 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)

                 reply	other threads:[~2013-09-30 12:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=CANtbJLFA4iXhsTo-62eqcyETKPAKXA7J3vYSeK_sBYCDyp8CJw@mail.gmail.com \
    --to=bauer.klaus.dieter@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.