emacs-devel
[Top][All Lists]
Advanced

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

Re: Variable pitch text filling


From: Yuan Fu
Subject: Re: Variable pitch text filling
Date: Thu, 2 Dec 2021 11:03:36 -0800



On Dec 2, 2021, at 9:53 AM, Eli Zaretskii <eliz@gnu.org> wrote:

From: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Date: Wed, 01 Dec 2021 18:35:31 +0100

Eli Zaretskii <eliz@gnu.org> writes:

1) Be able to specify a min width based on a "standard" char width (for
"-" in the mode line, for instance)

2) A specific pixel width (for justification, for instance)

3) The integral multiple (i.e., "grid")

1) is for mode line, and is satisfied with min-width display spec
(which needs to be fixed, perhaps, see bug#52183).
2) is for pixel-resolution justification, and will be satisfied by a
new kind of display spec.
3) will should be per-buffer (or globally), and will be satisfied by a new
buffer-local variable.

Is something missing?

Yes.

1) is difficult to achieve, because we haven't implemented a recursive
`min-width'.  To do so it possible, but finicky, since we have to look
far ahead in the buffer to see whether a new min-width spec ends the
current one, or starts a new recursive one.  I'd rather not do that,
because it'd be ugly and weird. 

So all three of these should be a new kind of text property.  In
addition, 3) should also be a buffer-local variable in addition to being
a text property.  (The text property is useful if you have a monospace
table in a buffer, but there may be other text in the buffer that you
don't want to quantise.)

I've now implemented the "variable" part of 3).  To try it, set the
new variable align-columns-display (suggestions for a better name are
welcome) to a non-nil value.  I'd like our CJK users to try this and
tell if they like the results, before implementing also the
text-property part of the feature, as that is significantly more
complex to code.

This is very cool! When I test it it seems CJK characters are not aligned when first displayed, but are aligned after the cursor goes over them. Opening a directory, I first see


Where there is no space inserted between CJK characters (the spaces seems to be accumulated at the end of consecutive CJK characters, in this case before the period). If I place my cursor on one CJK character, I see


Emacs adds spaces after the character under point, but the space obstructs the character after. If I hold on C-f and go over every character, their alignment are fixed:


Highlighting the region puts them back:


This is a dired buffer, the text properties are

There are text properties here:
  dired-filename       t
  fontified            t
  help-echo            "mouse-2: visit this file in other window"
  mouse-face           highlight

HTH,
Yuan


reply via email to

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