all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Converting compositions to strings
Date: Mon, 30 Jan 2017 18:52:00 +0200	[thread overview]
Message-ID: <83y3xswkwf.fsf@gnu.org> (raw)
In-Reply-To: <f6e8f88f-d4eb-0cb8-e699-f947ebe4f058@gmail.com> (message from Clément Pit-Claudel on Mon, 30 Jan 2017 11:39:09 -0500)

> Cc: emacs-devel@gnu.org
> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> Date: Mon, 30 Jan 2017 11:39:09 -0500
> 
> On 2017-01-30 10:18, Eli Zaretskii wrote:
> > The information about this can be found in the doc strong of 
> > compose-region, under COMPONENTS.
> 
> Thanks.  This covers only "relative" compositions, right? Is there more information on non-relative compositions somewhere?

No, AFAIK this documents both relative and rule-based compositions.

> > The ones that seem to be relevant to what you are looking for (I'm 
> > guessing) are a small class, and I don't think you can discern them 
> > from the others unless you look at the "rules" parts of a 
> > composition.
> 
> Looking at the rules sounds fine; thanks! I think these compositions form a small class in terms of what Emacs supports, but that class seems to most if not all uses of composition that I see in my daily use of Emacs (where are other compositions used, beyond character spacing in what-cursor-position?).
> 
> Based on your pointers, the following seems to work OK for me (I guess it could be extended to cover the (Bl . Br) case, but I haven't seen that pop up yet in practice).
> 
> (defun esh--parse-composition (components)
>   "Translate composition COMPONENTS into a string."
>   (let ((chars (list (aref components 0)))
>         (nrules (/ (length components) 2)))
>     (dotimes (nrule nrules)
>       (let* ((rule (aref components (+ 1 (* 2 nrule))))
>              (char (aref components (+ 2 (* 2 nrule)))))
>         (pcase rule
>           (`(Br . Bl) (push char chars))
>           (_ (error "Unsupported composition COMPONENTS")))))
>     (concat chars)))

I think if we want to be able to produce text with all the text
properties and overlays expressed explicitly as text, we need to write
a back-end for xdisp.c that "displays" to a buffer.  It shouldn't be
hard, the number of interface routines a back-end needs to support is
not large; see 'struct redisplay_interface' in dispextern.h.



  reply	other threads:[~2017-01-30 16:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30  5:13 Converting compositions to strings Clément Pit-Claudel
2017-01-30 13:34 ` Stefan Monnier
2017-01-30 16:23   ` Clément Pit-Claudel
2017-01-30 14:24 ` Ted Zlatanov
2017-01-30 16:27   ` Clément Pit-Claudel
2017-01-30 17:48     ` Ted Zlatanov
2017-01-30 15:18 ` Eli Zaretskii
2017-01-30 16:39   ` Clément Pit-Claudel
2017-01-30 16:52     ` Eli Zaretskii [this message]
2017-01-31 14:31       ` Stefan Monnier

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y3xswkwf.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=cpitclaudel@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.