unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* emojis and other multi-character glyphs
@ 2021-12-26  9:43 Evgeny Zajcev
  2021-12-26 10:15 ` Eli Zaretskii
  2021-12-26 10:45 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 25+ messages in thread
From: Evgeny Zajcev @ 2021-12-26  9:43 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1753 bytes --]

There is some inconsistency in naming and behaviour in Emacs master.
We have `forward-char', `backward-char', `delete-char',
`backward-delete-char' commands.  All of them use "char" in their names,
however, `forward-char' and `backward-char' treats "char" differently than
`delete-char' and `backward-delete-char'.

Let me explain.  Emacs has support for composed characters to display
multiple characters composed into a single glyph.  Almost the same is done
for multi-character emojis such as 🇷🇺 or 👨‍👩‍👧‍👦 - multiple unicode
chars are composed into single glyph representing some emoji.  Now, if you
put point under composed character or emoji and run `forward-char' or
`backward-char' it moves point to the whole glyph, however, if you run
`delete-char' (when point is under composed char) or
`backward-delete-char'(when point just after the glyph) it will delete only
single character from multiple character representation, so pressing `C-d'
under 🇷🇺 will magically turn Russian flag into 🇺.  This is very
misleading behaviour especially when invisible characters are used in the
emojis

Maybe introduce "glyph" term meaning graphical representation of chars
sequence, displayed in the buffer and operated as a whole thing?

For example these things creates a glyph in a buffer:
1) (compose-chars ?a ?b)
2) (concat "\x1F1F7" "\x1F1FA")
3) (propertize "aaaa" 'display "B")

In this case, we can rename `forward-char' to `forward-glyph' keeping
naming and behaviour in consistency.

And also it will be possible to write something like `string-glyph-length'
to return 1 for "👨‍👩‍👧‍👦" instead of 7 as `length' returns now.

What do you think?

Thanks

-- 
lg

[-- Attachment #2: Type: text/html, Size: 2221 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2021-12-29 13:01 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-26  9:43 emojis and other multi-character glyphs Evgeny Zajcev
2021-12-26 10:15 ` Eli Zaretskii
2021-12-26 10:41   ` Evgeny Zajcev
2021-12-26 10:51     ` Eli Zaretskii
2021-12-26 10:56       ` Evgeny Zajcev
2021-12-26 10:58         ` Eli Zaretskii
2021-12-26 11:09           ` Evgeny Zajcev
2021-12-26 11:26             ` Eli Zaretskii
2021-12-26 11:53               ` Lars Ingebrigtsen
2021-12-26 11:57                 ` Eli Zaretskii
2021-12-26 12:03                   ` Lars Ingebrigtsen
2021-12-26 12:13                     ` Eli Zaretskii
2021-12-26 12:16                       ` Po Lu
2021-12-26 12:26                       ` Lars Ingebrigtsen
2021-12-26 12:50                         ` Po Lu
2021-12-26 13:00                         ` Eli Zaretskii
2021-12-27 10:30                           ` Lars Ingebrigtsen
2021-12-27 14:46                             ` Eli Zaretskii
2021-12-29  4:54                               ` Anand Tamariya
2021-12-29 13:01                                 ` Eli Zaretskii
2021-12-26 12:35                   ` LdBeth
2021-12-26 13:01                     ` Eli Zaretskii
2021-12-26 18:00     ` Stefan Monnier
2021-12-26 10:45 ` Lars Ingebrigtsen
2021-12-26 10:50   ` Evgeny Zajcev

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).