emacs-devel
[Top][All Lists]
Advanced

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

Re: How to add a display property when a char appear in a buffer.


From: Eli Zaretskii
Subject: Re: How to add a display property when a char appear in a buffer.
Date: Mon, 29 Nov 2021 14:37:16 +0200

> From: "Feng Shu" <tumashu@163.com>
> Date: Mon, 29 Nov 2021 11:20:34 +0800
> 
> I want to auto add display property :min-width '(2.0), when a char
> *appear* into a buffer. this char maybe inserted by user command, maybe
> inserted in elisp.

If it's inserted by a user command, you can write a slightly different
command that puts the property.  If you want to cover also insertions
from Lisp, I think the only good mechanism is to register a jit-lock
function.

But IMNSHO, it is not a good idea to put this property on individual
characters, not at all.  You will end up with buffers that have many
display properties, and that slows down redisplay, makes the Emacs
memory larger, etc.  Don't do that!

The right way of making double-width character occupy exactly 2
columns on GUI frames is to tweak their pixel_width on the level of
the display code, under the control of some variable, similar to what
I did with height (which you didn't like, but here we are talking
about width, not height)).  We are discussing such a feature on this
list, so I suggest that you follow that discussion and provide input
and feedback where you see fit.



reply via email to

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