Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

auto fill-paragraph

74 views
Skip to first unread message

drain

unread,
Nov 16, 2012, 4:23:42 PM11/16/12
to Help-gn...@gnu.org
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).



--
View this message in context: http://emacs.1067599.n5.nabble.com/auto-fill-paragraph-tp269880.html
Sent from the Emacs - Help mailing list archive at Nabble.com.

Drew Adams

unread,
Nov 16, 2012, 4:43:00 PM11/16/12
to drain, Help-gn...@gnu.org
> 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.


drain

unread,
Nov 16, 2012, 5:08:56 PM11/16/12
to Help-gn...@gnu.org

drain

unread,
Nov 16, 2012, 5:09:46 PM11/16/12
to Help-gn...@gnu.org
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.




--
View this message in context: http://emacs.1067599.n5.nabble.com/auto-fill-paragraph-tp269880p269886.html

Drew Adams

unread,
Nov 16, 2012, 5:17:33 PM11/16/12
to drain, Help-gn...@gnu.org
> 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.


drain

unread,
Nov 16, 2012, 5:31:36 PM11/16/12
to Help-gn...@gnu.org
(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.



--
View this message in context: http://emacs.1067599.n5.nabble.com/auto-fill-paragraph-tp269880p269888.html

Drew Adams

unread,
Nov 16, 2012, 5:42:37 PM11/16/12
to drain, Help-gn...@gnu.org
> (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)


drain

unread,
Nov 16, 2012, 5:51:33 PM11/16/12
to Help-gn...@gnu.org

Eli Zaretskii

unread,
Nov 17, 2012, 2:37:55 AM11/17/12
to Help-gn...@gnu.org
> From: "Drew Adams" <drew....@oracle.com>
> Date: Fri, 16 Nov 2012 14:17:33 -0800
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.

drain

unread,
Nov 17, 2012, 11:31:32 AM11/17/12
to Help-gn...@gnu.org
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?



--
View this message in context: http://emacs.1067599.n5.nabble.com/auto-fill-paragraph-tp269880p269953.html

Drew Adams

unread,
Nov 17, 2012, 11:46:31 AM11/17/12
to drain, Help-gn...@gnu.org
> 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'.


drain

unread,
Nov 17, 2012, 7:56:21 PM11/17/12
to Help-gn...@gnu.org
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.



--
View this message in context: http://emacs.1067599.n5.nabble.com/auto-fill-paragraph-tp269880p269999.html

Xavier Maillard

unread,
Nov 18, 2012, 12:58:07 PM11/18/12
to drain, Help-gn...@gnu.org
>
> 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

drain

unread,
Nov 18, 2012, 5:09:01 PM11/18/12
to Help-gn...@gnu.org
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.



--
View this message in context: http://emacs.1067599.n5.nabble.com/auto-fill-paragraph-tp269880p270109.html

Stefan Monnier

unread,
Nov 19, 2012, 9:57:14 AM11/19/12
to
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
0 new messages