unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Is there a way to create an input method based on another one?
@ 2013-02-27 15:01 Nikolai Weibull
  2013-02-27 18:51 ` Ivan Kanis
  2013-02-28 15:58 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Nikolai Weibull @ 2013-02-27 15:01 UTC (permalink / raw)
  To: Emacs Developers

Hi!

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.

Am I missing something?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is there a way to create an input method based on another one?
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Ivan Kanis @ 2013-02-27 18:51 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: Emacs Developers

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

February, 27 at 16:01 Nikolai Weibull wrote:

> 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.
>
> Am I missing something?

No you're not missing anything. I have attached my french input source
code that you may find handy. The entry point is
ivan-french-keymap-load.

Take care,
-- 
Your packets were eaten by the terminator.
    -- BOFH excuse #20

[-- Attachment #2: ivan-french.el --]
[-- Type: application/emacs-lisp, Size: 8276 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is there a way to create an input method based on another one?
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2013-02-28 15:58 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: Emacs Developers

> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-28 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).