Subject: bug#20545: New minor mode Electric Punct

From: Paul Eggert <[email-masked]>
Date: Wed, 13 May 2015 07:49:47 -0700

Stefan Monnier wrote:

> Hmm... is it really Emacs that displayed it like this?  Or is it the
> terminal which did it?  If it's Emacs, then I wonder how it figured it
> needed to do that

I haven't looked at the details, but I expect Emacs looks at the locale and 
discovers that it's unibyte.  At least, that's how I did it: by starting xterm 
in an Ubuntu 15.04 environment where LC_ALL=en_US.iso885915, and then running 
emacs -nw under xterm.  In this situation, the attached patch to Emacs (which 
would have to be improved before installing) has the behavior of using 
underlined ` and ' to render curved single quotes.

diff --git a/src/term.c b/src/term.c
index d2a9c3d..86ca4d8 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1867,6 +1867,10 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
 			  : it->c <= MAX_UNICODE_CHAR ? "\\U%06X"
 			  : "\\x%06X"),
 			 it->c + 0u);
+	  if (it->c == 0x2018)
+	    buf[0] = '`', len = 1;
+	  else if (it->c == 0x2019)
+	    buf[0] = '\'', len = 1;
 	}
       str = buf;
     }