unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* quail-define-package and guidance string
@ 2023-10-10 16:34 Rahguzar
  2023-10-10 19:11 ` Emanuel Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rahguzar @ 2023-10-10 16:34 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
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?

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 states that in these cases a new quail map is generated
but I can't figure out what keys are bound on this map.

Thanks in advance,
Rahguzar



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: quail-define-package and guidance string
  2023-10-10 16:34 quail-define-package and guidance string Rahguzar
@ 2023-10-10 19:11 ` Emanuel Berg
  2023-10-14  8:39 ` Eli Zaretskii
  2023-10-15 13:07 ` James Thomas
  2 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2023-10-10 19:11 UTC (permalink / raw)
  To: help-gnu-emacs

Rahguzar wrote:

> 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 [...]

There should be quite a number of such alphabets. For some,
e.g. Swedish, there are just a few more chars (+3 compared to
the English 26) so one typically handles those with
a compose key.

Urdu has "40 distinct letters with no distinct letter
cases" [1] so maybe you can use the now vacant upcase letters
to handle the surplus chars?

Good luck!

[1] https://en.wikipedia.org/wiki/Urdu_alphabet

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: quail-define-package and guidance string
  2023-10-10 16:34 quail-define-package and guidance string Rahguzar
  2023-10-10 19:11 ` Emanuel Berg
@ 2023-10-14  8:39 ` Eli Zaretskii
  2023-10-15 13:07 ` James Thomas
  2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2023-10-14  8:39 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Rahguzar <rahguzar@zohomail.eu>
> 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].



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: quail-define-package and guidance string
  2023-10-10 16:34 quail-define-package and guidance string Rahguzar
  2023-10-10 19:11 ` Emanuel Berg
  2023-10-14  8:39 ` Eli Zaretskii
@ 2023-10-15 13:07 ` James Thomas
  2 siblings, 0 replies; 4+ messages in thread
From: James Thomas @ 2023-10-15 13:07 UTC (permalink / raw)
  To: Rahguzar; +Cc: help-gnu-emacs

Rahguzar wrote:

> Hi,
> 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?

My guess: It was probably meant that:

   If it is an alist, the element has the form (CHAR . STRING). Each
   character in the current key is searched in the list and the
   corresponding string is shown *in its place*.

I don't think that the program meant to allow you to display arbitrary
strings.

--



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-15 13:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10 16:34 quail-define-package and guidance string Rahguzar
2023-10-10 19:11 ` Emanuel Berg
2023-10-14  8:39 ` Eli Zaretskii
2023-10-15 13:07 ` James Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).