* Setting input method automatically whenever text is to be entered.
@ 2021-04-20 15:10 max.brieiev
2021-04-20 15:24 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-23 15:21 ` Alex Kost
0 siblings, 2 replies; 6+ messages in thread
From: max.brieiev @ 2021-04-20 15:10 UTC (permalink / raw)
To: help-gnu-emacs
Hi
I am quite new Emacs user. I prefer to type text using Dvorak
layout. Each time I visit new buffer or interact with minibuffer I have
to press C-\, which is rather inconvenient. So I added the following to
my .emacs file:
(defun set-dvp-input-method (mode-hook)
(add-hook mode-hook
(lambda ()
(if (not (string= current-input-method "programmer-dvorak"))
(set-input-method "programmer-dvorak")))))
(mapc #'set-dvp-input-method
'(text-mode-hook
prog-mode-hook
special-mode-hook
minibuffer-setup-hook
comint-mode-hook
dired-mode
info-mode-hook
term-mode-hook
Custom-mode-hook))
This works in most cases, however occasionally I still need to manually
switch to Dvorak input method with C-\ or add the major mode to the list
above, because too many major modes do not inherit from basic ones.
I wonder, is there a better way to automatically set input method
whenever my point is inside some editable area?
Basically what I want is to always enter text with Dvorak, however I am
too used to qwerty keybindings, so I don't want to change layout on OS
level.
There are also some more annoyances. In some minibuffer yes-no prompts I
have to press keys as they are located on qwerty layout, however in the
other seemingly same prompts the key needs to be pressed as on
Dvorak. Is there some way to fix this?
Thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting input method automatically whenever text is to be entered.
2021-04-20 15:10 Setting input method automatically whenever text is to be entered max.brieiev
@ 2021-04-20 15:24 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-20 15:39 ` max.brieiev
2021-04-23 15:21 ` Alex Kost
1 sibling, 1 reply; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-04-20 15:24 UTC (permalink / raw)
To: help-gnu-emacs
max.brieiev wrote:
> I am quite new Emacs user. I prefer to type text using
> Dvorak layout. Each time I visit new buffer or interact with
> minibuffer I have to press C-\, which is rather
> inconvenient. So I added the following to my .emacs file:
>
> (defun set-dvp-input-method (mode-hook)
> (add-hook mode-hook
> (lambda ()
> (if (not (string= current-input-method "programmer-dvorak"))
> (set-input-method "programmer-dvorak")))))
Okay, you need to set the keyboard layout in Emacs?
Did you check out `default-input-method'?
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting input method automatically whenever text is to be entered.
2021-04-20 15:10 Setting input method automatically whenever text is to be entered max.brieiev
2021-04-20 15:24 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-04-23 15:21 ` Alex Kost
2021-04-27 14:22 ` max.brieiev
1 sibling, 1 reply; 6+ messages in thread
From: Alex Kost @ 2021-04-23 15:21 UTC (permalink / raw)
To: help-gnu-emacs
max.brieiev@gmail.com (2021-04-20 18:10 +0300) wrote:
> Hi
Hello!
> I am quite new Emacs user. I prefer to type text using Dvorak
> layout. Each time I visit new buffer or interact with minibuffer I have
> to press C-\, which is rather inconvenient. So I added the following to
> my .emacs file:
>
> (defun set-dvp-input-method (mode-hook)
> (add-hook mode-hook
> (lambda ()
> (if (not (string= current-input-method "programmer-dvorak"))
> (set-input-method "programmer-dvorak")))))
>
> (mapc #'set-dvp-input-method
> '(text-mode-hook
> prog-mode-hook
> special-mode-hook
> minibuffer-setup-hook
> comint-mode-hook
> dired-mode
> info-mode-hook
> term-mode-hook
> Custom-mode-hook))
[...]
> There are also some more annoyances. In some minibuffer yes-no prompts I
> have to press keys as they are located on qwerty layout, however in the
> other seemingly same prompts the key needs to be pressed as on
> Dvorak. Is there some way to fix this?
You can use `after-change-major-mode-hook' instead of specifying all
those mode-hooks manually.
BTW, I also use Dvorak ;-)
--
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting input method automatically whenever text is to be entered.
2021-04-23 15:21 ` Alex Kost
@ 2021-04-27 14:22 ` max.brieiev
2021-05-07 14:20 ` Alex Kost
0 siblings, 1 reply; 6+ messages in thread
From: max.brieiev @ 2021-04-27 14:22 UTC (permalink / raw)
To: help-gnu-emacs
Alex Kost <alezost@gmail.com> writes:
> You can use `after-change-major-mode-hook' instead of specifying all
> those mode-hooks manually.
>
> BTW, I also use Dvorak ;-)
Thanks. This works great.
By the way, do you use (ansi-)term? When `term-mode` is in char mode
input method settings are ignored. Is there a workaround for this?
AFAIU in char mode all input is sent directly to the underlying shell
process, ignoring any key translations.
But maybe this can be fixed by some clever usage of hooks like
‘term-input-filter-functions’ or ‘term-input-sender’?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Setting input method automatically whenever text is to be entered.
2021-04-27 14:22 ` max.brieiev
@ 2021-05-07 14:20 ` Alex Kost
0 siblings, 0 replies; 6+ messages in thread
From: Alex Kost @ 2021-05-07 14:20 UTC (permalink / raw)
To: help-gnu-emacs
max.brieiev@gmail.com (2021-04-27 17:22 +0300) wrote:
> Alex Kost <alezost@gmail.com> writes:
>
>> You can use `after-change-major-mode-hook' instead of specifying all
>> those mode-hooks manually.
>>
>> BTW, I also use Dvorak ;-)
>
> Thanks. This works great.
>
> By the way, do you use (ansi-)term?
No, I use "M-x shell", so...
> When `term-mode` is in char mode
> input method settings are ignored. Is there a workaround for this?
>
> AFAIU in char mode all input is sent directly to the underlying shell
> process, ignoring any key translations.
>
> But maybe this can be fixed by some clever usage of hooks like
> ‘term-input-filter-functions’ or ‘term-input-sender’?
... I don't know, sorry :-(
--
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-05-07 14:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-20 15:10 Setting input method automatically whenever text is to be entered max.brieiev
2021-04-20 15:24 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-20 15:39 ` max.brieiev
2021-04-23 15:21 ` Alex Kost
2021-04-27 14:22 ` max.brieiev
2021-05-07 14:20 ` Alex Kost
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).