all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* RFC: Unicode Punct Input Method
@ 2003-10-16 21:17 Micah Cowan
  0 siblings, 0 replies; only message in thread
From: Micah Cowan @ 2003-10-16 21:17 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-10-16 21:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-16 21:17 RFC: Unicode Punct Input Method Micah Cowan

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.