auto fill-paragraph

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

auto fill-paragraph

drain
Is there a way to make paragraphs automatically adjust to the fill-column setting?

I would want this primarily for the org-mode and mail buffers, certainly
not globally.

Right now I have to manually call fill-paragraph to adjust any text (my
default setting is 75).
Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

Drew Adams
> Is there a way to make paragraphs automatically adjust to the
> fill-column setting?
>
> Right now I have to manually call fill-paragraph to adjust
> any text (my default setting is 75).

I just keep typing and Emacs wraps wrt `fill-column' automatically.  (But then,
I don't use long-lines, visual-lines or any such modern inconveniences.)

Give a step-by-step recipe of what you do, and perhaps someone will be able to
help you.


Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

drain
Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

drain
Unfortunately modern inconveniences plague my Emacs, among them
visual-line-mode, which does not wrap lines automatically to the
fill-column setting.

Recipe:

(1) (setq-default fill-column 75)
(2) M-x visu RET
(3) Write a couple sentences and watch as the words fail to wrap.
Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

Drew Adams
> Unfortunately modern inconveniences plague my Emacs, among them
> visual-line-mode, which does not wrap lines automatically to the
> fill-column setting.
>
> Recipe:
> (1) (setq-default fill-column 75)
> (2) M-x visu RET
> (3) Write a couple sentences and watch as the words fail to wrap.

Just say no to step #2?

Otherwise, consider reporting the problem as a bug report or enhancement
request: `M-x report-emacs-bug'.

But again, maybe some dedicated visual-linite will have a better suggestion.


Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

drain
(1) Emacs -Q
(2) C-x f 75 RET
(3) Type more than 75 characters in words and watched as the lines fail to
    wrap at 76 characters.

Does not have anything to do with visual-line-mode.

Can you provide a recipe for the opposite? Situation under which lines wrap
at the fill-column setting without calling fill-paragraph (i.e.,
automatically)?

I'm reluctant to consider this a bug, when it is more accurately described
as a missing feature (which I still doubt).

Just to be clear about what I want, here's a recipe that produces the
desired result:

(1) C-x f 75 RET
(2) Type more than 75 characters in words.
(3) M-x fill-paragraph

The goal is to automate (3) as characters reach 76 to a line.
Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

Drew Adams
> (1) C-x f 75 RET
> (2) Type more than 75 characters in words.
> (3) M-x fill-paragraph
> The goal is to automate (3) as characters reach 76 to a line.

Turn on auto-fill-mode in your init file.
E.g., (add-hook 'text-mode-hook 'turn-on-auto-fill t)


Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

drain
Fixed.
Reply | Threaded
Open this post in threaded view
|

Re: auto fill-paragraph

Eli Zaretskii
In reply to this post by Drew Adams
> From: "Drew Adams" <[hidden email]>
> Date: Fri, 16 Nov 2012 14:17:33 -0800
>
> > Unfortunately modern inconveniences plague my Emacs, among them
> > visual-line-mode, which does not wrap lines automatically to the
> > fill-column setting.
> >
> > Recipe:
> > (1) (setq-default fill-column 75)
> > (2) M-x visu RET
> > (3) Write a couple sentences and watch as the words fail to wrap.
>
> Just say no to step #2?
>
> Otherwise, consider reporting the problem as a bug report or enhancement
> request: `M-x report-emacs-bug'.
>
> But again, maybe some dedicated visual-linite will have a better suggestion.

What bug?  I see the same behavior, with or without step 2.  Perhaps a
more detailed recipe is required, including a precise description of
the OP's expectations.

Reply | Threaded
Open this post in threaded view
|

Re: auto fill-paragraph

drain
Although text must be manipulated before it will auto-fill: if I copy /
paste a bunch of paragraphs from an article or book, they sprawl across
the line well past the 75 character limit.

I must, at a minimum, newline somewhere, e.g.,

"I was induced to take this course from the consideration also that the
present work is not intended for popular use, that those devoted to science
do not require such helps, although they are always acceptable, and that
they would have materially interfered with my present purpose. Abbe
Terrasson remarks with great justice that, if we estimate the size of a
work, not from the number of its pages, but from the time which we require
to make ourselves master of it, it may be said of many a book that it would
be much shorter, if it were not so short."

Will not automatically adjust, but the second I newline it into two
paragraphs:

"I was induced to take this course from the consideration also that the
present work is not intended for popular use, that those devoted to science
do not require such helps, although they are always acceptable, and that
they would have materially interfered with my present purpose.

Abbe Terrasson remarks with great justice that, if we estimate the size of
a work, not from the number of its pages, but from the time which we
require to make ourselves master of it, it may be said of many a book that
it would be much shorter, if it were not so short."

They both adjust.

Any way for copy / pasted text to also automatically fill?
Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

Drew Adams
> Any way for copy / pasted text to also automatically fill?

Write your own paste command that does (a) yank (paste), (b) insert newlines to
separate paragraphs, (c) fill/wrap each paragraph?

See `fill-region', which fills each paragraph in the region.

See also `fill-individual-paragraphs' and `fill-nonuniform-paragraphs'.


Reply | Threaded
Open this post in threaded view
|

RE: auto fill-paragraph

drain
Newlining is the minimum necessary to trigger automatic fill-columning of
yanked paragraphs; it's not what I want included in the automation.
Definitely not.

Passing the yanked region to fill-region, however, should do the trick.
Reply | Threaded
Open this post in threaded view
|

Re: auto fill-paragraph

Xavier Maillard-8
In reply to this post by drain
>
> Fixed.

Really terse ! What did you do exactly ? Did you deactivate visu-xx stuff ?

Regards
        Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org

Reply | Threaded
Open this post in threaded view
|

Re: auto fill-paragraph

drain
Xavier Maillard-8 wrote
Really terse ! What did you do exactly ? Did you deactivate visu-xx stuff ?
Added to my .emacs:

(add-hook 'text-mode-hook 'turn-on-auto-fill t)

Works with visual-line-mode on.

I decided against a function that automatically fills yanked text. Instead,
I highlight the paragraphs and interactively call fill-region.
Reply | Threaded
Open this post in threaded view
|

Re: auto fill-paragraph

Stefan Monnier
In reply to this post by drain
There's an important element you do not discuss in your description of
what you want: do you want the "line-wrapping" to be done on the
buffer's content (so that the saved file does not contain lines longer
than 75 chars), or only on its rendering on screen?

auto-fill-mode and M-q modify the actual buffer content, whereas things
like visual-line-mode only affect the display rendering.

There are ways to trick the rendering engine to do the line-wrapping at
a particular column (e.g. the same column as fill-column).  The simplest
way is to resize the window.


        Stefan