From: Eli Zaretskii <eliz@gnu.org>
To: "Feng Shu" <tumashu@163.com>
Cc: emacs-devel@gnu.org
Subject: Re: How to add a display property when a char appear in a buffer.
Date: Mon, 29 Nov 2021 14:37:16 +0200 [thread overview]
Message-ID: <835ysbw32b.fsf@gnu.org> (raw)
In-Reply-To: <87czmjve9p.fsf@163.com> (tumashu@163.com)
> 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.
next prev parent reply other threads:[~2021-11-29 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 3:20 How to add a display property when a char appear in a buffer Feng Shu
2021-11-29 12:37 ` Eli Zaretskii [this message]
2021-11-29 12:52 ` Feng Shu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=835ysbw32b.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=tumashu@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).