Subject: bug#5438: 23.0.94; auto-fill-mode behaves strangely with periods near end of line

From: Elnatan Reisner <[email-masked]>
Date: Thu, 21 Jan 2010 16:05:07 -0500

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked]  
mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I opened a new file and typed the following (which I copied from  
further down in this bug report):
^U 3 0 A SPC ^U 3
0 A SPC ^U 8 A SPC ^U 3 0 A SPC <escape> X A U T O
F - <backspace> <backspace> - F I <tab> <return> ^U
3 0 A SPC ^U 9 A SPC <escape> Q <right> <return> <return>
^U 3 0 A SPC ^U 3 0 A SPC ^U 7 A . SPC <escape> Q <return>
^/ SPC ^/ <return> <return> ^U 3 0 A SPC ^U 3 0 A SPC
^U 3 A . SPC A A A A SPC <escape> Q ^A <backspace>
SPC <right> <right> <right> <right> <return> <escape>
Q ^E <return> <return> ^U 3 0 A SPC ^U 3 0 A SPC A
A . SPC A A . SPC F I E J A SPC <escape> Q <escape>
X R E P O T <tab> <backspace> R T - E <tab> <return>

I am confused by how auto-fill deals with periods near the end of the  
line. It seems that the determination of where to wrap is based not  
only on spaces, but also on periods. That is, auto-fill seems to  
search for the final space before the last column, but if that space  
is preceded by a period, it looks back for the preceding space, and so  
on. I notice this most regularly when a period happens to occur in  
column 70 (which is the default width for auto-fill-mode), so the last  
word of my sentence gets wrapped to the next line, even though I don't  
want it to. However, if I manually replace the word on the previous  
line, later invocations of Esc-Q do not re-wrap such words, but rather  
leave them in place. (I am grateful for this, because this is behavior  
I would want to begin with; but the inconsistency seems odd.)

I have seen this behavior in this Aquamacs (the specs are below), in  
Aquamacs 1.9 (GNU Emacs 22.3.1 (powerpc-apple-darwin9.8.0, Carbon  
Version 1.6.0)), and GNU Emacs 21.3.1 on a Linux computer.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
     `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Applications/Aquamacs.app/Contents/Resources/etc/DEBUG for  
instructions.

In GNU Emacs 23.0.94.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
  of 2009-10-26 on braeburn.aquamacs.org - Aquamacs Distribution  
2.0preview3
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--with-ns' '--without-x' 'CFLAGS=-arch  
i386 -arch ppc' 'LDFLAGS=-arch i386 -arch ppc''

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: nil
   value of $XMODIFIERS: nil
   locale-coding-system: nil
   default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
   savehist-mode: t
   smart-frame-positioning-mode: t
   aquamacs-autoface-mode: t
   recentf-mode: t
   osx-key-mode: t
   tabbar-mwheel-mode: t
   tabbar-mode: t
   show-paren-mode: t
   delete-selection-mode: t
   pc-selection-mode: t
   cua-mode: t
   tooltip-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   global-auto-composition-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
5 A ^A ^K ^U 9 A SPC ^U 9 A SPC ^A ^K ^U 3 0 A SPC
^U 3 0 A SPC A B C D E F G H I SPC <return> <down-mouse-1>
<mouse-1> ^X K <return> Y ^X K <return> Y ^/ ⌘W ⌘{
⌘W ^X ^F B L A H . T X T <backspace> <backspace> <backspace>
<backspace> ^G ^X ^F B L A H <return> ^U 3 0 A SPC
^U 3 0 A SPC A B C D E F G H I <escape> X A U T O -
F I <tab> <return> <return> ^U 3 0 A SPC ^U 3 0 A SPC
A B C D E F G . SPC <return> <escape> Q <left> <escape>
Q ^/ <up> <up> <return> <down> <down> <down> <up> <escape>
Q ^E ^X ^F A S D F . T X T <backspace> <backspace>
<backspace> <backspace> <return> ^U 3 0 A SPC ^U 3
0 A SPC ^U 8 A SPC ^U 3 0 A SPC <escape> X A U T O
F - <backspace> <backspace> - F I <tab> <return> ^U
3 0 A SPC ^U 9 A SPC <escape> Q <right> <return> <return>
^U 3 0 A SPC ^U 3 0 A SPC ^U 7 A . SPC <escape> Q <return>
^/ SPC ^/ <return> <return> ^U 3 0 A SPC ^U 3 0 A SPC
^U 3 A . SPC A A A A SPC <escape> Q ^A <backspace>
SPC <right> <right> <right> <right> <return> <escape>
Q ^E <return> <return> ^U 3 0 A SPC ^U 3 0 A SPC A
A . SPC A A . SPC F I E J A SPC <escape> Q <escape>
X R E P O T <tab> <backspace> R T - E <tab> <retur
n>

Recent messages:
Auto-saving...done
fill-prefix cancelled
Buffer *mail to [email-masked]* modified; kill anyway? (y  
or n)
Undo!
Quit
(New file)
Undo!
(New file)
call-interactively: End of buffer
Undo! [2 times]

Load-path shadows:
None found.

Features:
(shadow mail-extr message ecomplete rfc822 mml mml-sec password-cache
mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045
qp ietf-drums mailabbrev nnheader gnus-util netrc mm-util mail-prsvr
gmm-utils mailheader canlock sha1 hex-util hashcash mail-utils emacsbug
load-emacs-plugins aquamacs-mode-defaults auctex-config server tex-site
smart-dnd aquamacs-aux savehist mouse-sel one-buffer-one-frame
smart-frame-positioning drews_init color-theme-autoloads saveplace
visual-line aquamacs-bug aquamacs-autoface-mode aquamacs-editing
sendmail recentf tree-widget cus-edit osxkeys emulate-mac-keyboard-mode
frame-cmds strings misc-fns thingatpt+ thingatpt frame-fns avoid
aquamacs-mac-fontsets fit-frame aquamacs-frame-setup aquamacs-tabbar
tabbar-window cl cl-19 tabbar easy-mmode cus-start cus-load
load-emacs-pre-plugins aquamacs-site-start cocoa-compatibility filladapt
aquamacs-redo check-for-updates aquamacs-menu osx_defaults
aquamacs-tool-bar aquamacs mac-extra-functions aquamacs-tools
aquamacs-macros parse-time timezone time-date paren delsel pc-select
cua-base wid-edit regexp-opt advice advice-preload byte-opt bytecomp
byte-compile debug help-fns help-mode view image-file disp-table tooltip
ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face text-properties overlay md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process ns
multi-tty emacs)