Subject: bug#20545: New minor mode Electric Punct

From: Eli Zaretskii <[email-masked]>
Date: Wed, 13 May 2015 19:54:30 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Wed, 13 May 2015 09:10:07 -0400
> 
> > I just now configured a terminal to refuse to display curved quotes, and
> > when I used it Emacs displayed "‘like this’" as "\u2018like this\u2019" with
> > underscores below the "\u2018" and the "\u2019".
> 
> Hmm... is it really Emacs that displayed it like this?  Or is it the
> terminal which did it?

Emacs.  That's how we display "glyphless" characters on a TTY.

> If it's Emacs, then I wonder how it figured it needed to do that,

By checking whether the character belongs to one of the charsets
supported by the terminal.  We call char_charset with the list of
charsets supported by the terminal frame; that charset list is set by
set-terminal-coding-system-internal.  See the end of
term.c:produce_glyphs.

> and if it's the terminal, then I wonder how Emacs could tell the
> terminal to...
> 
> > ... display it as "`like this'" with underscores under the "`" and the "'",
> > if you think that'd be a win.

We could discover this in advance (e.g., using char-displayable-p) and
use a display table, for example.