Subject: bug#14764: 24.3.50; width control for pretty printing

From: Drew Adams <[email-masked]>
Date: Mon, 1 Jul 2013 15:01:03 -0700 (PDT)

Enhancement Emacs Lisp pretty printing to offer the equivalent of Common
Lisp's width-controlling features.  This would be useful for fixing bug
#14754, for instance.

>From Common Lisp the Language, 2nd Edition, section 27.2, Pretty
Printing Control Variables:

  [Variable]
  *print-right-margin*

  A primary goal of pretty printing is to keep the output between a pair
  of margins. The left margin is set at the column where the output
  begins. If this cannot be determined, the left margin is set to zero.

  When *print-right-margin* is not nil, it specifies the right margin to
  use when making layout decisions. When *print-right-margin* is nil
  (the initial value), the right margin is set at the maximum line
  length that can be displayed by the output stream without wraparound
  or truncation. If this cannot be determined, the right margin is set
  to an implementation-dependent value.

  To allow for the possibility of variable-width fonts,
  *print-right-margin* is in units of ems-the width of an ``m'' in the
  font being used to display characters on the relevant output stream at
  the moment when the variables are consulted.

  [Variable]
  *print-miser-width*

  If *print-miser-width* is not nil, the pretty printer switches to a
  compact style of output (called miser style) whenever the width
  available for printing a substructure is less than or equal to
  *print-miser-width* ems. The initial value of *print-miser-width* is
  implementation-dependent.

Note: "A PRIMARY GOAL OF PRETTY PRINTING is to keep the output between a
pair of margins."  That's the point of this enhancement request.

Once pretty printing has this control, please incorporate it into common
commands, such as `C-M-q', via a prefix arg for example.

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-06-27 on ODIEONE
Bzr revision: 113205 [email-masked]
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 CFLAGS=-O0 -g3 LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'