[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RFC: Unicode Punct Input Method
From: |
Micah Cowan |
Subject: |
RFC: Unicode Punct Input Method |
Date: |
16 Oct 2003 14:17:14 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
When editing XML documents in PSGML's xml-mode, I like to enter
appropriate punctuation that is context-sensitive; that is, when
I type `'' (apostrophe) I like it to use Unicode's left-quote
character if there is whitespace (or no characters at all) to the
left of point; and right-quote otherwise. I have similar rules
for dashes: one of MINUS (U+2212), EN DASH (U+2013), HYPHEN
(U+2010) or EM DASH U+2014) are selected based on context (in the
case of EM DASH, the previous character is examined, and if it
too is a dash character, then it is *replaced* by the new EM DASH
character).
I also like to be able to quickly indicate that the next
character should be inserted as-is without massaging, or that
(for instance) the logic as to whether to insert a left-quote or
right-quote should be reversed (think of "'Tis" or "Stop 'N
Shop"). Also, since I do this in XML, context-sensitivity is
important, so that if I start typing `<!--', or `<elem-name
attrib="value"', I don't get non-ascii characters for the `-' and
the `"'.
I looked into what it takes to define an "input method" in quail,
and it didn't quite seem to suit my needs: it didn't support
binding functions in rules (necessary for the
context-sensitivity)--and any solutions I came up with seemed
like dirty hacks; so I decided to write myself a minor mode. It
works quite well (so far), and allows the user to define a
buffer-local function which simply returns true if "special"
punctuation can be safely entered in this location without
breaking syntax.
My request is two-fold: that you would inform me as to any
aspects of defining an input method that I seem to have
overlooked, and that you would comment on the code, style and
practical usability (and anything else) for my minor mode, which
can be found at:
http://www.micah.cowan.name/temp/uni-punct.el
(I couldn't post here since it's in UTF-8, and many NGs don't
appreciate the use of MIME; anyway, I had trouble converting
multibyte data to quoted-printable in gnus).
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RFC: Unicode Punct Input Method,
Micah Cowan <=