all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Micah Cowan <micah@cowan.name>
Subject: RFC: Unicode Punct Input Method
Date: 16 Oct 2003 14:17:14 -0700	[thread overview]
Message-ID: <m3brsg6fxh.fsf@localhost.localdomain> (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).

                 reply	other threads:[~2003-10-16 21:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3brsg6fxh.fsf@localhost.localdomain \
    --to=micah@cowan.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.