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 23:33:51 +0300 Message-ID: References: <8d1a3c4b-80fd-65c8-70b6-1ab452a52f6a@piermont.com> <87h7f7qa4k.fsf@gmail.com> <83mtozj5bg.fsf@gnu.org> <87fsuqofoo.fsf@gmail.com> <83o89cp49t.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36833"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: andremegafone@gmail.com, emacs-devel@gnu.org, perry@piermont.com To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 01 22:35:08 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 1mLWwr-0009Gu-Fl for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Sep 2021 22:35:06 +0200 Original-Received: from localhost ([::1]:39190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLWwq-0000so-0w for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Sep 2021 16:35:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLWvo-0000AY-2F for emacs-devel@gnu.org; Wed, 01 Sep 2021 16:34:00 -0400 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:45775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLWvm-0004CU-3I; Wed, 01 Sep 2021 16:33:59 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id E1F81320077A; Wed, 1 Sep 2021 16:33:54 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 01 Sep 2021 16:33:55 -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; s=fm1; bh=hKcs2nIXfiIprl6I7ynOPViVoI fN1m0crYn514W2/fY=; b=o9W6HSuph8gnXxYapp6QzqqdVGBV1ODliJCg2rRgud BzrQXPvO5b+7uhEfKO2gb15CGQ16G//kRw9oT/DAFcQMHpRQ2bj01yDPH3ncnLZe vkuFmQHJajue+uMtX1Eq7csmklejwDiC07F3ROYQEFyJjP7A74mzYCU9/ERmxH2c P2qSTn8lpGRPBpoT0+sS5fBWMy0wo7hmKI32EsJy5LVR1ETgxVNngMgf/MP0eMTM kvE4htYkQPZDnTFd8APMTZmMxzwGKnEDsHtd+DzGUixnO4Txram5d283V0RphvHE vlIo+IcKDq1DoxtKaK0ZddLUg1ibN1b8xQovSONjoAxQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=hKcs2n IXfiIprl6I7ynOPViVoIfN1m0crYn514W2/fY=; b=b1TU4pKKG3R/HS18QL6roO I1V44Abz1tVe9XBucW8sfWTZ7t5KsKqDhtALmfVdQpca+Md3lrKKxmL1oLAobgUt xYbKdFZ5DxeAeIjJ7GyT/ld8k/Vunu0hL266Kp4MxPm9ww3/BNSLC3if9K2A3m9M zFK2QVZcAAQ2CqR6rZyuaawRfgmBlToMRTntBH/lk3wU15U9nQRKCcMxpWLhuWvU ICeSbs6BClvxMcXT7Pd/Olz+topng+lYI06rEBcdVYNcckTdf2E7Z07XeJhpWLNJ TQUMUooEcrnVapaMp8kW18eMiw8t+46ezs1s0XuFpZnNmHo0ISZ3Q2QpppSwJgSQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvfedgudeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffujghffgffkfggtgesthdtredttdertdenucfhrhhomhephfhilhhi phhpucfiuhhnsghinhcuoehfghhunhgsihhnsehfrghsthhmrghilhdrfhhmqeenucggtf frrghtthgvrhhnpedvveekffdvueevhfdutdejheekvdeufeevtedttdevuddugfeiffei veeivefhtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehfghhunhgsihhnsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Sep 2021 16:33:53 -0400 (EDT) In-Reply-To: <83o89cp49t.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 01 Sep 2021 20:57:50 +0300") Received-SPF: pass client-ip=64.147.123.19; envelope-from=fgunbin@fastmail.fm; helo=wout3-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:273684 Archived-At: On 01/09/2021 20:57 +0300, Eli Zaretskii wrote: >> From: Filipp Gunbin >> Cc: Eli Zaretskii , perry@piermont.com, emacs-devel@gnu.org >> Date: Wed, 01 Sep 2021 20:50:04 +0300 >> >> FWIW, I use this (hack?) to employ available input methods for >> transliteration. > > Out of curiosity: why do you need something like that? what's the use > case? It's because our LDAP server at work is a bit messy, attributes like "cn" and "displayname" sometimes contain first then last name, sometimes vice versa, sometimes in Russian, sometimes in English. I use email expansion in message-mode: --8<---------------cut here---------------start------------->8--- (eval-after-load 'message (lambda () (define-key message-mode-map (kbd "C-c TAB") #'eudc-expand-inline))) --8<---------------cut here---------------end--------------->8--- I want to type first letters of surname in English, press C-c TAB and get email autocompleted. But the only "stable", predictable attribute seems to be "sn", which is unfortunately in Russian. So I do: --8<---------------cut here---------------start------------->8--- (eudc-protocol-set 'eudc-inline-query-format '((sn) (email)) 'ldap) (advice-add #'eudc-ldap-simple-query-internal :filter-args #'fg-dotemacs-ldap-advice) (defun fg-dotemacs-ldap-advice (args) (cons (mapcar (lambda (attr) (if (and (eq (car attr) 'sn) (stringp (cdr attr)) (seq-every-p (lambda (c) (eq (aref char-script-table c) 'latin)) (cdr attr))) (cons (car attr) (fg-dotemacs-translit (cdr attr) "cyrillic-translit")) attr)) (car args)) (cdr args))) --8<---------------cut here---------------end--------------->8--- As ugly as it is, but it works. Filipp