emacs-devel
[Top][All Lists]
Advanced

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

Re: Word wrap for non-whitespace-seperated language


From: Yuan Fu
Subject: Re: Word wrap for non-whitespace-seperated language
Date: Sat, 7 Mar 2020 00:04:19 -0500

> On Mar 6, 2020, at 11:23 PM, Richard Stallman <address@hidden> wrote:
> 
> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> 
> Would someone please make fill.el work for variable pitch fonts
> and other things that vary from fixed columns?  It is not a small job
> but it is vital for Emacs to advance in the area of formatting.

I’ve got something mostly working, it provides on-the-fly word wrapping that 
supports variable pitch fonts and CJK characters. With minor changes it can be 
also used for filling but I don’t see the point for hard filling variable-pitch 
font text: they display differently in different fonts.

Here is a demo comparing the new wrapper (left) with word-wrap and 
fill-paragraph (right):

PNG image


Now it works reasonably well in text-mode. But I haven’t give it a lot of test. 
You can M-x sfill-mode in any text buffer to use it.

One small issue is that it is not very fast when wrapping variable-pitch fonts. 
I think most of the time is spent around pos-visible-in-window-p and 
posn-at-x-y. I use them to find the rough place to break the line. Is there 
faster ways to to that? Basically I want to know the point at about certain 
column. Currently I’m using (posn-point (posn-at-x-y …)).

Yuan

Attachment: sfill.el
Description: Binary data



reply via email to

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