From: Tassilo Horn <tassilo@member.fsf.org>
Subject: Re: What's wrong with this seemingly simple function for unwrapping text?
Date: Fri, 12 Jan 2007 12:28:36 +0100 [thread overview]
Message-ID: <87ac0o1o2j.fsf@baldur.tsdh.de> (raw)
In-Reply-To: 1168599607.154137.166990@q2g2000cwa.googlegroups.com
"Endless Story" <usable.thought@gmail.com> writes:
Hi,
> (defun unwrap-text ()
> (interactive)
> (setq fill-column 5000)
> (mark-whole-buffer)
^^^^^^^^^^^^^^^^^
,----[ C-h f mark-whole-buffer RET ]
| mark-whole-buffer is an interactive compiled Lisp function in `simple.el'.
| It is bound to C-x h, <menu-bar> <edit> <mark-whole-buffer>.
| (mark-whole-buffer)
|
| Put point at beginning and mark at end of buffer.
| You probably should not use this function in Lisp programs;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| it is usually a mistake for a Lisp function to use any subroutine
| that uses or sets the mark.
`----
> (fill-region)
^^^^^^^^^^^
That function has two mandatory arguments.
,----[ C-h f fill-region RET ]
| fill-region is an interactive compiled Lisp function in `fill.el'.
| It is bound to <menu-bar> <edit> <fill>.
| (fill-region FROM TO &optional JUSTIFY NOSQUEEZE TO-EOP)
| ^^^^ ^^
| Fill each of the paragraphs in the region.
| A prefix arg means justify as well.
| Ordinarily the variable `fill-column' controls the width.
|
| Noninteractively, the third argument JUSTIFY specifies which
| kind of justification to do: `full', `left', `right', `center',
| or `none' (equivalent to nil). t means handle each paragraph
| as specified by its text properties.
|
| The fourth arg NOSQUEEZE non-nil means to leave
| whitespace other than line breaks untouched, and fifth arg TO-EOP
| non-nil means to keep filling to the end of the paragraph (or next
| hard newline, if variable `use-hard-newlines' is on).
|
| Return the fill-prefix used for filling the last paragraph.
|
| If `sentence-end-double-space' is non-nil, then period followed by one
| space does not end a sentence, so don't break a line there.
`----
> (setq fill-column '70)
^
The quote is quite irritating.
> )
>
> When the function gets to fill-region, it bombs out, complaining about
> 'wrong number of variables.' So my questions are:
>
> 1) For any lisp experts, what's going wrong here?
See above.
> 2) Is there some built-in way for doing what I want to do?
Don't think so, but this should work:
--8<---------------cut here---------------start------------->8---
(defun unwrap-text ()
(interactive)
(let ((fill-column 9999))
(fill-region (point-min) (point-max))))
--8<---------------cut here---------------end--------------->8---
Regards,
Tassilo
--
* delYsid has mortgage, opportunity and penis in his score file.
<delYsid> thats pretty effective against spam
<Luke> aren't you worried about missing opportunities to mortgage
your penis?
next prev parent reply other threads:[~2007-01-12 11:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-12 11:00 What's wrong with this seemingly simple function for unwrapping text? Endless Story
2007-01-12 11:28 ` Tassilo Horn [this message]
2007-01-12 15:01 ` B. T. Raven
2007-01-13 12:18 ` Endless Story
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=87ac0o1o2j.fsf@baldur.tsdh.de \
--to=tassilo@member.fsf.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).