GNU logs - #7413, boring messages

Message sent to owner <at>, bug-gnu-emacs@HIDDEN:

X-Loop: help-debbugs@HIDDEN
Subject: bug#7413: Suggestion for adaptive-fill
Resent-From: Simon Tatham <anakin@HIDDEN>
Original-Sender: debbugs-submit-bounces <at>
Resent-To: owner <at>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Tue, 16 Nov 2010 10:18:02 +0000
Resent-Message-ID: <handler.7413.B.12899026354667 <at>>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 7413
X-GNU-PR-Package: emacs
To: 7413 <at>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> id=B.12899026354667
          (code B ref -1); Tue, 16 Nov 2010 10:18:02 +0000
Received: (at submit) by; 16 Nov 2010 10:17:15 +0000
Received: from localhost ([]
	by with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at>>)
	id 1PIIbA-0001DE-01
	for submit <at>; Tue, 16 Nov 2010 05:17:15 -0500
Received: from ([])
	by with esmtp (Exim 4.69)
	(envelope-from <simon@HIDDEN>) id 1PIIaE-0001CQ-9m
	for submit <at>; Tue, 16 Nov 2010 05:16:15 -0500
Received: from Debian-exim by with spam-scanned (Exim 4.71)
	(envelope-from <simon@HIDDEN>) id 1PIIf2-0006dB-Hd
	for submit <at>; Tue, 16 Nov 2010 05:21:13 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED,
	T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1
Received: from ([]:44943)
	by with esmtp (Exim 4.71)
	(envelope-from <simon@HIDDEN>) id 1PIIf2-0006d6-Fa
	for submit <at>; Tue, 16 Nov 2010 05:21:12 -0500
Received: from [] (port=39116
	by with esmtp (Exim 4.43) id 1PIIf0-0001V8-RK
	for bug-gnu-emacs@HIDDEN; Tue, 16 Nov 2010 05:21:12 -0500
Received: from Debian-exim by with spam-scanned (Exim 4.71)
	(envelope-from <simon@HIDDEN>) id 1PIIez-0006cF-7a
	for bug-gnu-emacs@HIDDEN; Tue, 16 Nov 2010 05:21:10 -0500
Received: from ([]:55053)
	by with esmtp (Exim 4.71)
	(envelope-from <simon@HIDDEN>) id 1PIIez-0006Z2-0u
	for bug-gnu-emacs@HIDDEN; Tue, 16 Nov 2010 05:21:09 -0500
Received: from simon by with local (Exim 4.69)
	(envelope-from <simon@HIDDEN>)
	id 1PIIes-0000Un-9N; Tue, 16 Nov 2010 10:21:02 +0000
X-Mailer: Jed/Timber v0.2
From: Simon Tatham <anakin@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Message-Id: <E1PIIes-0000Un-9N@HIDDEN>
Date: Tue, 16 Nov 2010 10:21:02 +0000
X-detected-operating-system: by Genre and OS details not
X-detected-operating-system: by GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -6.6 (------)
X-Mailman-Approved-At: Tue, 16 Nov 2010 05:17:11 -0500
X-BeenThere: debbugs-submit <at>
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <>
List-Unsubscribe: <>,
	<mailto:debbugs-submit-request <at>>
List-Archive: <>
List-Post: <mailto:debbugs-submit <at>>
List-Help: <mailto:debbugs-submit-request <at>>
List-Subscribe: <>,
	<mailto:debbugs-submit-request <at>>
Sender: debbugs-submit-bounces <at>
Errors-To: debbugs-submit-bounces <at>
X-Spam-Score: -6.6 (------)

I'd like to suggest a small extra piece of configurability for
Emacs's adaptive fill functionality.

Adaptive fill mode is capable of filling a paragraph in a source
code file which has comment characters down the left, and replacing
them after filling:

   # This is a
   # comment.

And it can also fill a paragraph which uses '-' as a bullet
character, and automatically line up subsequent lines below the
character after the bullet rather than below the bullet:

   - Like

But one thing it won't currently _quite_ cope with is both at once:

   #  - This is a bulleted paragraph
   #    in a source comment.

If the paragraph already has more than one line, even this will
work, because the fill-context-prefix function in fill.el observes
that the second line's prefix is derived from the first by replacing
some characters with spaces, and therefore decides it's a sensible
prefix to keep using. But if the paragraph is only one line long and
needs to be broken on to multiple lines, then fill-context-prefix
cannot infer from "   #  - " that the second line's prefix should be
"   #    ", because currently its only options for handling a
one-line prefix are to use the prefix unmodified or replace the
_whole_ thing with spaces.

So my suggestion is that it would be useful to have a user-definable
function hook checked for the one-line case, perhaps called
'adaptive-fill-infer-prefix-function' or some such, which is given
the fill prefix for a one-line paragraph and returns the appropriate
prefix to use when breaking it on to a second line and beyond.

Secondarily, I suggest that a default implementation of that
function might want to consider the case where the start of the
prefix matches comment-start-skip and the remainder matches
first-line-regexp, and in that situation replace only the latter
part with spaces.

I've currently implemented similar functionality in my .emacs by
applying `defadvice' to the fill-context-prefix function, but my
feeling is that if I have to use defadvice on an internal emacs
function then it's worth at least suggesting a change so I don't
have to in future :-)

(I'll send you my defadvice-based code if you like, but it's more a
hack than a finished patch at the moment.)

Simon Tatham         "infinite loop _see_ loop, infinite"
<anakin@HIDDEN>     - Index, Borland Pascal Language Guide

Message sent:

Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Simon Tatham <anakin@HIDDEN>
Subject: bug#7413: Acknowledgement (Suggestion for adaptive-fill)
Message-ID: <handler.7413.B.12899026354667.ack <at>>
References: <E1PIIes-0000Un-9N@HIDDEN>
X-Gnu-PR-Message: ack 7413
X-Gnu-PR-Package: emacs
Reply-To: 7413 <at>
Date: Tue, 16 Nov 2010 10:18:02 +0000

Thank you for filing a new bug report with GNU.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):

If you wish to submit further information on this problem, please
send it to 7413 <at>

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems

Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.