unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43084: toggle-korean-input-method, Korean with Dvorak
@ 2020-08-28  9:41 L.J. Lee
  2020-08-28 13:04 ` 황병희
  2021-01-27  6:33 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: L.J. Lee @ 2020-08-28  9:41 UTC (permalink / raw)
  To: 43084

[-- Attachment #1: Type: text/plain, Size: 2288 bytes --]

Hi, I hope this finds you well! I have recently started using Emacs and
wanted to alert you to a really bedevilling problem I had with Korean input
and input method toggling, how I solved it, and suggestions for improving
it.

Long story short, I use the 3-beol-sik final layout (designated as
korean-hangul3f on the emacs system) to type Korean and set it as my
default input method in
init.el.

I was  puzzled, however, that my Korean layout
reverted to the more common 2-beol-sik (korean-hangul) whenever I
pressed S-SPC. C-\ would work to switch my layout correctly, but
pressing S-SPC even once to toggle to Korean layout would change the
default layout to korean-hangul and necessitate a manual change back to
korean-hangul3f
using M-x set-input-method.

I found out through language-info-alist that S-SPC is
bound to toggle-korean-input-method, and used the function query to
track this function to korea-util.el under lisp/language.

As expected, the toggle-korean-input-method function set the
default input method to korean-hangul regardless of user settings, so I
redefined it from init.el to set the default-korean-keyboard as
korean-hangul3f. Here's the code I used:

(with-eval-after-load "language/korea-util"
(defun toggle-korean-input-method ()
"Turn on or off a Korean text input method for the current butter."
(interactive)
(if current-input-method
    (deactivate-input-method)
    (activate-input-method)
        (concat "korean-hangul3f" default-korean-keyboard)))))

This worked, but it took me a lot of time, frustration, and a crash course
on the
workings of Emacs. It seems to me the much more logical way for this
function to work is to look for any relevant user configurations
and setting the layout accordingly rather than statically setting the Korean
layout.

All this was after I had to redefine a different function because Korean
layouts were not compatible with Dvorak layout, which I solved with the
help of the patch  here: https://blog.jamzattack.xyz/emacs-hangul-input.html
Updating hangul.el as described there would solve the Dvorak-Korean
incompatibility.

I hope these suggestions will help in improving Emacs, which despite my
short usage and the problems I ran into is a great, versatile
program. Keep up the good work!

With regards,

L.J.

[-- Attachment #2: Type: text/html, Size: 2558 bytes --]

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

* bug#43084: toggle-korean-input-method, Korean with Dvorak
  2020-08-28  9:41 bug#43084: toggle-korean-input-method, Korean with Dvorak L.J. Lee
@ 2020-08-28 13:04 ` 황병희
  2021-01-27  6:33 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: 황병희 @ 2020-08-28 13:04 UTC (permalink / raw)
  To: L.J. Lee; +Cc: jihyun.jo, 43084

X-Debbugs-CC: jihyun.jo@gmail.com

"L.J. Lee" <lj.is.writing@gmail.com> writes:

> Hi, I hope this finds you well! I have recently started using Emacs and wanted to alert you to a really bedevilling
> problem I had with Korean input and input method toggling, how I solved it, and suggestions for improving it.
>
> Long story short, I use the 3-beol-sik final layout (designated as korean-hangul3f on the emacs system) to type
> Korean and set it as my default input method in
> init.el.
>
> I was  puzzled, however, that my Korean layout
> reverted to the more common 2-beol-sik (korean-hangul) whenever I
> pressed S-SPC. C-\ would work to switch my layout correctly, but
> pressing S-SPC even once to toggle to Korean layout would change the
> default layout to korean-hangul and necessitate a manual change back to korean-hangul3f
> using M-x set-input-method.
>
> I found out through language-info-alist that S-SPC is
> bound to toggle-korean-input-method, and used the function query to
> track this function to korea-util.el under lisp/language.
>
> As expected, the toggle-korean-input-method function set the
> default input method to korean-hangul regardless of user settings, so I
> redefined it from init.el to set the default-korean-keyboard as
> korean-hangul3f. Here's the code I used:
>
> (with-eval-after-load "language/korea-util"
> (defun toggle-korean-input-method ()
> "Turn on or off a Korean text input method for the current butter."
> (interactive)
> (if current-input-method
>     (deactivate-input-method)
>     (activate-input-method)
>         (concat "korean-hangul3f" default-korean-keyboard)))))
>
> This worked, but it took me a lot of time, frustration, and a crash course on the
> workings of Emacs. It seems to me the much more logical way for this
> function to work is to look for any relevant user configurations
> and setting the layout accordingly rather than statically setting the Korean
> layout.
>
> All this was after I had to redefine a different function because Korean
> layouts were not compatible with Dvorak layout, which I solved with the
> help of the patch  here: https://blog.jamzattack.xyz/emacs-hangul-input.html Updating hangul.el as described there
> would solve the Dvorak-Korean incompatibility.
>
> I hope these suggestions will help in improving Emacs, which despite my
> short usage and the problems I ran into is a great, versatile
> program. Keep up the good work!
>
> With regards,
>
> L.J.

