From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Iain Dalton Newsgroups: gmane.emacs.help Subject: Re: Customising fill-paragrah Date: Fri, 13 Feb 2009 19:32:41 -0700 Message-ID: References: <0012f3e9-3378-4714-9c82-14d2a7e3837f@z27g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1234578798 7361 80.91.229.12 (14 Feb 2009 02:33:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Feb 2009 02:33:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 14 03:34:34 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LYAMQ-0000TO-8K for geh-help-gnu-emacs@m.gmane.org; Sat, 14 Feb 2009 03:34:30 +0100 Original-Received: from localhost ([127.0.0.1]:45724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LYAL6-0000Lx-B6 for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Feb 2009 21:33:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LYAKk-0000HS-HO for help-gnu-emacs@gnu.org; Fri, 13 Feb 2009 21:32:46 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LYAKj-0000FN-4Y for help-gnu-emacs@gnu.org; Fri, 13 Feb 2009 21:32:46 -0500 Original-Received: from [199.232.76.173] (port=59126 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LYAKi-0000FK-Ul for help-gnu-emacs@gnu.org; Fri, 13 Feb 2009 21:32:45 -0500 Original-Received: from rv-out-0708.google.com ([209.85.198.246]:51802) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LYAKh-000450-2C for help-gnu-emacs@gnu.org; Fri, 13 Feb 2009 21:32:43 -0500 Original-Received: by rv-out-0708.google.com with SMTP id f25so1078769rvb.6 for ; Fri, 13 Feb 2009 18:32:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=vKRax/5583l0Jh2e/ZRtNTgDacapCy7cD56ZE5sdrpg=; b=KrIWvABeJqjjE9foKWerUGn2IxjMzly4fV5zbiQTf+IyqrWgp75AIXWWaRLmtIt/N8 CpGm/a3ejeJGWRt2HdbqH9PjPiTeQd63UOFTdG27qMl0D8ujlk0eBNqMl3qq24stlp2D tkKnBxaJfQhToEhG3osTdaK0OpoFmp3X3yXL8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=APdyAGqBFGhCB4PZhRbDmrHiKH0KcaIZeTn5GFPc9s7mwKt5YZUrpc7Ktz7tYZA8hj FFPlGGHBzTKM7PLz1Rf+ActzPtmgvdcGk61eHQvTo8YFMMpxT9UyZ8H7FwGjgRV5jgFp afYCt6nKozEQbQ2YTvYRI4rjvQVnN3mBfTrbE= Original-Received: by 10.141.172.7 with SMTP id z7mr1443409rvo.128.1234578761641; Fri, 13 Feb 2009 18:32:41 -0800 (PST) In-Reply-To: <0012f3e9-3378-4714-9c82-14d2a7e3837f@z27g2000prd.googlegroups.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:62116 Archived-At: > it'll take maybe 20 to 30 min to write it. I'd expect it to be easier. Here's my version, which took me 10 minutes, and that's because I've never written an elisp function before and didn't know fill-paragraph and move-b-o-l need args. It goes something like this: (defun colon-list-fill-paragraph () (interactive) (backward-paragraph) (forward-line) (fill-paragraph nil) (next-line) (insert " ") (fill-paragraph nil) (move-beginning-of-line 1) (previous-line) (forward-char) (insert " ")) The only problem with this hastily hacked function is that your first line may be two chars too long. You could improve it with Chetan's idea of replacing your paragraph's first char with space, doing what you need to do, then replacing with a colon. Remember, functions do exactly what you can do with the keyboard. You can write one by doing what you want your function to do by hand, recording your keystrokes, learning the functions your keystrokes invoke (C-h c), and writing them into the function body. For that matter, consult the Emacs manual on Keyboard Macros, and you can write a function without knowing Emacs Lisp. Unfortunately you may not understand your resulting function because it looks like a string of numbers.