GNU bug report logs - #14973
Unfill for Emacs

Previous Next

Package: emacs;

Reported by: Xue Fuqiao <xfq.free <at> gmail.com>

Date: Sun, 28 Jul 2013 06:37:01 UTC

Severity: wishlist

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14973 in the body.
You can then email your comments to 14973 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14973; Package emacs. (Sun, 28 Jul 2013 06:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xue Fuqiao <xfq.free <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 28 Jul 2013 06:37:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xue Fuqiao <xfq.free <at> gmail.com>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Unfill for Emacs
Date: Sun, 28 Jul 2013 14:36:05 +0800
tags patch

There are fill-{paragraph, column}, but I didn't find an unfill command,
can we add them (maybe in fill.el)?

(defun unfill-paragraph ()
  "Replace newline characters in current paragraph by single spaces.

This command does the inverse of `fill-paragraph'."
  (interactive)
  (let ((fill-column most-positive-fixnum))
    (fill-paragraph nil)))

(defun unfill-region (beg end)
  "Replace newline characters in region by single spaces.

If called non-interactively, BEG and END are the beginning and end of
the text to unfill.
This command does the inverse of `fill-region'."
  (interactive "r")
  (let ((fill-column most-positive-fixnum))
    (fill-region beg end)))

-- 
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14973; Package emacs. (Sun, 28 Jul 2013 14:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 14973 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Xue Fuqiao <xfq.free <at> gmail.com>, 14973 <at> debbugs.gnu.org
Subject: RE: bug#14973: Unfill for Emacs
Date: Sun, 28 Jul 2013 07:28:29 -0700 (PDT)
Just one terminology point: what you describe and implement is not
unfilling.  These are fill commands, not unfill commands.

Unfilling is the inverse of filling.  Unfilling undoes the last filling
operation on the same region or whatever.  It restores contiguous
whitespace chars that were collapsed, etc.

What you have instead might be called "join lines" or "remove line
breaks".  But even those names do not accurately characterize it, because
it also fills: it insists on the kind of whitespace separation imposed
by filling: no contiguous whitespace chars (except possibly indentation
and after sentence ends).

That does not mean that this could not be useful.  But we might not want
to falsely advertise what it does.

The best characterization of what this code does is "fill as one line".
(But even that assumes a line length less than `most-positive-fixnum'.)
And that is my suggestion:

 `fill-paragraph-as-one-line'
 `fill-region-as-one-line'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14973; Package emacs. (Sun, 28 Jul 2013 14:55:01 GMT) Full text and rfc822 format available.

Message #11 received at 14973 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Xue Fuqiao <xfq.free <at> gmail.com>
Cc: 14973 <at> debbugs.gnu.org
Subject: Re: bug#14973: Unfill for Emacs
Date: Sun, 28 Jul 2013 17:53:58 +0300
> Date: Sun, 28 Jul 2013 14:36:05 +0800
> From: Xue Fuqiao <xfq.free <at> gmail.com>
> 
> There are fill-{paragraph, column}, but I didn't find an unfill command,
> can we add them (maybe in fill.el)?
> 
> (defun unfill-paragraph ()
>   "Replace newline characters in current paragraph by single spaces.
> 
> This command does the inverse of `fill-paragraph'."
>   (interactive)
>   (let ((fill-column most-positive-fixnum))
>     (fill-paragraph nil)))

You need a special command to replace one character by another?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14973; Package emacs. (Sun, 28 Jul 2013 15:07:02 GMT) Full text and rfc822 format available.

Message #14 received at 14973 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Xue Fuqiao <xfq.free <at> gmail.com>
Cc: 14973 <at> debbugs.gnu.org
Subject: RE: bug#14973: Unfill for Emacs
Date: Sun, 28 Jul 2013 08:06:44 -0700 (PDT)
> > There are fill-{paragraph, column}, but I didn't find an unfill command,
> > can we add them (maybe in fill.el)?
> >
> > (defun unfill-paragraph ()
> >   "Replace newline characters in current paragraph by single spaces.
> 
> You need a special command to replace one character by another?

A user might not *need* that, provided s?he were knowledgeable wrt
replacement commands or wrt Lisp.  But a user might *want* that.

The question is whether such commands should be added to Emacs, as a
convenience.  I have no opinion about that.  But if they are added then
I would prefer that the command names reflect better what the commands do
(see my previous comment).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14973; Package emacs. (Sun, 28 Jul 2013 15:16:01 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Schmidt <christopher <at> ch.ristopher.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#14973: Unfill for Emacs
Date: Sun, 28 Jul 2013 16:14:44 +0100 (BST)
Eli Zaretskii <eliz <at> gnu.org> writes:
> You need a special command to replace one character by another?

The command does more than that, e.g. it honours
sentence-end-double-space.

I do not think there is any need to add this command to vanilla Emacs.
Just use set-fill-column (C-x f).

        Christopher




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14973; Package emacs. (Sun, 28 Jul 2013 16:59:02 GMT) Full text and rfc822 format available.

Message #20 received at 14973 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Xue Fuqiao <xfq.free <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>,
 14973 <at> debbugs.gnu.org
Subject: Re: bug#14973: Unfill for Emacs
Date: Sun, 28 Jul 2013 22:29:47 +0530
>> You need a special command to replace one character by another?

This is what I use for deleting newlines and thus create "long" lines.
Seem to work well for me.

,----
| M-^ runs the command delete-indentation, which is an interactive
| compiled Lisp function in `simple.el'.
| 
| It is bound to M-^.
| 
| (delete-indentation &optional ARG)
| 
| Join this line to previous and fix up whitespace at join.
| If there is a fill prefix, delete it from the beginning of this line.
| With argument, join this line to following line.
`----





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14973; Package emacs. (Sun, 28 Jul 2013 18:32:01 GMT) Full text and rfc822 format available.

Message #23 received at 14973 <at> debbugs.gnu.org (full text, mbox):

From: Josh <josh <at> foxtail.org>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: Xue Fuqiao <xfq.free <at> gmail.com>, 14973 <at> debbugs.gnu.org,
 Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#14973: Unfill for Emacs
Date: Sun, 28 Jul 2013 11:31:02 -0700
On Sun, Jul 28, 2013 at 9:59 AM, Jambunathan K <kjambunathan <at> gmail.com> wrote:
>
>>> You need a special command to replace one character by another?
>
> This is what I use for deleting newlines and thus create "long" lines.
> Seem to work well for me.
>
> ,----
> | M-^ runs the command delete-indentation, which is an interactive
> | compiled Lisp function in `simple.el'.
> |
> | It is bound to M-^.
> |
> | (delete-indentation &optional ARG)
> |
> | Join this line to previous and fix up whitespace at join.
> | If there is a fill prefix, delete it from the beginning of this line.
> | With argument, join this line to following line.
> `----

Perhaps it would make sense to extend delete-indentation to apply to
active regions in the same way as commands like replace-string,
whitespace-cleanup, etc.  This could make "unfilling" a paragraph as
simple as M-h M-^, perhaps with an intervening C-n to move point to
the desired position.  Alternatively, a bare negative prefix argument
(M-- M-^) could trigger that behavior without need of an active
region.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14973; Package emacs. (Wed, 26 Jan 2022 17:26:02 GMT) Full text and rfc822 format available.

Message #26 received at 14973 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Josh <josh <at> foxtail.org>
Cc: Xue Fuqiao <xfq.free <at> gmail.com>, Jambunathan K <kjambunathan <at> gmail.com>,
 Drew Adams <drew.adams <at> oracle.com>, 14973 <at> debbugs.gnu.org
Subject: Re: bug#14973: Unfill for Emacs
Date: Wed, 26 Jan 2022 18:25:33 +0100
Josh <josh <at> foxtail.org> writes:

> Perhaps it would make sense to extend delete-indentation to apply to
> active regions in the same way as commands like replace-string,
> whitespace-cleanup, etc.  This could make "unfilling" a paragraph as
> simple as M-h M-^, perhaps with an intervening C-n to move point to
> the desired position.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Looks like the command was changed to work just like this in:

commit 0cd250e9583deb1e1f4d8dae2ec44c4f7c13efa6
Author:     Basil L. Contovounesios <contovob <at> tcd.ie>
AuthorDate: Wed Mar 27 15:13:25 2019 +0000

    Fix recently extended delete-indentation behavior

So I think this covers the proposed new commands, and I'm therefore
closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 14973 <at> debbugs.gnu.org and Xue Fuqiao <xfq.free <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 26 Jan 2022 17:26:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Feb 2022 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 58 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.