IMHO, i think we need to confirm of Jihyun(KLDP: sylphong) -- the author
of korean-input-method in GNU Emacs [1].

Sincerely, Byung-Hee

[1] https://kldp.org/node/91578

-- 
^고맙습니다 _布德天下_ 감사합니다_^))//





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

* bug#43084: toggle-korean-input-method, Korean with Dvorak
  2020-08-28  9:41 bug#43084: toggle-korean-input-method, Korean with Dvorak L.J. Lee
  2020-08-28 13:04 ` 황병희
@ 2021-01-27  6:33 ` Lars Ingebrigtsen
  2021-01-29  4:54   ` L.J. Lee
  1 sibling, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-27  6:33 UTC (permalink / raw)
  To: L.J. Lee; +Cc: 43084

"L.J. Lee" <lj.is.writing@gmail.com> writes:

> I was  puzzled, however, that my Korean layout
> reverted to the more common 2-beol-sik (korean-hangul) whenever I
> pressed S-SPC. C-\ would work to switch my layout correctly, but
> pressing S-SPC even once to toggle to Korean layout would change the
> default layout to korean-hangul and necessitate a manual change back to
> korean-hangul3f
> using M-x set-input-method.
>
> I found out through language-info-alist that S-SPC is
> bound to toggle-korean-input-method, and used the function query to
> track this function to korea-util.el under lisp/language.
>
> As expected, the toggle-korean-input-method function set the
> default input method to korean-hangul regardless of user settings, so I
> redefined it from init.el to set the default-korean-keyboard as
> korean-hangul3f. Here's the code I used:
>
> (with-eval-after-load "language/korea-util"
> (defun toggle-korean-input-method ()
> "Turn on or off a Korean text input method for the current butter."
> (interactive)
> (if current-input-method
>     (deactivate-input-method)
>     (activate-input-method)
>         (concat "korean-hangul3f" default-korean-keyboard)))))

I don't use the Korean input methods, so this is totally uninformed --
but looking at the code, your alteration seems to be the same as putting

(setq default-korean-keyboard "3f")

in your init file?

In which case configuring this is already supported in Emacs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43084: toggle-korean-input-method, Korean with Dvorak
  2021-01-27  6:33 ` Lars Ingebrigtsen
@ 2021-01-29  4:54   ` L.J. Lee
  2021-01-29  5:08     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: L.J. Lee @ 2021-01-29  4:54 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43084


Lars Ingebrigtsen writes:

> "L.J. Lee" <lj.is.writing@gmail.com> writes:
>
>> I was  puzzled, however, that my Korean layout
>> reverted to the more common 2-beol-sik (korean-hangul) whenever I
>> pressed S-SPC. C-\ would work to switch my layout correctly, but
>> pressing S-SPC even once to toggle to Korean layout would change the
>> default layout to korean-hangul and necessitate a manual change back to
>> korean-hangul3f
>> using M-x set-input-method.
>>
>> I found out through language-info-alist that S-SPC is
>> bound to toggle-korean-input-method, and used the function query to
>> track this function to korea-util.el under lisp/language.
>>
>> As expected, the toggle-korean-input-method function set the
>> default input method to korean-hangul regardless of user settings, so I
>> redefined it from init.el to set the default-korean-keyboard as
>> korean-hangul3f. Here's the code I used:
>>
>> (with-eval-after-load "language/korea-util"
>> (defun toggle-korean-input-method ()
>> "Turn on or off a Korean text input method for the current butter."
>> (interactive)
>> (if current-input-method
>>     (deactivate-input-method)
>>     (activate-input-method)
>>         (concat "korean-hangul3f" default-korean-keyboard)))))
>
> I don't use the Korean input methods, so this is totally uninformed --
> but looking at the code, your alteration seems to be the same as putting
>
> (setq default-korean-keyboard "3f")
>
> in your init file?
>
> In which case configuring this is already supported in Emacs.

It doesn't, actually--your suggested method was what I tried at first,
because it's the normal way to do things.
However, my setting didn't survive the first time I tried to
switch between Korean and English using S-SPC because doing so triggered
toggle-korean-input-method, which overrode my default-korean-keyboard
setting (korean-hangul3f) and reset it to korean-hangul instead.

Long story short, the toggle-korean-input-method is written to
override user settings which is just Bad Code and should be changed.

(Most Korean keyboard users wouldn't even notice, by the way, because
most use korean-hangul and korean-hangul3f is a minority layout.
It's probably why this error survived so long.)

Regards,
-- 
L.J. Lee
Mastodon account: https://rage.love/@ljwrites
Dreamwidth blog: https://lj_writes.dreamwidth.org





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

* bug#43084: toggle-korean-input-method, Korean with Dvorak
  2021-01-29  4:54   ` L.J. Lee
