help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: understanding fill-region, paragraph-separate, and paragraph-start


From: Eric Abrahamsen
Subject: Re: understanding fill-region, paragraph-separate, and paragraph-start
Date: Tue, 11 Dec 2018 16:15:41 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stephen Berman <stephen.berman@gmx.net> writes:

> On Tue, 11 Dec 2018 13:47:01 -0800 Eric Abrahamsen <eric@ericabrahamsen.net> 
> wrote:
>
>> In EBDB I've been using a manual function to correctly format record
>> fields. Briefly, the output looks just like BBDB:
>>
>> John Doe
>>    mail: email1@address.com, email2@address.com, email3@address.com
>>   notes: This is John Doe, a guy I met in blah blah blah blah blah
>>
>> In narrow windows, I want the above two lines to fill/wrap like so:
>>
>> John Doe
>>    mail: email1@address.com, email2@address.com,
>>          email3@address.com
>>   notes: This is John Doe, a guy I met in blah blah
>>          blah blah blah
>>
>> So each line has an overhanging label, and subsequent lines are filled
>> to the beginning of the text on the first line.
>>
>> Right now this is done "manually" with a function that just goes in and
>> sticks in spaces.
>>
>> In the interest of Doing the Right Thing (and learning how filling
>> works), I'm trying to accomplish the same thing by setting the correct
>> values of `fill-column', `paragraph-separate', and `paragraph-start',
>> and then calling `fill-region' on all the lines at once.
>>
>> I haven't been able to get this right. I think the regexp I want is
>> "[^:]+: ", meaning a paragraph starts with some stuff that's not a
>> colon, then a colon and a space. But if I use that as the value of
>> `paragraph-start', nothing happens (the lines still look like example
>> one above), if I use it as the value of `paragraph-separate' the region
>> is turned into a single line (but wrapped to `fill-column'), and if I
>> use it as the value of both the region is turned into a single long line
>> that isn't filled.
>>
>> I'll worry about the underhang later -- how is this meant to work? I
>> also thought `paragraph-separate' might be a "\n", but that goes back to
>> doing nothing.
>>
>> And hints much appreciated!
>
> I can't help with paragraph-separate, fill-region etc., but FWIW you can
> get the visual effect of the above by using a combination of
> visual-line-mode and wrap-prefix.

That's an interesting idea, thanks. This is a read-only special-mode
buffer, but maybe that doesn't preclude the use of visual-line-mode.
I'll take a look!

Thanks,
Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]