[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
understanding fill-region, paragraph-separate, and paragraph-start
From: |
Eric Abrahamsen |
Subject: |
understanding fill-region, paragraph-separate, and paragraph-start |
Date: |
Tue, 11 Dec 2018 13:47:01 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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!
Eric