From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filipp Gunbin Newsgroups: gmane.emacs.devel Subject: Re: How do you write input methods? Date: Wed, 01 Sep 2021 20:50:04 +0300 Message-ID: References: <8d1a3c4b-80fd-65c8-70b6-1ab452a52f6a@piermont.com> <87h7f7qa4k.fsf@gmail.com> <83mtozj5bg.fsf@gnu.org> <87fsuqofoo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30053"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: Eli Zaretskii , emacs-devel@gnu.org, perry@piermont.com To: =?utf-8?Q?Andr=C3=A9?= A. Gomes Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 01 19:51:17 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mLUOJ-0007VW-EE for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Sep 2021 19:51:16 +0200 Original-Received: from localhost ([::1]:53192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLUOH-0003Yt-C1 for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Sep 2021 13:51:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLUNP-0002p6-Iz for emacs-devel@gnu.org; Wed, 01 Sep 2021 13:50:19 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:41679) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLUNJ-0003Up-8E; Wed, 01 Sep 2021 13:50:19 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id B55383200999; Wed, 1 Sep 2021 13:50:08 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 01 Sep 2021 13:50:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm1; bh= 250xVfw4iTUQ7dxRK5kYBg8jhvZKVNrQy75ylKuvRe0=; b=fbanwdQd4zZb/1EL uVNVXX2ghDrOPwMksxuvToWfdy4dvI6zQ/I5gAt3SoX3EyOvvhqiG5NxFYlsVgqQ AzYyf3NomWC9eXZzeyR5+JsX+9o6oiFiftEM1/TADjlq51Qzb+uWda8J4snKa/Cg sykAtSJ5wBykgN7F+4tOQatNK3zHhHpcneus250ANLXJ1I1DExxIg43+eUCLpXRz g4X3rSjZAPZMs0gPyCeVMjyA3ivkKZOqGMAFXcAq4gWVTIkJS36NCBXwUJ2QFwFS I9neiZ5o0TKUROjcR9a6IrNrQJXOvUnk9+jLK3Zu7dV4eWLhi6ZoBPcfMGw52wV0 9U82fg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=250xVfw4iTUQ7dxRK5kYBg8jhvZKVNrQy75ylKuvR e0=; b=Xf2iXBCY/bVrVO8wcgdu4pfBkgo/EuO69Sb+8P8r7mnftx/e18KSltmWj JKOtY4/7v/3YJfqIoB0iDJEFMhSznYUlYVVMZH64diPcLFQGaN6Zp0PSvWEuR24x Gto1n6SSuATEGSZVfRWtYK81guZ+FKPJbSO9E7l2ESeN3arfB1HibYfVZ76oLZrZ ZQbB2zq5ip7zCTdnePUo+sFVx9DdaW82qfnWd7NrllsdaPhT83rltkt9lW3CWgIk l/ho2WkeRLUwZ1bQznTTi84+56y8+lAvvSbHvJweUWVM1rVejw7wLbUO28X3/jWS gv/74WvPVWPHySHdAog7drp5fzJgw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvfedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffujghffgffkfggtgfgsehtqhertddtreejnecuhfhrohhmpefhihhl ihhpphcuifhunhgsihhnuceofhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmheqnecugg ftrfgrthhtvghrnhepkedvkeduledvtddvleevjeegtedugfdvlefgfeetgfekjeehheev hffgteffiefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepfhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 13:50:06 -0400 (EDT) In-Reply-To: <87fsuqofoo.fsf@gmail.com> (=?utf-8?Q?=22Andr=C3=A9?= A. Gomes"'s message of "Mon, 30 Aug 2021 23:12:07 +0300") Received-SPF: pass client-ip=64.147.123.25; envelope-from=fgunbin@fastmail.fm; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:273676 Archived-At: FWIW, I use this (hack?) to employ available input methods for transliteration. Filipp --8<---------------cut here---------------start------------->8--- (defun fg-dotemacs-translit (str input-method) (with-temp-buffer (let ((input-method-verbose-flag nil) res) (activate-input-method input-method) (discard-input) (setq unread-command-events ;; add newline so input method doesn't wait for more input ;; in case of multiple translation possibilities (listify-key-sequence (concat str "\n"))) (while (input-pending-p) (push (read-char nil t) res)) (concat (reverse ;; don't forget to remove newline (cdr res)))))) (ert-deftest fg-dotemacs-translit-test() (should (equal "=D1=80=D1=83=D1=81=D1=81=D0=BA=D0=B8=D0=B9" (fg-dotemacs-= translit "russkij" "cyrillic-translit"))) ;; `u' / `sh' may have different completions (should (equal "=D0=B3=D1=83" (fg-dotemacs-translit "gu" "cyrillic-transl= it"))) (should (equal "=D1=88" (fg-dotemacs-translit "sh" "cyrillic-translit")))) --8<---------------cut here---------------end--------------->8---