Subject: bug#20499: [PROPOSED PATCH] C-x 8 shorthands for curved quotes, Euro, etc.

From: Paul Eggert <[email-masked]>
Date: Thu, 07 May 2015 00:53:32 -0700

> 	I believe that both C-x 8 . and C-x 8 u are too convenient to be
> 	dropped without more discussion.  For one thing, · seems more
> 	“common” a character than İ.

In Turkish and Azerbaijani the reverse is true.  And since RMS requested dotted 
I and dotless i my assumption was that Turkish is of some importance.  Dotted 
sequences are the natural ways to type these characters as well as other dotted 
letters ĊċĖėĠġĿŀŻż in the proposal (used variously in Lithuanian, Maltese, and 
Polish), so there is a pretty strong case to usurp "C-x 8 .".

The case for usurping "C-x 8 u" is even stronger, since it's equivalent to the 
equally-short "C-x 8 m", some easily-typed symbol is needed to denote breve, and 
"u" looks more like breve than any other ASCII character does.

>       Other than that, C-x 8 . . feels
> 	easier to type than C-x 8 SPC.

Good point, and I've done this in the attached patch.

>  > -;;; iso-transl.el --- keyboard input definitions for ISO 8859-1  -*- coding: utf-8 -*-
>  > +;;; iso-transl.el --- keyboard input for ISO characters -*- coding: utf-8 -*-
>
> 	I guess we may safely state “ISO 10646” here.

Thanks, done in the attached patch.

>  > +;; This package supports all characters defined by ISO 8859-1,
>  > +;; along with many other Latin characters and a few other characters
>  > +;; commonly used in English and basic math.
>
> 	… And may also mention it here.

Thanks, also done.

>  >      ("-"    . [?])
>  > -    ("*."   . [?·])
>
> 	The removal above doesn’t seem to be strictly necessary.  The
> 	same for the *= and *u ones.

Thanks, fixed in the attached patch.

> 	… Also, did you consider generating this list automatically,
> 	based on the codepoint properties already known to Emacs?
> 	Something along the lines of the function MIMEd, which readily
> 	produces a list of entries for the following 133 characters.
> 	(Three spaces added for symmetry purposes.)
>
>     À Á Â Ã Ä È É Ê Ë Ì Í Î Ï Ñ Ò Ó Ô Õ Ö Ù Ú Û Ü Ý
>     à á â ã ä è é ê ë ì í î ï ñ ò ó ô õ ö ù ú û ü ý
>     ÿ   Ā ā Ć ć Ĉ ĉ Č č Ď ď Ē ē Ě ě Ĝ ĝ Ĥ ĥ Ĩ ĩ Ī ī Ĵ ĵ Ĺ ĺ
>     Ľ ľ Ń ń Ň ň Ō ō Ŕ ŕ Ř ř Ś ś Ŝ ŝ Š š Ť ť Ũ ũ Ū ū Ŵ ŵ Ŷ ŷ
>     Ÿ   Ź ź Ž ž Ǎ ǎ Ǐ ǐ Ǒ ǒ Ǔ ǔ Ǧ ǧ Ǩ ǩ   ǰ Ǵ ǵ Ǹ ǹ Ș ș Ț ț
>     Ȟ ȟ Ȳ ȳ

Sorry, I don't really follow the code that you attached.  Although I suppose it 
comes from a decomposition table, I don't know what the table was designed for, 
and it's not clear to me how it's relevant.  Anyway, most of those letters are 
either in iso-transl.el now, or are in the previously proposed patch.  Here are 
the exceptional (i.e., missing even in the previously proposed patch) letters, 
along with some comments about these exceptions:

 > Ǎ ǎ Ǐ ǐ Ǒ ǒ Ǔ ǔ Ǹ ǹ

These are for toned Pinyin but this list is incomplete.  If we wanted to cover 
toned Pinyin, we'd also need Ǖ ǖ Ǘ ǘ Ǚ ǚ Ǜ ǜ.  Coming up with two-character 
abbreviations for all these might be tricky.  Most Pinyin usage omits the tones.

 > Ǧ ǧ Ǩ ǩ

These are Skolt Sami but this list is also incomplete; we'd also need Ʒ Ǥ ǥ Ǯ	ǯ 
ʒ at least.

 > ǰ

What language uses this?  I couldn't find one.

 > Ǵ ǵ

Good catch.  These are used for transliteration from Serbian and Macedonian.  We 
should also include Ḱ ḱ as they are also needed.  Included in the attached patch.

 > Ȟ ȟ

Used in Finnish Kalo, which is quite obscure.

 > Ȳ ȳ

