all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Nikolai Weibull <now@bitwi.se>
Cc: Emacs Developers <emacs-devel@gnu.org>
Subject: Re: Is there a way to create an input method based on another one?
Date: Thu, 28 Feb 2013 10:58:21 -0500	[thread overview]
Message-ID: <jwvhakwjv1x.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CADdV=Ms2qy7rJZUPDtoMmxU2xZ4K=Qh1ud8nzJpDAeg+2XGeuw@mail.gmail.com> (Nikolai Weibull's message of "Wed, 27 Feb 2013 16:01:09 +0100")

> I would like to create my own input method that’s an extension of an
> existing one (rfc1345).  As far as I can tell from reading the source,
> the “public” (undocumented) API seems to be quail-define-package
> followed by quail-define-rules, which seems to be unable to
> accommodate my desires.

Indeed, this kind of functionality is missing :-(
I'd welcome a patch the lets one combine input methods.
I did take a crack at it at some distant point in the past, but
I didn't go very far.  Here's the result:

(defun quail-merge-maps (map1 &rest maps)
  (if (null maps) map1
    (let* ((map2 (pop maps))
	   (h1 (pop map1))
	   (h2 (pop map2)))
      (apply 'quail-merge-maps
	     (cons
	      (if (and h1 h2)
		  (vconcat (if (vectorp h1) h1 (vector h1))
			   (if (vectorp h2) h2 (vector h2)))
		(or h1 h2))
	      (let ((tail nil) conflict)
		(dolist (entry map1)
		  (setq conflict (assq (car entry) map2))
		  (push (if (not conflict) entry
			  (setq map2 (delq conflict map2))
			  (cons (car entry)
				(quail-merge-maps (cdr entry) (cdr conflict))))
			tail))
		(append map2 tail)))
	     maps))))

IIRC this was just good enough for "stateless" input methods
(i.e. methods which just map some char sequences to corresponding chars,
as is done for latin and TeX input methods).


        Stefan



      parent reply	other threads:[~2013-02-28 15:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 15:01 Is there a way to create an input method based on another one? Nikolai Weibull
2013-02-27 18:51 ` Ivan Kanis
2013-02-28 15:58 ` Stefan Monnier [this message]

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=jwvhakwjv1x.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=now@bitwi.se \
    /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.