12

I tried to read the documentation, but in practice, I could not tell the difference. I feel they are doing the same thing. I can turn both modes on, but I am not sure in what circumstance I need to do so.

3 Answers 3

12

If you are continuously typing text without making mistakes or editing, then the end result would be the same in both cases.

auto-fill-mode isn't so helpful when editing existing text, though (especially so when editing text which has already been filled). It is just inserting line breaks when the current column exceeds the fill column, but if you are editing before the fill column, it does nothing; and it doesn't care about the preceding lines at all. You would probably need to invoke fill-paragraph manually from time to time.

refill-mode OTOH will automatically refill the current paragraph as you edit, and will still trigger when you are before the fill-column.

Just experiment with both -- you'll see the difference pretty quickly.

5

refill-mode does more than auto-fill-mode, and does it automatically.

This may be what you prefer but there are situations where refill-mode is not convenient. E.g., when you edit text shared with others via some version control system like svn or git and what you edit really is some source code for the final text, e.g., when you are writing in LaTeX. The version control systems compare versions line by line and refilling automatically creates a lot of unintended differences that will clutter the communication between co-authors. This is why I use auto-fill-mode a lot, and refill-mode very rarely.

2

M-x auto-fill-mode inserts newlines as you keep inserting characters. M-x refill-mode goes a step further, it triggers on all kinds of changes, including deletion of text (and undoes filling if possible).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.