[Top][All Lists]

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

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

From: Eli Zaretskii
Subject: Re: refill paragraph but visually (like visual-line-mode)?
Date: Mon, 15 Oct 2018 18:21:59 +0300

> From: "Garreau\, Alexandre" <>
> Date: Mon, 15 Oct 2018 11:35:50 +0200
> 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).

Did you try to enlarge the window's display margins?

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

Such options don't exist.  You need to keep in mind that
visual-line-mode (or "word wrap", as this feature is known in the
internals) is just a semi-kludgey hack: we tweak the line-continuation
code to start the continuation line on whitespace characters.  Other
than that, it's still the same continuation line, and uses the same
code to detect when it's time to wrap the line.  And even this
relatively simple tweak makes the line-wrapping code devilishly
complicated and hard to wrap your head around.

It is possible that making the wrap coordinate controllable by users
is not too hard, but Someone™ should look at the relevant code and try
making it happen.  Maybe we will be lucky.

Wanna try it?

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

Right, see above.

> 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?

Could be, but again, Someone™ should work on this.  One potential
obstacle to negotiate is that, unlike the existing indentation
functions, which traverse the buffer in order to find out the
indentation of surrounding lines, the display code cannot easily do
that, because the display routines are expected to be able to be
called with a buffer position from which to start display, and be able
to lay out a single screen line without knowing anything about the
neighboring lines.  Some algorithm is needed to calculate the right
indentation in those cases.

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

This should be possible by hiding newlines behind display properties
or overlays.

Patches are welcome to implement any of these useful features.


reply via email to

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