all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Iain Dalton <iain.dalton@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Customising fill-paragrah
Date: Fri, 13 Feb 2009 19:32:41 -0700	[thread overview]
Message-ID: <ceb631e60902131832l160ca37euf00c1820935c315f@mail.gmail.com> (raw)
In-Reply-To: <0012f3e9-3378-4714-9c82-14d2a7e3837f@z27g2000prd.googlegroups.com>

> 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.




  reply	other threads:[~2009-02-14  2:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.283.1234252813.31690.help-gnu-emacs@gnu.org>
2009-02-10 14:10 ` Customising fill-paragrah Xah Lee
2009-02-14  2:32   ` Iain Dalton [this message]
2009-02-11 21:44 ` Chetan
2009-02-10  8:02 Sebastian Tennant

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ceb631e60902131832l160ca37euf00c1820935c315f@mail.gmail.com \
    --to=iain.dalton@gmail.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.