From: Filipp Gunbin <fgunbin@fastmail.fm>
To: Eli Zaretskii <eliz@gnu.org>
Cc: andremegafone@gmail.com, emacs-devel@gnu.org, perry@piermont.com
Subject: Re: How do you write input methods?
Date: Thu, 02 Sep 2021 13:47:54 +0300 [thread overview]
Message-ID: <m2czprb6ed.fsf@fastmail.fm> (raw)
In-Reply-To: <83h7f3pkbx.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 02 Sep 2021 09:23:14 +0300")
On 02/09/2021 09:23 +0300, Eli Zaretskii wrote:
>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> 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.
prev parent reply other threads:[~2021-09-02 10:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-30 1:10 How do you write input methods? Perry E. Metzger
2021-08-30 11:15 ` Stephen Berman
2021-08-30 11:24 ` Joost Kremers
2021-08-30 11:48 ` Stephen Berman
2021-08-30 16:23 ` Perry E. Metzger
2021-08-30 20:26 ` Stephen Berman
2021-08-30 11:46 ` Eli Zaretskii
2021-08-30 13:40 ` Perry E. Metzger
2021-08-30 14:00 ` Eli Zaretskii
2021-08-30 14:22 ` Perry E. Metzger
2021-08-30 15:43 ` Eli Zaretskii
2021-08-30 16:24 ` Perry E. Metzger
2021-08-30 14:29 ` André A. Gomes
2021-08-30 15:54 ` Eli Zaretskii
2021-08-30 20:12 ` André A. Gomes
2021-08-31 12:02 ` Eli Zaretskii
2021-09-01 17:50 ` Filipp Gunbin
2021-09-01 17:57 ` Eli Zaretskii
2021-09-01 20:33 ` Filipp Gunbin
2021-09-02 6:23 ` Eli Zaretskii
2021-09-02 6:34 ` tomas
2021-09-03 0:59 ` Michael Welsh Duggan
2021-09-03 6:10 ` tomas
2021-09-02 10:47 ` Filipp Gunbin [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=m2czprb6ed.fsf@fastmail.fm \
--to=fgunbin@fastmail.fm \
--cc=andremegafone@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=perry@piermont.com \
/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.