From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: quail-define-package and guidance string Date: Sat, 14 Oct 2023 11:39:23 +0300 Message-ID: <838r85simc.fsf@gnu.org> References: <87ttqymni1.fsf@zohomail.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39327"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 14 10:40:10 2023 Return-path: Envelope-to: geh-help-gnu-emacs@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 1qraBu-000A2U-21 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 14 Oct 2023 10:40:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qraBB-0008Kd-1w; Sat, 14 Oct 2023 04:39:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qraB9-0008KT-Sd for help-gnu-emacs@gnu.org; Sat, 14 Oct 2023 04:39:23 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qraB9-0006Go-Jw for help-gnu-emacs@gnu.org; Sat, 14 Oct 2023 04:39:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=psEzc/gxScww3HHMHQ7RRkoAljhQVOSfwv+vbqjOHuE=; b=qqnjpBOgSEl+WT/2teh7 VllF/kJ0WovHGpLi+CfQ/nelDWjILNc6TQL7g8WaxDqua5GJH1VLYCzKJkI5i6rHx1bNdFtBVc3RD qEMFw1Aj4EU6Cgba+pVZX4I8JZQ6ynAU2eXhBg7UY/x/wAI6Unv6xjEgtUGxmxoDArrPaYbrpQVT8 sv2hLbcjmx53q37oMldF0COG5pW96zzmtueDQNb2i5LHE3B6oSZsmKH4bxPXmi5MN86qdHpIo34Qg kIDrvvnubauOgmtQpRT+zk9/thjCtWHaMBPWvVJZuh1bnGGOPuM6MmOfvYgomsyZdc//4/Vzq3+bd 0C//G3R0fHlnGw==; In-Reply-To: <87ttqymni1.fsf@zohomail.eu> (message from Rahguzar on Tue, 10 Oct 2023 18:34:41 +0200) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145284 Archived-At: > From: Rahguzar > Date: Tue, 10 Oct 2023 18:34:41 +0200 > > I want to write and contribute to Emacs a couple of input methods for > Urdu. Looking around the already defined ones, it seems like > `quail-define-package` is the standard way to define these. One of the > input method uses phonetic transliteration. However Urdu has a bigger > alphabet than English and standard transliteration is quite lossy, so > there is a need to pick one of the translations and assign them to a key > and the others to a different key combination. As a result I want to > show such confusables in the echo area. It seems like it should be able > to use GUIDANCE arg of `quail-define-package` but setting it to an alist > has no effect for me. Specifically let say I have this code, > > (quail-define-package > "urdu-phonetic" "Urdu" "اردو صوتی" > `((?a . "a → ا , A → آ , ax → أ , u → ع")) > "Intuitive transliteration keyboard layout for Urdu." > nil t t t t nil nil nil nil nil t) > > (quail-define-rules > ("a" ?ا) > ("u" ?ع) > ("i" ?ئ) > ("A" ?آ) > ("ax" ?أ)) > > Evaluating it defines the `urdu-phonetic` input method and I activate > and use it to input the characters above. However if I type 'a' the echo > area shows 'a[x]' i.e. the default behavior if the GUIDANCE arg was 't' > and the alist I passed to it is just ignored. Am I missing something in > the doc string? And is what I am trying to do possible? Try (quail-define-package "urdu-phonetic" "Urdu" "اردو صوتی" '((?a . "a → ا , A → آ , ax → أ , u → ع")) "Intuitive transliteration keyboard layout for Urdu." nil t t t t nil nil nil nil nil t) > Another related question: I don't understand the meaning of string or > vector type as the second entry of an argument of quail-define-rules. The doc string says: TRANSLATION is a character, a string, a vector, a Quail map, or a function. If it is a character, it is the sole translation of KEY. If it is a string, each character is a candidate for the translation. If it is a vector, each element (string or character) is a candidate for the translation. This means that if TRANSLATION is a string of more than one character, each one of these characters is a candidate for translation. Emacs will display in the echo-area the possible candidates and assign one-character keys to select one of these candidates. Same if TRANSLATION is a vector of more than one character, as in [?a ?b ?c].