* Questions about Quail
@ 2022-07-17 4:56 Visuwesh
2022-07-17 6:43 ` Visuwesh
2022-07-23 4:21 ` James Thomas
0 siblings, 2 replies; 11+ messages in thread
From: Visuwesh @ 2022-07-17 4:56 UTC (permalink / raw)
To: emacs-devel
I'm currently writing an input method that mirrors the Tamil99 keyboard
layout, and have two questions about Quail.
1. Is there a per-input-method activation hook? I know there's the
general input-method-activate-hook but I want a hook that will be
run whenever a specific input method activates. I can check for
the current-input-method value in the hook but before I go do it,
I wanted to know if I missed something obvious when reading the
Quail docs.
The reason I ask this is because the Tamil99 keyboard layout has
a state to keep track of. I want to reset this state whenever
one activates the input method to avoid surprises.
2. Currently the quail-keyboard-layout-standard resembles the VT100
keyboard layout, can we change it to resemble the US Qwerty
layout instead? This is not a problem when writing a new Quail
keyboard layout in quail-keyboard-layout-alist but it is a
problem when the keyboard layout is printed.
Evaluate (quail-insert-kbd-layout quail-keyboard-layout-standard)
and check the keyboard printed out. I doubt anyone uses a VT100
terminal these days, printing out a US Qwerty keyboard layout IMO
would be less confusing _and_ more helpful for the users.
While we are it, we can also add modern keyboard layouts like
US Dvorak to quail-keyboard-layout-alist. I can volunteer to do
this work.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-17 4:56 Questions about Quail Visuwesh
@ 2022-07-17 6:43 ` Visuwesh
2022-07-23 4:21 ` James Thomas
1 sibling, 0 replies; 11+ messages in thread
From: Visuwesh @ 2022-07-17 6:43 UTC (permalink / raw)
To: emacs-devel
[ஞாயிறு ஜூலை 17, 2022] Visuwesh wrote:
> 2. Currently the quail-keyboard-layout-standard resembles the VT100
> keyboard layout, can we change it to resemble the US Qwerty
> layout instead? This is not a problem when writing a new Quail
> keyboard layout in quail-keyboard-layout-alist but it is a
> problem when the keyboard layout is printed.
Hmm, maybe it is better to let the sleeping dogs lie and put with the
confusing keyboard representation... It seems easy to change the
quail-keyboard-layout-standard to a US Qwerty keyboard layout but since
I don't have any of the other keyboards defined in the alist to test, I
don't think I should touch it.
BTW, if you want a print of these keyboard, you can ask xkb:
% setxkbmap gb -option -geometry 'pc(pc105)' -print |xkbcomp - - |xkbprint -label symbols - pc105-uk.ps
% setxkbmap de -option -geometry 'pc(pc102)' -print |xkbcomp - - |xkbprint -label symbols - pc102-de.ps
I can send these postscript files if you're interested.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-17 4:56 Questions about Quail Visuwesh
2022-07-17 6:43 ` Visuwesh
@ 2022-07-23 4:21 ` James Thomas
2022-07-23 7:31 ` Visuwesh
1 sibling, 1 reply; 11+ messages in thread
From: James Thomas @ 2022-07-23 4:21 UTC (permalink / raw)
To: Visuwesh; +Cc: emacs-devel
Visuwesh wrote:
> 1. Is there a per-input-method activation hook?
Not that I know of.
> The reason I ask this is because the Tamil99 keyboard layout has
> a state to keep track of. I want to reset this state whenever
> one activates the input method to avoid surprises.
Are you sure that you actually need state? Assuming you're using the
rules from [1], couldn't you just add a rule for mapping, say, the
string "^#12#" to the half fraction?
1. http://www.tamilvu.org/tkbd/doc_file/Help_Linux.pdf
--
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-23 4:21 ` James Thomas
@ 2022-07-23 7:31 ` Visuwesh
2022-07-23 7:55 ` James Thomas
0 siblings, 1 reply; 11+ messages in thread
From: Visuwesh @ 2022-07-23 7:31 UTC (permalink / raw)
To: James Thomas; +Cc: emacs-devel
[சனி ஜூலை 23, 2022] James Thomas wrote:
> Visuwesh wrote:
>
>> 1. Is there a per-input-method activation hook?
>
> Not that I know of.
Figured.
>> The reason I ask this is because the Tamil99 keyboard layout has
>> a state to keep track of. I want to reset this state whenever
>> one activates the input method to avoid surprises.
>
> Are you sure that you actually need state? Assuming you're using the
> rules from [1], couldn't you just add a rule for mapping, say, the
> string "^#12#" to the half fraction?
Unfortunately, yes. The problem isn't from the fractions which are
simple translation rules but from the rules 5, 6 and 7. See p. 21 from
the PDF you linked.
>
> 1. http://www.tamilvu.org/tkbd/doc_file/Help_Linux.pdf
>
> --
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-23 7:31 ` Visuwesh
@ 2022-07-23 7:55 ` James Thomas
2022-07-23 8:21 ` Visuwesh
0 siblings, 1 reply; 11+ messages in thread
From: James Thomas @ 2022-07-23 7:55 UTC (permalink / raw)
To: Visuwesh; +Cc: emacs-devel
Visuwesh wrote:
>> Are you sure that you actually need state? Assuming you're using the
>> rules from [1], couldn't you just add a rule for mapping, say, the
>> string "^#12#" to the half fraction?
>
> Unfortunately, yes. The problem isn't from the fractions which are
> simple translation rules but from the rules 5, 6 and 7. See p. 21 from
> the PDF you linked.
Reading rule 5, it seems to me that separate mappings for "h" and "hh"
should do the trick. For rule 6, you could map "ha" also. For 7, map
also all combinations of soft and hard consonants.
--
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-23 7:55 ` James Thomas
@ 2022-07-23 8:21 ` Visuwesh
2022-07-23 8:38 ` Visuwesh
0 siblings, 1 reply; 11+ messages in thread
From: Visuwesh @ 2022-07-23 8:21 UTC (permalink / raw)
To: James Thomas; +Cc: emacs-devel
[சனி ஜூலை 23, 2022] James Thomas wrote:
> Visuwesh wrote:
>
>>> Are you sure that you actually need state? Assuming you're using the
>>> rules from [1], couldn't you just add a rule for mapping, say, the
>>> string "^#12#" to the half fraction?
>>
>> Unfortunately, yes. The problem isn't from the fractions which are
>> simple translation rules but from the rules 5, 6 and 7. See p. 21 from
>> the PDF you linked.
>
> Reading rule 5, it seems to me that separate mappings for "h" and "hh"
> should do the trick. For rule 6, you could map "ha" also. For 7, map
> also all combinations of soft and hard consonants.
>
I considered that but the implementation that I used as a reference was
this web one https://wk.w3tamil.com/ which considers not the keystrokes
but the character before point. That made more sense to me as well so I
decided to implement these rules in the update-translation function.
In that web keyboard, try typing hj (கப) then backspace (க) and type h
again: you will get க்க. This feels a lot more typo resilient than
making hh insert க்க.
In any case, if a Tamil speaker is reading this and are familiar with
this keyboard layout, can you try out https://github.com/vizs/tamil99?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-23 8:21 ` Visuwesh
@ 2022-07-23 8:38 ` Visuwesh
2022-07-23 9:02 ` Visuwesh
0 siblings, 1 reply; 11+ messages in thread
From: Visuwesh @ 2022-07-23 8:38 UTC (permalink / raw)
To: James Thomas; +Cc: emacs-devel
[சனி ஜூலை 23, 2022] Visuwesh wrote:
> [சனி ஜூலை 23, 2022] James Thomas wrote:
>
>> Visuwesh wrote:
>>
>>>> Are you sure that you actually need state? Assuming you're using the
>>>> rules from [1], couldn't you just add a rule for mapping, say, the
>>>> string "^#12#" to the half fraction?
>>>
>>> Unfortunately, yes. The problem isn't from the fractions which are
>>> simple translation rules but from the rules 5, 6 and 7. See p. 21 from
>>> the PDF you linked.
>>
>> Reading rule 5, it seems to me that separate mappings for "h" and "hh"
>> should do the trick. For rule 6, you could map "ha" also. For 7, map
>> also all combinations of soft and hard consonants.
>>
>
> I considered that but the implementation that I used as a reference was
> this web one https://wk.w3tamil.com/ which considers not the keystrokes
> but the character before point. That made more sense to me as well so I
> decided to implement these rules in the update-translation function.
The ibus input method does not care about the character before point, it
only checks the keystrokes hmm... I will wait for user feedback™ to
decide which is better.
> In that web keyboard, try typing hj (கப) then backspace (க) and type h
> again: you will get க்க.
I.e., whilst you get க்க in my input method, you get கக in the ibus one.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-23 8:38 ` Visuwesh
@ 2022-07-23 9:02 ` Visuwesh
2022-07-23 11:38 ` James Thomas
0 siblings, 1 reply; 11+ messages in thread
From: Visuwesh @ 2022-07-23 9:02 UTC (permalink / raw)
To: James Thomas; +Cc: emacs-devel
[ Sorry for the noise. I should have checked all this at once but hey I
am an idiot. ]
> The ibus input method does not care about the character before point, it
> only checks the keystrokes hmm... I will wait for user feedback™ to
> decide which is better.
I did a very quick test of tamil99 keyboard layout in MS Windows 10 (I
think) and it does what I do i.e., consider the character before point
rather than the keystrokes. So the implementation varies a lot and
everyone decides for themselves what the best choice is so I will too. :P
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-23 9:02 ` Visuwesh
@ 2022-07-23 11:38 ` James Thomas
2022-07-23 12:19 ` Visuwesh
0 siblings, 1 reply; 11+ messages in thread
From: James Thomas @ 2022-07-23 11:38 UTC (permalink / raw)
To: Visuwesh; +Cc: emacs-devel
Visuwesh wrote:
> [சனி ஜூலை 23, 2022] Visuwesh wrote:
>
>> [சனி ஜூலை 23, 2022] James Thomas wrote:
>>
>>> Visuwesh wrote:
>>>
>>>>> Are you sure that you actually need state? Assuming you're using the
>>>>> rules from [1], couldn't you just add a rule for mapping, say, the
>>>>> string "^#12#" to the half fraction?
>>>>
>>>> Unfortunately, yes. The problem isn't from the fractions which are
>>>> simple translation rules but from the rules 5, 6 and 7. See p. 21 from
>>>> the PDF you linked.
>>>
>>> Reading rule 5, it seems to me that separate mappings for "h" and "hh"
>>> should do the trick. For rule 6, you could map "ha" also. For 7, map
>>> also all combinations of soft and hard consonants.
>>>
>>
>> I considered that but the implementation that I used as a reference was
>> this web one https://wk.w3tamil.com/ which considers not the keystrokes
>> but the character before point. That made more sense to me as well so I
>> decided to implement these rules in the update-translation function.
>
> The ibus input method does not care about the character before point, it
> only checks the keystrokes hmm... I will wait for user feedback™ to
> decide which is better.
>
>> In that web keyboard, try typing hj (கப) then backspace (க) and type h
>> again: you will get க்க.
>
> I.e., whilst you get க்க in my input method, you get கக in the ibus
> one.
Hmm. One possible solution (albeit a bit complicated), to get the
non-ibus behaviour, is to use the update-translation-function to never
end a translation that reaches up to the last 2 input characters: ie
keep the input pending (unless the last one is not any of the valid
input characters), and programatically insert the translation of any
remaining input character beyond the control-flag.
But that would work for only one level of backspace. If you have a
simpler implementation with the use of state (or checking the character
before point directly?) that might be better.
> I did a very quick test of tamil99 keyboard layout in MS Windows 10 (I
> think) and it does what I do i.e., consider the character before point
> rather than the keystrokes. So the implementation varies a lot and
> everyone decides for themselves what the best choice is so I will too. :P
OK. :)
--
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-23 11:38 ` James Thomas
@ 2022-07-23 12:19 ` Visuwesh
2022-07-23 13:29 ` James Thomas
0 siblings, 1 reply; 11+ messages in thread
From: Visuwesh @ 2022-07-23 12:19 UTC (permalink / raw)
To: James Thomas; +Cc: emacs-devel
[சனி ஜூலை 23, 2022] James Thomas wrote:
>> The ibus input method does not care about the character before point, it
>> only checks the keystrokes hmm... I will wait for user feedback™ to
>> decide which is better.
>>
>>> In that web keyboard, try typing hj (கப) then backspace (க) and type h
>>> again: you will get க்க.
>>
>> I.e., whilst you get க்க in my input method, you get கக in the ibus
>> one.
>
> Hmm. One possible solution (albeit a bit complicated), to get the
> non-ibus behaviour, is to use the update-translation-function to never
> end a translation that reaches up to the last 2 input characters: ie
> keep the input pending (unless the last one is not any of the valid
> input characters), and programatically insert the translation of any
> remaining input character beyond the control-flag.
>
> But that would work for only one level of backspace. If you have a
> simpler implementation with the use of state (or checking the character
> before point directly?) that might be better.
Yep, checking the character before point is the easiest solution. I
tried to keep track of the last character inputted but that quickly got
hairy and unnecessarily complicated. The current update-translation-function
checks the character before point and the key that was pressed to set
the quail-current-string appropriately.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Questions about Quail
2022-07-23 12:19 ` Visuwesh
@ 2022-07-23 13:29 ` James Thomas
0 siblings, 0 replies; 11+ messages in thread
From: James Thomas @ 2022-07-23 13:29 UTC (permalink / raw)
To: Visuwesh; +Cc: emacs-devel
Visuwesh wrote:
> Yep, checking the character before point is the easiest solution. I
> tried to keep track of the last character inputted but that quickly got
> hairy and unnecessarily complicated. The current update-translation-function
> checks the character before point and the key that was pressed to set
> the quail-current-string appropriately.
Thanks for the info.
--
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-07-23 13:29 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-17 4:56 Questions about Quail Visuwesh
2022-07-17 6:43 ` Visuwesh
2022-07-23 4:21 ` James Thomas
2022-07-23 7:31 ` Visuwesh
2022-07-23 7:55 ` James Thomas
2022-07-23 8:21 ` Visuwesh
2022-07-23 8:38 ` Visuwesh
2022-07-23 9:02 ` Visuwesh
2022-07-23 11:38 ` James Thomas
2022-07-23 12:19 ` Visuwesh
2022-07-23 13:29 ` James Thomas
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).