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: Thu, 02 Sep 2021 13:47:54 +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> <83h7f3pkbx.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="31760"; 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 Thu Sep 02 12:51:05 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 1mLkJE-00080L-2q for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Sep 2021 12:51:05 +0200 Original-Received: from localhost ([::1]:41746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLkJC-00080F-I2 for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Sep 2021 06:51:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLkIE-0007Eg-IU for emacs-devel@gnu.org; Thu, 02 Sep 2021 06:50:02 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:33263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLkGI-00018H-3i; Thu, 02 Sep 2021 06:50:02 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 9D07232002F9; Thu, 2 Sep 2021 06:47:59 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 02 Sep 2021 06:47:59 -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=sA9pL7tNFalJkZcUkk820w8Ow6 m5RwLXFdkFuvt1FiU=; b=Dbko03+3TM7DU+cIDhTJEkNeYZVTz+F7Re97BpI/eA GJH18K8pfz+1U9TIB13pONLhdmnkYtzAjwWDDmlcgURR8dxrFU5HHvGar+TrRXLG nOxMRiNwk7XmobY/GmS3S14M/Z6Pbyajv8ztWWHwxGuGFxvL2zDFRJb27lJX7C4X EVp9mf+xkI5dPi+bhFLUJDFNzYf6iwK93jwnB6HKmKTKKPo5hzR07DBWmSfKyUHe OarZkNq9rx+ejYncDQ2ROHgsPGSdbYSbIv6tuUilqvC85N/9fTKnxqep4cFISYul GYESZvn7uRqyxWg28+J1ut+IFPFwdLPIQRGo0js+7Ysw== 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=sA9pL7 tNFalJkZcUkk820w8Ow6m5RwLXFdkFuvt1FiU=; b=VD1as9yu+TVChN6grRRnAX p0VILKcXbOlURP/WLcWvF6OexfC2NjqRU7kZFgmw9jQf1fC0JSRmoxwAs31jNxYa oOLPIZqFE++i5gwHeIaEyrdH6qUlJvLBvFgHbO+dxdycF4EBT//ETvYhp29tU0uM d7nR0GO8BYs29/csSrIwNfXKJTm9msiaSqtU1R+xMSH8zE5F8j8fWUKPsf8nB+Lc YRgTCCltxtg/JW1fy2knnrBYBsFVg3+T8ZXcrM5zQqjnX525jodaU5I9DU7XxA9o tF1/V2aSuUjzD2mSqhtYeVXDE7BqE9YRBLnEdg1YYXui4xY+7E7b3ZyLjb9yL8Dg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvhedgfedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufgjfhgffffkgggtsehttdertddtredtnecuhfhrohhmpefhihhlihhp phcuifhunhgsihhnuceofhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmheqnecuggftrf grthhtvghrnhepvdevkeffvdeuvefhuddtjeehkedvueefveettddtveduudfgieffieev ieevhfdtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epfhhguhhnsghinhesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 2 Sep 2021 06:47:58 -0400 (EDT) In-Reply-To: <83h7f3pkbx.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 02 Sep 2021 09:23:14 +0300") Received-SPF: pass client-ip=64.147.123.25; envelope-from=fgunbin@fastmail.fm; helo=wout2-smtp.messagingengine.com 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:273699 Archived-At: On 02/09/2021 09:23 +0300, Eli Zaretskii wrote: >> From: Filipp Gunbin >> Cc: andremegafone@gmail.com, perry@piermont.com, emacs-devel@gnu.org >> Date: Wed, 01 Sep 2021 23:33:51 +0300 >> >> > 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. > > So what you need is to apply the cyrillic-translit input method, just > not in an interactive context, is that true? Yes, right.