Used in Livonian, but for that we'd also need a whole bunch of other letters, 
including Ǟ ǟ Ḑ ḑ Ȫ ȫ Ȭ ȭ Ȯ ȯ Ȱ and I've probably omitted some.  Plus, modern 
Livonian doesn't seem to be using Ȳ ȳ any more....

Anyway, part of what's going on here is that the proposed list doesn't cover 
every Latin character in the ISO 10646 repertoire (that'd be a large set), but 
instead is limited to what appear to be reasonably commonly letters.  Admittedly 
this is not universal but one must cut things off somewhere, and it would be odd 
to add only partial coverage for toned Pinyin, Livonian, etc.

 >  > --------------090904020002020306060104
 >  > Content-Type: text/x-patch;
 >  >  name="0001-C-x-8-shorthands-for-curved-quotes-Euro-etc.patch"
 >
 > 	This MIME part sure wants ‘; charset=UTF-8’.  Otherwise, Gnus
 > 	does no decoding, and Emacs shows the contents with the likes of
 > 	\304\260.

Hmm, it works for me.  I use Thunderbird to read the top level message, and it 
spins off an Emacs to display the attachment with no problem.  The web-site 
archive at <http://bugs.gnu.org/20499#60> also works for me with Firefox.

It's common for people to send the output of "git send-email" as attachments; if 
this doesn't work with Gnus I suppose a Gnus user (i.e. not me :-) should file a 
bug report.  I looked around the net and found other Gnus users with similar 
problems and some code that worked for them; please see 
<http://bewatermyfriend.org/p/2011/00a/> and/or 
<http://blog.printf.net/articles/tag/emacs/>.  But this stuff appeared to be 
several years old and this leads me to hope that maybe recent-enough Gnus 
versions will do the right thing already.

>From 6df8a6734078c274a964701e46a414185bde8e7a Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Wed, 6 May 2015 20:01:46 -0700
Subject: [PATCH] C-x 8 shorthands for curved quotes, Euro, etc.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Although C-x 8 lets you insert arbitrary Unicode characters, it's
awkward to use this to insert commonly used symbols such as curved
quotes, the Euro symbol, etc.  This patch adds simpler sequences for
many Latin characters (e.g., the Euro), plus characters that
are commonly found in English text and in basic math.  For example,
assuming the Alt key works on your keyboard and iso-transl is loaded,
one can now type "A-[" instead of "A-RET LEFT SIN TAB RET" to get the
character "‘" (U+2018 LEFT SINGLE QUOTATION MARK).
(Bug#20499)
* doc/emacs/mule.texi (Unibyte Mode): Many more Latin and a few
other printing characters now work too.
* etc/NEWS: Document this.
* lisp/international/iso-transl.el (iso-transl-char-map):
Withdraw "C-x 8 ." (· U+00B7 MIDDLE DOT), "C-x 8 =" (¯ U+00AF
SPACING MACRON), and "C-x 8 u" (µ U+00B5 MICRO SIGN) as they are
now used for compositions.  The longer forms still work.
Also support the following characters, which are used in
either current English or Latin-alphabet or basic math text:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ĀāĂăĄąĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģǴǵĤĥĦħĨĩĪīĬĭĮįİıĴĵḰḱĶķĸĹĺĻļĽľĿŀŁł
ŃńŅņŇňŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſȘșȚț
---
 doc/emacs/mule.texi              |   4 +-
 etc/NEWS                         |  11 +++
 lisp/international/iso-transl.el | 169 ++++++++++++++++++++++++++++++++++++++-
 3 files changed, 178 insertions(+), 6 deletions(-)

diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index de381df..b7632a9 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -1660,8 +1660,8 @@ characters present directly on the keyboard or using @key{Compose} or
 @cindex compose character
 @cindex dead character
 @item
-For Latin-1 only, you can use the key @kbd{C-x 8} as a ``compose
-character'' prefix for entry of non-@acronym{ASCII} Latin-1 printing
+You can use the key @kbd{C-x 8} as a ``compose character'' prefix for
+entry of common non-@acronym{ASCII} Latin and a few other printing
 characters.  @kbd{C-x 8} is good for insertion (in the minibuffer as
 well as other buffers), for searching, and in any other context where
 a key sequence is allowed.
diff --git a/etc/NEWS b/etc/NEWS
index 3ab1f4b..46576c2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -213,6 +213,17 @@ successive char insertions.
 
 ** Unicode names entered via C-x 8 RET now use substring completion by default.
 
+** C-x 8 has shorthands for more Latin and a few other common chars.
+For example, C-x 8 . I is now short for İ U+0130 LATIN CAPITAL LETTER
+I WITH DOT ABOVE.  As before, you can type C-x 8 C-h to list all
+shorthands.  To make room for the new shorthands, three aliases have
+been withdrawn, as follows:
+
+    withdrawn  added      still works   character
+    C-x 8 .    C-x 8 . .  C-x 8 . SPC   · U+00B7 MIDDLE DOT
+    C-x 8 =               C-x 8 = SPC   ¯ U+00AF SPACING MACRON
+    C-x 8 u               C-x 8 m       µ U+00B5 MICRO SIGN
+
 ** New minor mode global-eldoc-mode is enabled by default.
 
 ** Emacs now supports "bracketed paste mode" when running on a terminal
diff --git a/lisp/international/iso-transl.el b/lisp/international/iso-transl.el
index 73bcae0..b12322e 100644
--- a/lisp/international/iso-transl.el
+++ b/lisp/international/iso-transl.el
@@ -1,4 +1,4 @@
-;;; iso-transl.el --- keyboard input definitions for ISO 8859-1  -*- coding: utf-8 -*-
+;;; iso-transl.el --- keyboard input for ISO 10646 chars -*- coding: utf-8 -*-
 
 ;; Copyright (C) 1987, 1993-1999, 2001-2015 Free Software Foundation,
 ;; Inc.
@@ -36,6 +36,10 @@
 ;; to make all of the Alt keys autoload, and it is not clear
 ;; that the dead accent keys SHOULD autoload this package.
 
+;; This package supports all characters defined by ISO 8859-1, along
+;; with many other Latin characters defined by ISO 10646 and a few
+;; other ISO 10646 characters commonly used in English and basic math.
+
 ;;; Code:
 
 ;;; Provide some binding for startup:
@@ -113,7 +117,7 @@
     ("*-"   . [?])
     ("-"    . [?])
     ("*."   . [?·])
-    ("."    . [?·])
+    (".."   . [?·])
     ("//"   . [?÷])
     ("/A"   . [?Å])
     ("/E"   . [?Æ])
@@ -127,7 +131,7 @@
     ("*<"   . [?«])
     ("<"    . [?«])
     ("*="   . [?¯])
-    ("="    . [?¯])
+    ("= "   . [?¯])
     ("*>"   . [?»])
     (">"    . [?»])
     ("*?"   . [?¿])
@@ -174,7 +178,6 @@
     ("*o"   . [?°])
     ("o"    . [?°])
     ("*u"   . [?µ])
-    ("u"    . [?µ])
     ("*m"   . [?µ])
     ("m"    . [?µ])
     ("*x"   . [?×])
@@ -192,6 +195,164 @@
     ("~o"   . [?õ])
     ("~t"   . [?þ])
     ("~~"   . [?¬])
+    ("=A"   . [?Ā])
+    ("=a"   . [?ā])
+    ("uA"   . [?Ă])
+    ("ua"   . [?ă])
+    ("gA"   . [?Ą])
+    ("ga"   . [?ą])
+    ("'C"   . [?Ć])
+    ("'c"   . [?ć])
+    ("^C"   . [?Ĉ])
+    ("^c"   . [?ĉ])
+    (".C"   . [?Ċ])
+    (".c"   . [?ċ])
+    ("vC"   . [?Č])
+    ("vc"   . [?č])
+    ("vD"   . [?Ď])
+    ("vd"   . [?ď])
+    ("=D"   . [?Đ])
+    ("=d"   . [?đ])
+    ("=E"   . [?Ē])
+    ("=e"   . [?ē])
+    ("uE"   . [?Ĕ])
+    ("ue"   . [?ĕ])
+    (".E"   . [?Ė])
+    (".e"   . [?ė])
+    ("gE"   . [?Ę])
+    ("ge"   . [?ę])
+    ("vE"   . [?Ě])
+    ("ve"   . [?ě])
+    ("^G"   . [?Ĝ])
+    ("^g"   . [?ĝ])
+    ("uG"   . [?Ğ])
+    ("ug"   . [?ğ])
+    (".G"   . [?Ġ])
+    (".g"   . [?ġ])
+    (",G"   . [?Ģ])
+    (",g"   . [?ģ])
+    ("^H"   . [?Ĥ])
+    ("^h"   . [?ĥ])
+    ("=H"   . [?Ħ])
+    ("=h"   . [?ħ])
+    ("~I"   . [?Ĩ])
+    ("~i"   . [?ĩ])
+    ("=I"   . [?Ī])
+    ("=i"   . [?ī])
+    ("uI"   . [?Ĭ])
+    ("ui"   . [?ĭ])
+    ("gI"   . [?Į])
+    ("gi"   . [?į])
+    (".I"   . [?İ])
+    (".i"   . [?ı])
+    ("^J"   . [?Ĵ])
+    ("^j"   . [?ĵ])
+    (",K"   . [?Ķ])
+    (",k"   . [?ķ])
+    ("qk"   . [?ĸ])
+    ("'L"   . [?Ĺ])
+    ("'l"   . [?ĺ])
+    (",L"   . [?Ļ])
+    (",l"   . [?ļ])
+    ("vL"   . [?Ľ])
+    ("vl"   . [?ľ])
+    (".L"   . [?Ŀ])
+    (".l"   . [?ŀ])
+    ("=L"   . [?Ł])
+    ("=l"   . [?ł])
+    ("'N"   . [?Ń])
+    ("'n"   . [?ń])
+    (",N"   . [?Ņ])
+    (",n"   . [?ņ])
+    ("vN"   . [?Ň])
+    ("vn"   . [?ň])
+    ("Ng"   . [?Ŋ])
+    ("ng"   . [?ŋ])
+    ("=O"   . [?Ō])
+    ("=o"   . [?ō])
+    ("uO"   . [?Ŏ])
+    ("uo"   . [?ŏ])
+    ("2O"   . [?Ő])
+    ("2o"   . [?ő])
+    ("OE"   . [?Œ])
+    ("Oe"   . [?œ])
+    ("'R"   . [?Ŕ])
+    ("'r"   . [?ŕ])
+    (",R"   . [?Ŗ])
+    (",r"   . [?ŗ])
+    ("vR"   . [?Ř])
+    ("vr"   . [?ř])
+    ("'S"   . [?Ś])
+    ("'s"   . [?ś])
+    ("^S"   . [?Ŝ])
+    ("^s"   . [?ŝ])
+    (",S"   . [?Ş])
+    (",s"   . [?ş])
+    ("vS"   . [?Š])
+    ("vs"   . [?š])
+    (",T"   . [?Ţ])
+    (",t"   . [?ţ])
+    ("vT"   . [?Ť])
+    ("vt"   . [?ť])
+    ("=T"   . [?Ŧ])
+    ("=t"   . [?ŧ])
+    ("~U"   . [?Ũ])
+    ("~u"   . [?ũ])
+    ("=U"   . [?Ū])
+    ("=u"   . [?ū])
+    ("uU"   . [?Ŭ])
+    ("uu"   . [?ŭ])
+    ("/U"   . [?Ů])
+    ("/u"   . [?ů])
+    ("2U"   . [?Ű])
+    ("2u"   . [?ű])
+    ("gU"   . [?Ų])
+    ("gu"   . [?ų])
+    ("^W"   . [?Ŵ])
+    ("^w"   . [?ŵ])
+    ("^Y"   . [?Ŷ])
+    ("^y"   . [?ŷ])
+    ("\"Y"  . [?Ÿ])
+    ("'Z"   . [?Ź])
+    ("'z"   . [?ź])
+    (".Z"   . [?Ż])
+    (".z"   . [?ż])
+    ("vZ"   . [?Ž])
+    ("vz"   . [?ž])
+    ("ls"   . [?ſ])
+    ("'G"   . [?Ǵ])
+    ("'g"   . [?ǵ])
+    (";S"   . [?Ș])
+    (";s"   . [?ș])
+    (";T"   . [?Ț])
+    (";t"   . [?ț])
+    ("'K"   . [?Ḱ])
+    ("'k"   . [?ḱ])
+    ("_h"   . [?‐])
+    ("_H"   . [?‑])
+    ("_f"   . [?‒])
+    ("_n"   . [?–])
+    ("_m"   . [?—])
+    ("_q"   . [?―])
+    ("["    . [?‘])
+    ("]"    . [?’])
+    ("{"    . [?“])
+    ("}"    . [?”])
+    ("1+"   . [?†])
+    ("2+"   . [?‡])
+    ("**"   . [?•])
+    ("*'"   . [?′])
+    ("*\""  . [?″])
+    ("*E"   . [?€])
+    ("No"   . [?№])
+    ("a<"   . [?←])
+    ("a>"   . [?→])
+    ("a="   . [?↔])
+    ("_-"   . [?−])
+    ("~="   . [?≈])
+    ("/="   . [?≠])
+    ("_<"   . [?≤])
+    ("_>"   . [?≥])
     ("' "   . "'")
     ("` "   . "`")
     ("\" "  . "\"")
-- 
2.1.0