From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: floyd@apaflo.com (Floyd L. Davidson) Newsgroups: gmane.emacs.help Subject: Re: Looking for (fill-paragraph) Like Functions Date: Wed, 29 Nov 2006 07:19:13 -0900 Organization: __________ Message-ID: <877ixe6xa6.fld@apaflo.com> References: <87d576msui.fsf@localhost.localdomain> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164818573 17667 80.91.229.2 (29 Nov 2006 16:42:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 29 Nov 2006 16:42:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 29 17:42:44 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GpSUO-0002Ul-Is for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Nov 2006 17:40:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GpSUO-0005da-4N for geh-help-gnu-emacs@m.gmane.org; Wed, 29 Nov 2006 11:40:52 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!sn-xt-sjc-02!sn-xt-sjc-01!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: gnus 5.10.6/XEmacs 21.4.15/Linux 2.6.17-11 Cancel-Lock: sha1:eEHufptaRdM6BnEYAJN0zlGVs50= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 76 Original-Xref: shelby.stanford.edu gnu.emacs.help:143497 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:39098 Archived-At: Passer By 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 Ukpeagvik (Barrow, Alaska) floyd@apaflo.com