GNU bug report logs -
#7413
Suggestion for adaptive-fill
Previous Next
To reply to this bug, email your comments to 7413 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#7413
; Package
emacs
.
(Tue, 16 Nov 2010 10:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Simon Tatham <anakin <at> pobox.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 16 Nov 2010 10:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
this.
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.)
Cheers,
Simon
--
Simon Tatham "infinite loop _see_ loop, infinite"
<anakin <at> pobox.com> - Index, Borland Pascal Language Guide
This bug report was last modified 14 years and 212 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.