From xemacs-m  Thu Mar 13 13:30:07 1997
Received: from crystal.WonderWorks.COM (crystal.WonderWorks.com [192.203.206.1])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id NAA04393
	for <xemacs-beta@xemacs.org>; Thu, 13 Mar 1997 13:30:03 -0600 (CST)
Received: by crystal.WonderWorks.COM 
	id QQcgsr13889; Thu, 13 Mar 1997 14:21:13 -0500 (EST)
Date: Thu, 13 Mar 1997 14:21:13 -0500 (EST)
Message-Id: <QQcgsr13889.199703131921@crystal.WonderWorks.COM>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Kyle Jones <kyle_jones@wonderworks.com>
To: xemacs-beta@xemacs.org
Subject: Principle of Least Surprise and fill-paragraph-or-region
In-Reply-To: <199703131742.MAA25202@black-ice.cc.vt.edu>
References: <199703131742.MAA25202@black-ice.cc.vt.edu>
X-Face: /cA45WHG7jWq>(O3&Z57Y<"WsX5ddc,4c#w0F*zrV#=M
        0@~@,s;b,aMtR5Sqs"+nU.z^CSFQ9t`z2>W,S,]:[+2^
        Nbf6v4g>!&,7R4Ot4Wg{&tm=WX7P["9%a)_da48-^tGy
        ,qz]Z,Zz\{E.,]'EO+F)@$KtF&V

Valdis.Kletnieks@vt.edu writes:
 > Another minor nit ;)
 > 
 > fill-paragraph-or-region appears to be just a tad wonky when trying to
 > do full    justification.   Using 'M-1  M-q'  repeatedly   to format a
 > paragraph in my previous  mail will toggle between  2 states of "where
 > to put the extra blanks".  Now, that was  not particularly a surprise,
 > but what DID surprise  me is that  for  any given cursor  position, it
 > would  be  two *different* states, depending   on exactly where in the
 > paragraph the text cursor was located.

I saw many more than two states and the cursor position made no
difference.  Here's the code I used to watch the activity.

(progn
  (switch-to-buffer "*jiggling text*")
  (erase-buffer)
  (setq fill-column 70)
  (filladapt-mode -1)
  (insert "
Now for  the *real* weirdness: I *cant*   enter a \"cntrol-X control-S\"
from the keyboard, because it's not listening.  However, I *can* go up
to the menubar, select \"save\" (which alledgedly does the same thing as
^X^S), and  *IT WILL ALL START  WORKING AGAIN*.  I haven't checked yet
if selecting  OTHER things off  the menubar fix  it as well.  Any text
that was typed while  the  keyboard was  hung  appears to be  silently
discarded.
")
  (goto-char 2)
  (while t
    (fill-paragraph-or-region '(4))
    (sit-for 0)))
  
The paragraph came alive with motion.  It was really quite
revolting to watch, like those time-lapse movies of plant
heliotropism.  Some things are just not meant to move with
such vigor. :-P

This probably comes from the input not being normalized before
filling which leads to feedback and choatic behavior.  Any
math people out there want to figure out where filling with
justification becomes unstable and starts exhibiting chaos,
before we fix it?  :)

