unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: floyd@apaflo.com (Floyd L. Davidson)
Subject: Re: Looking for (fill-paragraph) Like Functions
Date: Wed, 29 Nov 2006 07:19:13 -0900	[thread overview]
Message-ID: <877ixe6xa6.fld@apaflo.com> (raw)
In-Reply-To: 87d576msui.fsf@localhost.localdomain

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)
>
>I would like my M-q to work for any "bulleted" list like this

Between marking the "bullet" pattern, the indent, and the end of
the item, there are so many varieties of bulleted lists that a
simple generic function cannot suffice.  Instead one would need
to either restrict it to certain constructs or provide an
extensive pre-configuration list.  Which probably means it just
isn't practical to use such a function.  For example, if you
make an error or otherwise decide to change the configuration,
editing the results will be far more painful than not.

Likewise there are a few tricks one can learn that make doing it
manually an easy enough task.  One is to enable "text-mode" and
(if it is not by default) set adaptive-fill-mode to true.

To reformat your list above, items 1) and 2) need only a proper
indent, and 3) is the interesting one.  So I'll describe doing
that one step by step (assuming that basic commands, like
navigation and how to insert blank lines, are second nature and
need not be mentioned).

First separate that line from the line above and below it:

    2) this is another sentence in a list

    3) this is a sentence is long i would like to hit M-q ...

    4) this is another line M-q here would be good if it ...

Now, work on item 3 alone.  Start by reformatting it, and it
will look like this (in this case the fill column is 55):

    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

Then separate the top line for the other lines:

    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

Now indent the second line to the appropriate column:

    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

Now use M-q to reformat the second and third lines:

    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

And obviously at that point simply deleting the excess blank
lines provides the desired result.

-- 
Floyd L. Davidson            <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         floyd@apaflo.com

  parent reply	other threads:[~2006-11-29 16:19 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
     [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 [this message]
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=877ixe6xa6.fld@apaflo.com \
    --to=floyd@apaflo.com \
    /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).