unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Intrusive spaces
@ 2006-06-07 16:20 B. T. Raven
  2006-06-08  8:01 ` Mathias Dahl
  0 siblings, 1 reply; 4+ messages in thread
From: B. T. Raven @ 2006-06-07 16:20 UTC (permalink / raw)


I ran M-| bc on this region:

define fact(n) {
   if (n <= 1) return (n);
      return (n * fact(n-1));
}
fact(666)

The resulting very big number fills about 24 lines each terminated with
C-j. I then ran the following function

(defun unfill-paragraph () ;; bound to C-x M-q
  "Do the opposite of fill-paragraph; stuff all lines in the current
paragraph into a single long line."
  (interactive)
  (let ((fill-column 90002000))
    (fill-paragraph nil)))

on those 24 lines. Instead of joining them seamlessly, it puts in a space
where the C-j had been. I haven't noticed this happening with ordinary
text before. This happens with 21.3 on dos shell msw98.

???

Thanks,

Ed

--

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Intrusive spaces
@ 2006-06-07 17:34 Jay Bingham
  0 siblings, 0 replies; 4+ messages in thread
From: Jay Bingham @ 2006-06-07 17:34 UTC (permalink / raw)


On Wednesday, June 07, 2006 11:20 AM B. T. Raven Wrote:

> I ran M-| bc on this region:
>
> define fact(n) {
>    if (n <= 1) return (n);
>       return (n * fact(n-1));
> }
> fact(666)
>
> The resulting very big number fills about 24 lines each terminated with
> C-j. I then ran the following function
>
> (defun unfill-paragraph () ;; bound to C-x M-q
>   "Do the opposite of fill-paragraph; stuff all lines in the current
> paragraph into a single long line."
>   (interactive)
>   (let ((fill-column 90002000))
>     (fill-paragraph nil)))
>
> on those 24 lines. Instead of joining them seamlessly, it puts in a
> space where the C-j had been. I haven't noticed this happening with
> ordinary text before. This happens with 21.3 on dos shell msw98.

B.T.,

I just ran a quick fill paragraph test using text rather than numbers and what I see is that doing fill-paragraph with a large fill-column setting does in fact put spaces where the ^js were.  (I am running Emacs 21.3 on XP).  In fact this is what I would expect fill-paragraph to do because usually paragraphs are an series of words separated by spaces and line feeds rather than a string of numbers separated by line feeds.  For example if I had following two lines:

You should have a go
at it. 

I would expect then to be filled as:
You should have a go at it.

not as:
You should have a goat it.

Granted there may be times when even with text is would be preferable to not have a space replace the line feed, such as:

He went that-a-
way.

should be filled as:
He went that-a-way.

not as:
He went that-a- way.

but they are rare and fill-paragraph is not that smart.

__
J_)
C_)ingham
 


_____________________________________________________________________
Call Anyone, Anytime, Anywhere in the World - FREE!
Free Internet calling from NetZero Voice
Visit http://www.netzerovoice.com today!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Intrusive spaces
       [not found] <mailman.2718.1149703362.9609.help-gnu-emacs@gnu.org>
@ 2006-06-07 22:20 ` B. T. Raven
  0 siblings, 0 replies; 4+ messages in thread
From: B. T. Raven @ 2006-06-07 22:20 UTC (permalink / raw)



"Jay Bingham" <b.jc-emacs@netzero.com> wrote in message
news:mailman.2718.1149703362.9609.help-gnu-emacs@gnu.org...
On Wednesday, June 07, 2006 11:20 AM B. T. Raven Wrote:

> I ran M-| bc on this region:
>
> define fact(n) {
>    if (n <= 1) return (n);
>       return (n * fact(n-1));
> }
> fact(666)
>
> The resulting very big number fills about 24 lines each terminated with
> C-j. I then ran the following function
>
> (defun unfill-paragraph () ;; bound to C-x M-q
>   "Do the opposite of fill-paragraph; stuff all lines in the current
> paragraph into a single long line."
>   (interactive)
>   (let ((fill-column 90002000))
>     (fill-paragraph nil)))
>
> on those 24 lines. Instead of joining them seamlessly, it puts in a
> space where the C-j had been. I haven't noticed this happening with
> ordinary text before. This happens with 21.3 on dos shell msw98.

B.T.,

I just ran a quick fill paragraph test using text rather than numbers and
what I see is that doing fill-paragraph with a large fill-column setting
does in fact put spaces where the ^js were.  (I am running Emacs 21.3 on
XP).  In fact this is what I would expect fill-paragraph to do because
usually paragraphs are an series of words separated by spaces and line
feeds rather than a string of numbers separated by line feeds.  For
example if I had following two lines:

You should have a go
at it.

I would expect then to be filled as:
You should have a go at it.

not as:
You should have a goat it.

Granted there may be times when even with text is would be preferable to
not have a space replace the line feed, such as:

He went that-a-
way.

should be filled as:
He went that-a-way.

not as:
He went that-a- way.

but they are rare and fill-paragraph is not that smart.

__
J_)
C_)ingham


Duh! I was so focused on getting a quick and dirty answer to the number of
digits in Number-of-beast! that the obvious escaped me. I am glad that
fill-paragraph is at least smarter than I am in that it knows enough to
end a "word" after 80 or 100 contiguous characters.

Thanks,
Ed.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Intrusive spaces
  2006-06-07 16:20 Intrusive spaces B. T. Raven
@ 2006-06-08  8:01 ` Mathias Dahl
  0 siblings, 0 replies; 4+ messages in thread
From: Mathias Dahl @ 2006-06-08  8:01 UTC (permalink / raw)


"B. T. Raven" <ecinmn@alcisp.com> writes:

> on those 24 lines. Instead of joining them seamlessly, it puts in a space
> where the C-j had been. I haven't noticed this happening with ordinary
> text before. This happens with 21.3 on dos shell msw98.

I agree with the other reply, that I would expect a space to separate
what was originally a newline character.

Anyway, why not just search and replace all newlines with an empty
string. Something like this should work:

(defun replace-newline-with-nothing ()
  (while (search-forward-regexp "\n" nil t)
    (replace-match "")))

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-08  8:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-07 16:20 Intrusive spaces B. T. Raven
2006-06-08  8:01 ` Mathias Dahl
  -- strict thread matches above, loose matches on Subject: below --
2006-06-07 17:34 Jay Bingham
     [not found] <mailman.2718.1149703362.9609.help-gnu-emacs@gnu.org>
2006-06-07 22:20 ` B. T. Raven

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