help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: refill paragraph but visually (like visual-line-mode)?


From: Stefan Monnier
Subject: Re: refill paragraph but visually (like visual-line-mode)?
Date: Mon, 15 Oct 2018 11:56:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> The current problem of visual-line mode and why I almost never use is up
> to three reasons:
>
> First of all, the text ends wrapped at the right edge of window, even if
> that means quite long lines (such as more than 66 columns: 111 is the
> default with my default current font), which is more a pain of reading
> (eye must move more, stuff to see are more distant from each others).
> Oddly I found nor in searching variables/functions nor in documentation
> anything to limit automatic visual word-wrapping to something such as
> 66, 72, or something more comfortable.

You might like the visual-fill-column packaqe which widens the margin
such that your 111-wide window only has 66-wide columns (sounds like
a big waste to me: I'd rather make the window narrower and use the
remaining space for something else, but to each his own).

> In second stance, when reading source code, and this is normally the
> case I’d find word-wrap the most useful, the wrap just happens to
> continue the logical line from the *beginning* of the next visual line.
> So indentation is broken, and it hard to correctly read afterwards.  I
> guess this may be complicated to implement, but as emacs auto indent
> works most of time, wouldn’t there a way to put visual indent too?

You might like the adaptive-wrap package for that.
[ Here again, I'd suggest to shorten the source lines as a better
  solution, because long lines in source code are just an abomination,
  but admittedly if it's not your code adaptive-wrap-prefix-mode might
  be helpful.  ]

> And last but not least: if the text (usually human text) I’m reading is
> already wrapped, by fill-paragraph for instance, I end up with pairs of
> filled long-lines + very short lines (lines end) which is really ugly:
> word-wrap only wraps, but not refill.  I’d like an option or mode that
> puts at the end of the visual line the beginning of the next logical
> line, just as fill-paragraph do, but only visually, and keeping an
> (invisible) trace of the original/logical newlines.  Maybe while filling
> at fill-column behind the scenes.  So I stop hitting M-q
> (`fill-paragraph') repetedly while word-wrap is on (isn’t this what
> word-wrap is supposed to stop?) to make text readable.

I don't have a package to suggest here :-(
Hopefully, one exists, tho.

There's `refill-mode` which provides a related feature, but it just
does the M-q for you while you edit the text, which won't help you if
you're only reading the text.

The main difficulty here is that to do a proper refill, you need to find
the paragraph boundaries and there's no reliable rule for that (only
heuristics and conventions), so doing it 100% automatically tends to
come with warts and all (which is why refill-mode only performs the
refill for the paragraphs which you do edit, for example).

But I guess if you do it without modifying the buffer (i.e. only using
features which affect the display but not the buffer's contents), the
warts would at least be "harmless".


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]