* bug#52245: Wishlist: cycle input methods
2021-12-07 17:11 ` Eli Zaretskii
@ 2021-12-08 9:40 ` Robert Pluim
2021-12-08 13:26 ` Eli Zaretskii
2021-12-11 14:31 ` John Ankarström
2021-12-23 18:02 ` Juri Linkov
2 siblings, 1 reply; 18+ messages in thread
From: Robert Pluim @ 2021-12-08 9:40 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: andremegafone, tor.a.s.kringeland, 52245
>>>>> On Tue, 07 Dec 2021 19:11:45 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> If weʼre now saying we want a separate command that cycles through a
>> list of input methods, then we might as well add a separate user
>> option for that list (and then we could add *another* user option
>> called input-method-toggle-or-cycle to indicate which command should
>> be used for C-\)
>>
>> I guess we could also have C-u C-u C-\ mean 'cycle', but thatʼs
>> unergonomic.
Eli> The use case that I have in mind is this: even if the user customized
Eli> the list of input methods to include more than just one, there could
Eli> be situations where the user needs to use just one input method when
Eli> typing. In such situations, it would be good to have a way of
Eli> toggling, like we do now, instead of cycling through all the other
Eli> methods.
Eli> Any reasonable solution to this use case would be welcome. I'm
Eli> working with systems which allow you to do something like that, and it
Eli> frequently annoys me to have to cycle through all the keyboard layouts
Eli> I defined, just to be able to toggle between US English and some other
Eli> language. So I wish that Emacs didn't have such an annoying problem,
Eli> if possible.
Hmm, so how about:
- default-input-method is an atom
⇒ C-\ behaves as a toggle
- default-input method is a list
⇒ C-\ cycles through them and back to nil
⇒ C-\ with a prefix arg behaves as today, prompting
for an input method. C-\ again deactivates the input method
- C-u C-u C-\ just unconditionally deactives the current input method,
regardless of the value of default-input-method. Or would 'any
negative prefix arg' suit better?
I now think having the history automatically be part of the list of
values to cycle through would not be a good idea: that history can get
large, and it can contain duplicates (by default), so trying to reach
the end of your default-input-method list could be annoying.
Robert
--
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-08 9:40 ` Robert Pluim
@ 2021-12-08 13:26 ` Eli Zaretskii
2021-12-08 13:44 ` Robert Pluim
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2021-12-08 13:26 UTC (permalink / raw)
To: Robert Pluim; +Cc: andremegafone, tor.a.s.kringeland, 52245
> From: Robert Pluim <rpluim@gmail.com>
> Cc: andremegafone@gmail.com, tor.a.s.kringeland@ntnu.no,
> 52245@debbugs.gnu.org
> Date: Wed, 08 Dec 2021 10:40:01 +0100
>
> Eli> The use case that I have in mind is this: even if the user customized
> Eli> the list of input methods to include more than just one, there could
> Eli> be situations where the user needs to use just one input method when
> Eli> typing. In such situations, it would be good to have a way of
> Eli> toggling, like we do now, instead of cycling through all the other
> Eli> methods.
>
> Eli> Any reasonable solution to this use case would be welcome. I'm
> Eli> working with systems which allow you to do something like that, and it
> Eli> frequently annoys me to have to cycle through all the keyboard layouts
> Eli> I defined, just to be able to toggle between US English and some other
> Eli> language. So I wish that Emacs didn't have such an annoying problem,
> Eli> if possible.
>
> Hmm, so how about:
>
> - default-input-method is an atom
> ⇒ C-\ behaves as a toggle
>
> - default-input method is a list
> ⇒ C-\ cycles through them and back to nil
> ⇒ C-\ with a prefix arg behaves as today, prompting
> for an input method. C-\ again deactivates the input method
Sounds good, but I don't understand how you will pull out the trick in
the last sentence. How will Emacs know to "just deactivate" instead
of cycling?
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-08 13:26 ` Eli Zaretskii
@ 2021-12-08 13:44 ` Robert Pluim
2021-12-08 14:29 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Robert Pluim @ 2021-12-08 13:44 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: andremegafone, tor.a.s.kringeland, 52245
>>>>> On Wed, 08 Dec 2021 15:26:05 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
>> Hmm, so how about:
>>
>> - default-input-method is an atom
>> ⇒ C-\ behaves as a toggle
>>
>> - default-input method is a list
>> ⇒ C-\ cycles through them and back to nil
>> ⇒ C-\ with a prefix arg behaves as today, prompting
>> for an input method. C-\ again deactivates the input method
Eli> Sounds good, but I don't understand how you will pull out the trick in
Eli> the last sentence. How will Emacs know to "just deactivate" instead
Eli> of cycling?
Similar to how it knows to toggle today, by storing an "I was
activated via prefix" state in a defvar-local state variable.
What did you think of the C-u C-u C-\ suggestion to mean "always
deactivate"? Or do you feel itʼs unnecessary?
Robert
--
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-08 13:44 ` Robert Pluim
@ 2021-12-08 14:29 ` Eli Zaretskii
2021-12-08 14:51 ` Robert Pluim
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2021-12-08 14:29 UTC (permalink / raw)
To: Robert Pluim; +Cc: andremegafone, tor.a.s.kringeland, 52245
> From: Robert Pluim <rpluim@gmail.com>
> Cc: andremegafone@gmail.com, tor.a.s.kringeland@ntnu.no,
> 52245@debbugs.gnu.org
> Date: Wed, 08 Dec 2021 14:44:25 +0100
>
> >>>>> On Wed, 08 Dec 2021 15:26:05 +0200, Eli Zaretskii <eliz@gnu.org> said:
>
> >> From: Robert Pluim <rpluim@gmail.com>
> >> Hmm, so how about:
> >>
> >> - default-input-method is an atom
> >> ⇒ C-\ behaves as a toggle
> >>
> >> - default-input method is a list
> >> ⇒ C-\ cycles through them and back to nil
> >> ⇒ C-\ with a prefix arg behaves as today, prompting
> >> for an input method. C-\ again deactivates the input method
>
> Eli> Sounds good, but I don't understand how you will pull out the trick in
> Eli> the last sentence. How will Emacs know to "just deactivate" instead
> Eli> of cycling?
>
> Similar to how it knows to toggle today, by storing an "I was
> activated via prefix" state in a defvar-local state variable.
Hmm... so just C-\ to activate is not enough to cause the toggle back?
> What did you think of the C-u C-u C-\ suggestion to mean "always
> deactivate"? Or do you feel itʼs unnecessary?
Given the above, some way of turning off the input method is
necessary, I think.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-08 14:29 ` Eli Zaretskii
@ 2021-12-08 14:51 ` Robert Pluim
0 siblings, 0 replies; 18+ messages in thread
From: Robert Pluim @ 2021-12-08 14:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: andremegafone, tor.a.s.kringeland, 52245
>>>>> On Wed, 08 Dec 2021 16:29:18 +0200, Eli Zaretskii <eliz@gnu.org> said:
>> From: Robert Pluim <rpluim@gmail.com>
Eli> Sounds good, but I don't understand how you will pull out the trick in
Eli> the last sentence. How will Emacs know to "just deactivate" instead
Eli> of cycling?
>>
>> Similar to how it knows to toggle today, by storing an "I was
>> activated via prefix" state in a defvar-local state variable.
Eli> Hmm... so just C-\ to activate is not enough to cause the toggle back?
No, because you need to distinguish "Iʼm cycling through
default-input-method" from "previous invocation used prefix", since in
the former you need to look up the current input method in
default-input-method and then activate the next one.
Hmm, what do we expect for the following sequence, assuming
default-input-method of '(a b c), and no input method activated.
1. C-\ ; activates a
2. C-u C-\ d RET ; activates d
3. C-\ ; back to a, I guess
4. C-\ ; activates b
Or do we want step 3 to be 'deactivate input method'?
>> What did you think of the C-u C-u C-\ suggestion to mean "always
>> deactivate"? Or do you feel itʼs unnecessary?
Eli> Given the above, some way of turning off the input method is
Eli> necessary, I think.
Escape hatches are always good, especially if we end up with confusing
behaviour :-)
Robert
--
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-07 17:11 ` Eli Zaretskii
2021-12-08 9:40 ` Robert Pluim
@ 2021-12-11 14:31 ` John Ankarström
2021-12-11 20:07 ` André A. Gomes
2021-12-23 18:02 ` Juri Linkov
2 siblings, 1 reply; 18+ messages in thread
From: John Ankarström @ 2021-12-11 14:31 UTC (permalink / raw)
To: 52245
Eli Zaretskii <eliz@gnu.org> writes:
> The use case that I have in mind is this: even if the user customized
> the list of input methods to include more than just one, there could
> be situations where the user needs to use just one input method when
> typing. In such situations, it would be good to have a way of
> toggling, like we do now, instead of cycling through all the other
> methods.
>
> Any reasonable solution to this use case would be welcome. I'm
> working with systems which allow you to do something like that, and it
> frequently annoys me to have to cycle through all the keyboard layouts
> I defined, just to be able to toggle between US English and some other
> language. So I wish that Emacs didn't have such an annoying problem,
> if possible.
IIRC Windows 10 handles this by implementing the input method list as a
stack of sorts, so that Win-Space selects an input method similarly to
how Alt-Tab selects a window. Pressing Win-Space once is a toggle, but
pressing Win-Space consecutively (while holding Win) cycles through all
input methods.
Emacs could do something similar. A single C-\ could toggle between the
two input methods at the top of the list, whereas any number of
consecutive C-\'s could cycle the list. The implementation would just
need to check last-command.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-11 14:31 ` John Ankarström
@ 2021-12-11 20:07 ` André A. Gomes
0 siblings, 0 replies; 18+ messages in thread
From: André A. Gomes @ 2021-12-11 20:07 UTC (permalink / raw)
To: John Ankarström; +Cc: 52245
John Ankarström <john@ankarstrom.se> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>> The use case that I have in mind is this: even if the user customized
>> the list of input methods to include more than just one, there could
>> be situations where the user needs to use just one input method when
>> typing. In such situations, it would be good to have a way of
>> toggling, like we do now, instead of cycling through all the other
>> methods.
>>
>> Any reasonable solution to this use case would be welcome. I'm
>> working with systems which allow you to do something like that, and it
>> frequently annoys me to have to cycle through all the keyboard layouts
>> I defined, just to be able to toggle between US English and some other
>> language. So I wish that Emacs didn't have such an annoying problem,
>> if possible.
>
> IIRC Windows 10 handles this by implementing the input method list as a
> stack of sorts, so that Win-Space selects an input method similarly to
> how Alt-Tab selects a window. Pressing Win-Space once is a toggle, but
> pressing Win-Space consecutively (while holding Win) cycles through all
> input methods.
>
> Emacs could do something similar. A single C-\ could toggle between the
> two input methods at the top of the list, whereas any number of
> consecutive C-\'s could cycle the list. The implementation would just
> need to check last-command.
Could be a possibility indeed.
Let me raise a concern on this topic. In Emacs, nil is what we call the
default OS-level IM (or the one dictated by the keyboard firmware). But
this presents an issue since it both means "the nil input method", which
in itself might be english-us, and that `default-input-method' is
unbound.
I propose thinking about what we have today (no IM cycling, just the
toggle) and see if we need changes before moving on with the more
general case.
Let's think about a simple case - using 2 IMs. Today you can't easily
go from input method A to B with C-\, unless either A or B is nil. This
is because `default-input-method' is a buffer-local variable, and it
changes as the user selects IMs.
I suggest that `default-input-method' should be set to "default" and
shouldn't be mutated. When already in use, fallback to the IM history
ring. Yes, this requires some re-writing.
--
André A. Gomes
"Free Thought, Free World"
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-07 17:11 ` Eli Zaretskii
2021-12-08 9:40 ` Robert Pluim
2021-12-11 14:31 ` John Ankarström
@ 2021-12-23 18:02 ` Juri Linkov
2021-12-23 18:27 ` Eli Zaretskii
2 siblings, 1 reply; 18+ messages in thread
From: Juri Linkov @ 2021-12-23 18:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: andremegafone, Robert Pluim, 52245, tor.a.s.kringeland
>> I guess we could also have C-u C-u C-\ mean 'cycle', but thatʼs
>> unergonomic.
>
> The use case that I have in mind is this: even if the user customized
> the list of input methods to include more than just one, there could
> be situations where the user needs to use just one input method when
> typing. In such situations, it would be good to have a way of
> toggling, like we do now, instead of cycling through all the other
> methods.
>
> Any reasonable solution to this use case would be welcome. I'm
> working with systems which allow you to do something like that, and it
> frequently annoys me to have to cycle through all the keyboard layouts
> I defined, just to be able to toggle between US English and some other
> language. So I wish that Emacs didn't have such an annoying problem,
> if possible.
I have the same problem that cycling more than 2 keyboard layouts
is annoying. It would be possible to avoid such a problem in Emacs
by using numeric prefix arguments, e.g.:
C-1 C-\ activates the first input methods in the list of input methods
C-2 C-\ second
C-3 C-\ third
...
C-0 C-\ deactivates the currently active input method
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-23 18:02 ` Juri Linkov
@ 2021-12-23 18:27 ` Eli Zaretskii
2021-12-23 18:45 ` Juri Linkov
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2021-12-23 18:27 UTC (permalink / raw)
To: Juri Linkov; +Cc: andremegafone, rpluim, 52245, tor.a.s.kringeland
> From: Juri Linkov <juri@linkov.net>
> Cc: Robert Pluim <rpluim@gmail.com>, andremegafone@gmail.com,
> tor.a.s.kringeland@ntnu.no, 52245@debbugs.gnu.org
> Date: Thu, 23 Dec 2021 20:02:33 +0200
>
> C-1 C-\ activates the first input methods in the list of input methods
> C-2 C-\ second
> C-3 C-\ third
> ...
> C-0 C-\ deactivates the currently active input method
The problem with this system is that the user needs to remember which
IM is the first and which the second.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#52245: Wishlist: cycle input methods
2021-12-23 18:27 ` Eli Zaretskii
@ 2021-12-23 18:45 ` Juri Linkov
0 siblings, 0 replies; 18+ messages in thread
From: Juri Linkov @ 2021-12-23 18:45 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: andremegafone, rpluim, 52245, tor.a.s.kringeland
>> C-1 C-\ activates the first input methods in the list of input methods
>> C-2 C-\ second
>> C-3 C-\ third
>> ...
>> C-0 C-\ deactivates the currently active input method
>
> The problem with this system is that the user needs to remember which
> IM is the first and which the second.
The user already needs to remember the sequence of configured keyboard layouts
to be able to cycle them without looking at the indicator of the current layout.
The problem that makes such cycling annoying is that when the user forgets
what is the current layout, cycling selects a wrong layout. Using a number
to select the layout avoids such a problem.
^ permalink raw reply [flat|nested] 18+ messages in thread