From: Perry Smith <pedz@easesoftware.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Looking for (fill-paragraph) Like Functions
Date: Wed, 29 Nov 2006 09:00:00 -0600 [thread overview]
Message-ID: <FF196C15-1070-4D5A-ACCA-E25DCD72FE91@easesoftware.com> (raw)
In-Reply-To: <20061129163507.0ebf519d@litshi.luna.local>
On Nov 29, 2006, at 8:35 AM, Micha Feigin wrote:
> On Wed, 29 Nov 2006 10:48:23 GMT
> Passer By <sender@sender.send> wrote:
>
>>
>>
>>
>> My first learned function and loved function of emacs was the M-q but
>> there are cases where M-q doesn't do exactly what i want and i would
>> like to make an improved version or find one somewhere.
>>
>>
>> Here is an example of what i would want my improved (fill-paragraph)
>> to do.
>>
>>
>> 1) this is a sentence
>> 2) this is another sentence in a list
>> 3) this is a sentence is long i would like to hit M-q now but
>> emacs will not
>> just rap this line it will rap all the lines and that makes me mad
>> 4) this is
>> another line M-q here would be good if it would make all the lines
>> nice up to
>> 1)
>>
>
> The problem is with how do you recognize the end of a paragraph?
> You can't use
> the end of line symbol as that is the same symbol that is used to
> break a line
> in the middle of the paragraph and there is no end of paragraph
> symbol for text
> files (AFAIK, maybe unicode has something).
>
> The solution is to use the latex syntax and break lines with enter and
> paragraph with an empty line. I think that that will solve your
> problem. i.e:
>
> This is paragraph one
> second line of paragraph one
>
> This is paragraph two.
I think it is "do-able" but I don't want to volunteer to do it. From
my perspective, the
first task is to recognize that you are doing a list. The pattern
would be something flexible
broken into pieces (which you can do with regex). Starting with ^ as
the anchor of
the beginning of the line, the pattern to notice a list would be
something like (I'll just
use english to describe it)
<pattern to span white space>
<pattern to span numbering system> (which would match 1, 2, 3 or a,
b, c. Maybe even i, ii, iii, iv,...)
<pattern to span ')' and other things that may be used at that point>
After having found the first of these, the start of the next time
would match the same pattern
but with the second item twiddled to be the next in the sequence.
Again, all of this is "do-able" but
rather tedious.
To continue, this match would mark the start of the next item -- and
the end of the previous item.
Then narrow the region to be just the previous item, do a fill
paragraph, restore to the original region,
and continue.
So, done correctly, it could actually cope with indented lists inside
of lists.
BUT... my guess is it would take me several days to come up with all
this. I would guess it would take
you at least that long. And, as this reply points out, most people
just put a blank line between items and
just avoid the problem.
Perry Smith ( pedz@easesoftware.com )
Ease Software, Inc. ( http://www.easesoftware.com )
Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems
next prev parent reply other threads:[~2006-11-29 15:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-29 10:48 Looking for (fill-paragraph) Like Functions Passer By
2006-11-29 11:05 ` Mathias Dahl
2006-11-29 14:35 ` Micha Feigin
2006-11-29 15:00 ` Perry Smith [this message]
[not found] ` <mailman.1286.1164812410.2155.help-gnu-emacs@gnu.org>
2006-12-01 10:29 ` Passer By
2006-11-29 16:19 ` Floyd L. Davidson
2006-11-29 16:54 ` Markus Triska
2006-11-29 23:01 ` Floyd L. Davidson
2006-11-29 23:19 ` Markus Triska
2006-11-30 7:29 ` Floyd L. Davidson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FF196C15-1070-4D5A-ACCA-E25DCD72FE91@easesoftware.com \
--to=pedz@easesoftware.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).