@ 2021-01-29  5:08     ` Lars Ingebrigtsen
       [not found]       ` <87pn1my3fp.fsf@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-29  5:08 UTC (permalink / raw)
  To: L.J. Lee; +Cc: 43084

"L.J. Lee" <lj.is.writing@gmail.com> writes:

>>> (with-eval-after-load "language/korea-util"
>>> (defun toggle-korean-input-method ()
>>> "Turn on or off a Korean text input method for the current butter."
>>> (interactive)
>>> (if current-input-method
>>>     (deactivate-input-method)
>>>     (activate-input-method)
>>>         (concat "korean-hangul3f" default-korean-keyboard)))))
>>
>> I don't use the Korean input methods, so this is totally uninformed --
>> but looking at the code, your alteration seems to be the same as putting
>>
>> (setq default-korean-keyboard "3f")
>>
>> in your init file?
>>
>> In which case configuring this is already supported in Emacs.
>
> It doesn't, actually--your suggested method was what I tried at first,
> because it's the normal way to do things.

I'm just reading the code, and I don't quite understand why.
`default-korean-keyboard' is (by default) "", so this:

(defun toggle-korean-input-method ()
  "Turn on or off a Korean text input method for the current buffer."
  (interactive)
  (if current-input-method
      (deactivate-input-method)
    (activate-input-method
     (concat "korean-hangul" default-korean-keyboard))))

means that we call

(activate-input-method "korean-hangul")

If `default-korean-keyboard' was "3f", then we'd call

(activate-input-method "korean-hangul3f")

You suggested this change:

>>>     (activate-input-method)
>>>         (concat "korean-hangul3f" default-korean-keyboard)))))

and assuming that ")" after `activate-input-method' is a typo, that
would mean that we call

(activate-input-method "korean-hangul3f")

which is identical to what we'd get if we set the variable to "3f".

Or am I misreading the code or what you suggested?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43084: toggle-korean-input-method, Korean with Dvorak
       [not found]       ` <87pn1my3fp.fsf@gmail.com>
@ 2021-01-31  7:13         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-31  7:13 UTC (permalink / raw)
  To: L.J. Lee; +Cc: 43084

"L.J. Lee" <lj.is.writing@gmail.com> writes:

> So I changed my settings to test this and you were right!
>
>> (setq default-korean-keyboard "3f")
>
> worked without having to change the toggle-korean-input-method function.

Thanks for testing.

> However, now I think there's a problem of documentation and
> discoverability.

Yup.  I've now mentioned the variable in the doc strings of all the
functions that use the variable, which should allow it to be discovered
more easily.





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

end of thread, other threads:[~2021-01-31  7:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28  9:41 bug#43084: toggle-korean-input-method, Korean with Dvorak L.J. Lee
2020-08-28 13:04 ` 황병희
2021-01-27  6:33 ` Lars Ingebrigtsen
2021-01-29  4:54   ` L.J. Lee
2021-01-29  5:08     ` Lars Ingebrigtsen
     [not found]       ` <87pn1my3fp.fsf@gmail.com>
2021-01-31  7:13         ` Lars Ingebrigtsen

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).