all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Weirdness with Input Method/quail : how to figure out source of it?
@ 2013-08-14 12:42 Vladimir Lomov
  2013-08-15 20:59 ` Alex Kost
  0 siblings, 1 reply; 11+ messages in thread
From: Vladimir Lomov @ 2013-08-14 12:42 UTC (permalink / raw
  To: help-gnu-emacs

Hello,
I need advice how to solve or find out source of my weird problem with Input Method. I apologize
for long description but I think it might help.

My setup:
- two languages: English and Russian;
- standard QWERTY keyboard, *but* DVORAK layout for both terminal and X;
- standard Russian layout (ЙЦУКЕН).

Due to DVORAK layout English letters shown on screen don't coincide with letters on pressed
keys, for example pressing keys with letters
  qwerty
on keyboard gives on screen
  ',.pyf

* Problem 0

If layout were QWERTY and one uses 'russian-computer' Input Method then letters on keys and
typed symbols, both English and Russian, are coincide. For instance, some part of QWERTY
keyboard:

  +-------+-------+-------+-------+-------+-------+
  | Q     | W     | E     | R     | T     | Y     |...
  |       |       |       |       |       |       |
  |     Й |     Ц |     У |     К |     Е |     Н |...
  +-------+-------+-------+-------+-------+-------+

(Input Method 'russian-computer' is defined by leim/quail.)

But if layout is DVORAK then pressing keys with letters QWERTY give
  ',.pyf
so 'russian-computer' gives wrong result.

To get correct output for Russian I decided to define new keyboard layout ('dvorak-classic') for
quail (this is not my discovery I found it on emacswiki.org).

So problem 0: how to enter Russian letters as they are depicted on keyboard using dvorak layout?
This problem is solved by means of new keyboard layout 'dvorak-classic'.

But this solution rises another weird problem. Looking ahead I must say that I notice this
problem about 4-6 months ago while I use this setup (dvorak layout) for more than a year.

* Problem 1

Sometimes, when writing text on Russian, pressing on keys with punctuation symbols gives
(Russian) letters instead. This effect comes not always, but to get desired punctuation symbol I
have to either switch twice Input Method (C-\ C-\) or move one character back or line up then
return to the same point and enter the symbol (press the same key). Other oddities:
- pressing in sequence the same key gives the same wrong letter;
- I may press SPACE, then delete it, delete wrong letter and press the key again, and again get
  wrong letter;
- if I don't fix wrong letter and continue to type text further (space and press keys with
  Russian letters), all letters are ok until next punctuation symbol.

Why I call it "weird" problem: because it comes not always, it is very sporadic. It doesn't
depend if I run Emacs with my settings or without any (emacs -Q), in terminal (tty) or in
graphical environment (X). (The only difference I noticed when I checked Emacs running with my
settings and without any is that with my settings problem comes more quickly.) The other
dependency I noticed: when I type text quickly or if system is slow (one of my computer is
relatively old notebook) then effect comes earlier.

So the question is: how to "debug" this problem? Is there any option in Emacs to record what
functions are called to figure out why symbols are changed?

* Details on this problem

I wasn't able to prepare small/minimal working (unworking) example (actually that's why I ask how
to "debug") so I describe symptoms: when I want to enter punctuation symbols (comma [,], point
[.], colon [:], semicolon [;], dash [-], single quote ['], double quote ["]) while typing
Russian text I press keys with corresponding symbols (Russian layout) but instead of punctuation
symbols I get:

  . -> у
  , -> ц
  : -> Я
  ; -> я
  ' -> й
  " -> Й
  - -> э

I think there are double "tranformation" (by quail). Why I think so? For example, to get [,] I
press key on QWERTY keyboard:

  +--------+
  | ?    , |
  |        |
  | /    . |
  +--------+
    Q    R

(here Q means QWERTY keyboard and QWERTY layout, while R means Russian layout) but in DVORAK
layout the same key gives zZ:

  +--------+
  | Z    , |
  |        |
  | z    . |
  +--------+
    D    R

In quail 'dvorak' layout there is mapping (transformation):

  z -> .
  Z -> ,

On the other hand, these punctuation symbols on DVORAK layout comes with following Russian
letters:

  +--------+--------+
  | <    Ц | >    У |
  |        |        |
  | ,    ц | .    у |
  +--------+--------+
    D    R   D    R

That why I think there is double transformation: when I enter [z|Z] quail transforms it to [.|,]
but (this is my suspicion) for some reason quail continues transformation taking new symbol as
input.

To figure out the reason why this is happening I need to know how quail works 'under the
hood'. Is it possible?

Page on EmacsWiki:
http://www.emacswiki.org/emacs/WritingRussianWithDvorak

My variant of quail 'dvorak' layout:
https://raw.github.com/vp1981/scripts/master/emacs.d/misc/quail-dvorak.el


P.S. Please keep me in CC, I'm not subscribed to this ML.

---
WBR, Vladimir Lomov

-- 
A father doesn't destroy his children.
		-- Lt. Carolyn Palamas, "Who Mourns for Adonais?",
		   stardate 3468.1.



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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-14 12:42 Weirdness with Input Method/quail : how to figure out source of it? Vladimir Lomov
@ 2013-08-15 20:59 ` Alex Kost
  2013-08-15 23:19   ` Vladimir Lomov
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Kost @ 2013-08-15 20:59 UTC (permalink / raw
  To: help-gnu-emacs; +Cc: Vladimir Lomov

Vladimir Lomov <lomov.vl@gmail.com> writes:

> My setup:
> - two languages: English and Russian;
> - standard QWERTY keyboard, *but* DVORAK layout for both terminal and X;
> - standard Russian layout (ЙЦУКЕН).

> * Problem 0
>
> If layout were QWERTY and one uses 'russian-computer' Input Method then letters on keys and
> typed symbols, both English and Russian, are coincide. For instance, some part of QWERTY
> keyboard:

> Page on EmacsWiki:
> http://www.emacswiki.org/emacs/WritingRussianWithDvorak
>
> My variant of quail 'dvorak' layout:
> https://raw.github.com/vp1981/scripts/master/emacs.d/misc/quail-dvorak.el

Hello,

I use the same layout combination: English Dvorak and Russian ЙЦУКЕН.
Dvorak layout is set in X and is never switched when i'm in Emacs.
Russian layout is turned on internally in Emacs with `set-input-method'.
As you pointed "russian-computer" is working when global layout is
QWERTY, happily there is "cyrillic-dvorak" for our Dvorak case:
<http://www.emacswiki.org/emacs/download/cyrillic-dvorak.el>.

It is described in the EmacsWiki article you mentioned and this variant
works perfectly for me, i didn't even try the other one, which you used
for your "quail-dvorak.el".

So I have (load "/path/to/cyrillic-dvorak.el") in my init.el; and i
switch layouts with:
  (set-input-method "cyrillic-dvorak")
  (set-input-method nil).

I hope it helps.

As for you Problem 1, i have never met such behaviour.



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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-15 20:59 ` Alex Kost
@ 2013-08-15 23:19   ` Vladimir Lomov
  2013-08-16  6:32     ` Alex Kost
  0 siblings, 1 reply; 11+ messages in thread
From: Vladimir Lomov @ 2013-08-15 23:19 UTC (permalink / raw
  To: Alex Kost; +Cc: help-gnu-emacs

** Alex Kost [2013-08-16 00:59:42 +0400]:

> Vladimir Lomov <lomov.vl@gmail.com> writes:

>> My setup:
>> - two languages: English and Russian;
>> - standard QWERTY keyboard, *but* DVORAK layout for both terminal and X;
>> - standard Russian layout (ЙЦУКЕН).

>> * Problem 0

>> If layout were QWERTY and one uses 'russian-computer' Input Method then letters on keys and
>> typed symbols, both English and Russian, are coincide. For instance, some part of QWERTY
>> keyboard:

>> Page on EmacsWiki:
>> http://www.emacswiki.org/emacs/WritingRussianWithDvorak

>> My variant of quail 'dvorak' layout:
>> https://raw.github.com/vp1981/scripts/master/emacs.d/misc/quail-dvorak.el

> Hello,

> I use the same layout combination: English Dvorak and Russian ЙЦУКЕН.
> Dvorak layout is set in X and is never switched when i'm in Emacs.
> Russian layout is turned on internally in Emacs with `set-input-method'.
> As you pointed "russian-computer" is working when global layout is
> QWERTY, happily there is "cyrillic-dvorak" for our Dvorak case:
> <http://www.emacswiki.org/emacs/download/cyrillic-dvorak.el>.

> It is described in the EmacsWiki article you mentioned and this variant
> works perfectly for me, i didn't even try the other one, which you used
> for your "quail-dvorak.el".

> So I have (load "/path/to/cyrillic-dvorak.el") in my init.el; and i
> switch layouts with:
>   (set-input-method "cyrillic-dvorak")
>   (set-input-method nil).

> I hope it helps.

Thanks for confirmation that this way works too. Actually I used that
method earlier but faced with the same Problem 1, so I tried another
approach (IMHO, they are very simiral, both use quail techniques) and as
you see without luck.

> As for you Problem 1, i have never met such behaviour.

I have to admit I don't know what _exactly_ cause this behaviour, and
this drives me crazy, because I don't know how to reliably reproduce it
(sometimes I think it could be related with my settings, or that I use
Emacs compiled from bzr trunk...).

Does anyone know if there is a tool to automatically and interactively
type text in a window (frame in Emacs terminology) with specified speed?
I only tried xdotool but it 'type' very quickly (I already have idea to
use xdotool and sleep to control 'type' speed).

---
WBR, Vladimir Lomov

-- 
Experience is a good teacher, but she sends in terrific bills.
		-- Minna Antrim, "Naked Truth and Veiled Allusions"



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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-15 23:19   ` Vladimir Lomov
@ 2013-08-16  6:32     ` Alex Kost
  2013-08-16  7:31       ` Vladimir Lomov
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Kost @ 2013-08-16  6:32 UTC (permalink / raw
  To: help-gnu-emacs; +Cc: Vladimir Lomov

Vladimir Lomov <lomov.vl@gmail.com> writes:

> Does anyone know if there is a tool to automatically and interactively
> type text in a window (frame in Emacs terminology) with specified speed?
> I only tried xdotool but it 'type' very quickly (I already have idea to
> use xdotool and sleep to control 'type' speed).

As far as I understand, xdotool just sends KeyPress/KeyRelease with
XSendEvent, and sleeping is the only reasonable way to slow down (i
don't think there are such specific utilities).  But why do you want to
do it?  I didn't get whether it's correlated with your Problem 1 (some
kind of workaround maybe).



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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-16  6:32     ` Alex Kost
@ 2013-08-16  7:31       ` Vladimir Lomov
  2013-08-16  9:45         ` ISHIKAWA,chiaki
  2013-08-16 11:37         ` Alex Kost
  0 siblings, 2 replies; 11+ messages in thread
From: Vladimir Lomov @ 2013-08-16  7:31 UTC (permalink / raw
  To: Alex Kost; +Cc: help-gnu-emacs

Hello,
** Alex Kost [2013-08-16 10:32:07 +0400]:

> Vladimir Lomov <lomov.vl@gmail.com> writes:

>> Does anyone know if there is a tool to automatically and interactively
>> type text in a window (frame in Emacs terminology) with specified speed?
>> I only tried xdotool but it 'type' very quickly (I already have idea to
>> use xdotool and sleep to control 'type' speed).

> As far as I understand, xdotool just sends KeyPress/KeyRelease with
> XSendEvent, and sleeping is the only reasonable way to slow down (i
> don't think there are such specific utilities).  But why do you want to
> do it?  I didn't get whether it's correlated with your Problem 1 (some
> kind of workaround maybe).

As I emphasized in first message the Problem 1 comes occasionally: I
could run fresh Emacs session without problem, but after some time I see
all these weird transformations (I had to say earlier that I run Emacs
daemon and use emacsclient to open a frame but I use such approach about
a month, the Problem is older and shows itself even when I run simple
'emacs').

I decided to do following: write a test script that would send to
Emacs frame a text and see what buffer has, i.e. (is there any problems with
it. Run this script several times (with different "type" speed) to find
out when the Problem always shows. Further steps depends on result of
this test.

This is very tiresome so I thought there should be some way to "see"
what happens in Emacs internals to figure out why punctuation symbols
are so "special".

---
WBR, Vladimir Lomov

-- 
Saint:  A dead sinner revised and edited.
-- Ambrose Bierce



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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-16  7:31       ` Vladimir Lomov
@ 2013-08-16  9:45         ` ISHIKAWA,chiaki
  2013-08-19  9:03           ` Vladimir Lomov
  2013-08-16 11:37         ` Alex Kost
  1 sibling, 1 reply; 11+ messages in thread
From: ISHIKAWA,chiaki @ 2013-08-16  9:45 UTC (permalink / raw
  To: Vladimir Lomov; +Cc: Alex Kost, help-gnu-emacs

Hello,

Just to be sure that everyone understands the background of the issue:

Are you running emacs under which OS?
  Linux (which distribution)?
  FreeBSD ?
  Solaris ?

Also, is it natively run on hardware, or is it run inside
virtual environment such as
  - VirtualBox
  - VMPlayer
  - other,

on which host OS if this is the case
etc.?

I had a strange key repeat problem running linux (Debian) inside VirtualBox
running on Windows XP host a couple of years ago, and ever since I have a
a line to control key repeat in my x startup file in the linux image
in that computer.
And yes, the problem was intermittent.
But this problem was noticed on every program in the linux image, not only by Emacs,
but by shell and others. So this may not be quite the cause in your case.


Chiaki


(2013/08/16 16:31), Vladimir Lomov wrote:
> Hello,
> ** Alex Kost [2013-08-16 10:32:07 +0400]:
>
>> Vladimir Lomov <lomov.vl@gmail.com> writes:
>
>>> Does anyone know if there is a tool to automatically and interactively
>>> type text in a window (frame in Emacs terminology) with specified speed?
>>> I only tried xdotool but it 'type' very quickly (I already have idea to
>>> use xdotool and sleep to control 'type' speed).
>
>> As far as I understand, xdotool just sends KeyPress/KeyRelease with
>> XSendEvent, and sleeping is the only reasonable way to slow down (i
>> don't think there are such specific utilities).  But why do you want to
>> do it?  I didn't get whether it's correlated with your Problem 1 (some
>> kind of workaround maybe).
>
> As I emphasized in first message the Problem 1 comes occasionally: I
> could run fresh Emacs session without problem, but after some time I see
> all these weird transformations (I had to say earlier that I run Emacs
> daemon and use emacsclient to open a frame but I use such approach about
> a month, the Problem is older and shows itself even when I run simple
> 'emacs').
>
> I decided to do following: write a test script that would send to
> Emacs frame a text and see what buffer has, i.e. (is there any problems with
> it. Run this script several times (with different "type" speed) to find
> out when the Problem always shows. Further steps depends on result of
> this test.
>
> This is very tiresome so I thought there should be some way to "see"
> what happens in Emacs internals to figure out why punctuation symbols
> are so "special".
>
> ---
> WBR, Vladimir Lomov
>






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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-16  7:31       ` Vladimir Lomov
  2013-08-16  9:45         ` ISHIKAWA,chiaki
@ 2013-08-16 11:37         ` Alex Kost
  2013-08-19  8:58           ` Vladimir Lomov
  2013-08-20  8:33           ` Vladimir Lomov
  1 sibling, 2 replies; 11+ messages in thread
From: Alex Kost @ 2013-08-16 11:37 UTC (permalink / raw
  To: Vladimir Lomov; +Cc: help-gnu-emacs

Vladimir Lomov <lomov.vl@gmail.com> writes:

> To get correct output for Russian I decided to define new keyboard layout ('dvorak-classic') for
> quail (this is not my discovery I found it on emacswiki.org).

> But this solution rises another weird problem. Looking ahead I must say that I notice this
> problem about 4-6 months ago while I use this setup (dvorak layout) for more than a year.

I've tried your variant with (quail-set-keyboard-layout "dvorak"), and it
works for me without a sign of your strange Problem.

> Why I call it "weird" problem: because it comes not always, it is very sporadic. It doesn't
> depend if I run Emacs with my settings or without any (emacs -Q), in terminal (tty) or in
> graphical environment (X).

Sorry for uninformative reply, but i don't know how to help you here.
Perhaps, it would be better to do "M-x report-emacs-bug".



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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-16 11:37         ` Alex Kost
@ 2013-08-19  8:58           ` Vladimir Lomov
  2013-08-20  8:33           ` Vladimir Lomov
  1 sibling, 0 replies; 11+ messages in thread
From: Vladimir Lomov @ 2013-08-19  8:58 UTC (permalink / raw
  To: Alex Kost; +Cc: Vladimir Lomov, help-gnu-emacs

Hello,
** Alex Kost [2013-08-16 15:37:41 +0400]:

> Vladimir Lomov <lomov.vl@gmail.com> writes:

>> To get correct output for Russian I decided to define new keyboard layout ('dvorak-classic') for
>> quail (this is not my discovery I found it on emacswiki.org).

>> But this solution rises another weird problem. Looking ahead I must say that I notice this
>> problem about 4-6 months ago while I use this setup (dvorak layout) for more than a year.

> I've tried your variant with (quail-set-keyboard-layout "dvorak"), and it
> works for me without a sign of your strange Problem.

Thanks for that invaluable information, I think you use some of stable
releases, I run Emacs compiled from a bzr trunk. I'll try to play with
stable release then.

>> Why I call it "weird" problem: because it comes not always, it is very sporadic. It doesn't
>> depend if I run Emacs with my settings or without any (emacs -Q), in terminal (tty) or in
>> graphical environment (X).

> Sorry for uninformative reply, but i don't know how to help you here.
> Perhaps, it would be better to do "M-x report-emacs-bug".

If I only knew what to report (Do I have reproducible example? No, I
don't have).

---
WBR, Vladimir Lomov

-- 
... I want a COLOR T.V. and a VIBRATING BED!!!



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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-16  9:45         ` ISHIKAWA,chiaki
@ 2013-08-19  9:03           ` Vladimir Lomov
  0 siblings, 0 replies; 11+ messages in thread
From: Vladimir Lomov @ 2013-08-19  9:03 UTC (permalink / raw
  To: ISHIKAWA,chiaki; +Cc: Alex Kost, help-gnu-emacs

Hello,
** ISHIKAWA,chiaki [2013-08-16 18:45:53 +0900]:

> Hello,

> Just to be sure that everyone understands the background of the issue:

> Are you running emacs under which OS?
>  Linux (which distribution)?
>  FreeBSD ?
>  Solaris ?

Archlinux x86_64

> Also, is it natively run on hardware, or is it run inside
> virtual environment such as
>  - VirtualBox
>  - VMPlayer
>  - other,

Natively, on several computers with different processors (AMD and
Intel), all x86_64, all running Archlinux.

> on which host OS if this is the case
> etc.?

> I had a strange key repeat problem running linux (Debian) inside VirtualBox
> running on Windows XP host a couple of years ago, and ever since I have a
> a line to control key repeat in my x startup file in the linux image
> in that computer.
> And yes, the problem was intermittent.
> But this problem was noticed on every program in the linux image, not only by Emacs,
> but by shell and others. So this may not be quite the cause in your case.

Thanks for information (I thought I could run other Linux distribution
in virtual machine and try to run one of stable release of Emacs).


> Chiaki

---
WBR, Vladimir Lomov

-- 
Q:	What do little WASPs want to be when they grow up?
A:	The very best person they can possibly be.



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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-16 11:37         ` Alex Kost
  2013-08-19  8:58           ` Vladimir Lomov
@ 2013-08-20  8:33           ` Vladimir Lomov
  2013-08-22 14:58             ` Alex Kost
  1 sibling, 1 reply; 11+ messages in thread
From: Vladimir Lomov @ 2013-08-20  8:33 UTC (permalink / raw
  To: Alex Kost; +Cc: help-gnu-emacs

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

Hello,
** Alex Kost [2013-08-16 15:37:41 +0400]:

> Vladimir Lomov <lomov.vl@gmail.com> writes:

>> To get correct output for Russian I decided to define new keyboard layout ('dvorak-classic') for
>> quail (this is not my discovery I found it on emacswiki.org).

>> But this solution rises another weird problem. Looking ahead I must say that I notice this
>> problem about 4-6 months ago while I use this setup (dvorak layout) for more than a year.

> I've tried your variant with (quail-set-keyboard-layout "dvorak"), and it
> works for me without a sign of your strange Problem.

>> Why I call it "weird" problem: because it comes not always, it is very sporadic. It doesn't
>> depend if I run Emacs with my settings or without any (emacs -Q), in terminal (tty) or in
>> graphical environment (X).

> Sorry for uninformative reply, but i don't know how to help you here.
> Perhaps, it would be better to do "M-x report-emacs-bug".

Seems now I able to reproduce that behaviour with simple script.

Would you mind to run this script (see attachment)? It's the only
requirement is xdotool tool, you don't even have to switch to dvorak
layout; moreover, qwerty layout is required to run script without
intervention.

What this script do:
1. run emacs without any settings but loading 'quail-dvorak.el' file
   (attached as well) and switching _on_ flyspell mode;
2. open a text file to type;
3. use a sample text file (xmpl.txt, attached) to type in opened buffer;
4. after first round of type, switch _off_ flyspell mode and type the
   same sample file again.

To run script just open a terminal emulator and run
   ./test-emacs-flyspell-mode.sh xmpl.txt
in directory with script and sample file.

If it would give wrong behaviour for you then I send a bug report.

---
WBR, Vladimir Lomov


-- 
The best executive is one who has sense enough to pick good people to do
what he wants done, and self-restraint enough to keep from meddling with
them while they do it.
		-- Theodore Roosevelt

[-- Attachment #2: test-emacs-flyspell-mode.sh --]
[-- Type: application/x-sh, Size: 1156 bytes --]

[-- Attachment #3: xmpl.txt --]
[-- Type: text/plain, Size: 121 bytes --]

Ejyk xleyjbfo ,eybu dun.gx^ pdujfo'Z hdufsyeo'Z s`tbo'Z lyt`fo'Z ght.wh' x
axhtybheo'z

Fucy nyth iduehy --- Ko ihwynxk!

[-- Attachment #4: quail-dvorak.el --]
[-- Type: text/plain, Size: 807 bytes --]

;; [[file:~/works/scripts/docs/emacs/emacs.org::*%D0%A0%D0%B0%D1%81%D0%BA%D0%BB%D0%B0%D0%B4%D0%BA%D0%B0%20dvorak%20%D0%B4%D0%BB%D1%8F%20Emacs][quail-dvorak]]
(eval-after-load 'quail
  '(progn
     (add-to-list 'quail-keyboard-layout-alist
       '("dvorak-classic" . "\
                              \
  `#%&7[5{3}1)9]0*2)4+6]8!    \
  ;:,<.>pPyYfFgGcCrRlL/?@^    \
  aAoOeEuUiIdDhHtTnNsS-_\\|    \
  '\"qQjJkKxXbBmMwWvVzZ        \
                              "))
     (add-to-list 'quail-keyboard-layout-alist
       '("dvorak" . "\
                              \
  1!2@3#4$5%6^7&8*9(0)[{]}`~  \
  '\",<.>pPyYfFgGcCrRlL/?=+\\|  \
  aAoOeEuUiIdDhHtTnNsS-_      \
  ;:qQjJkKxXbBmMwWvVzZ        \
                              "))
     (quail-set-keyboard-layout "dvorak")
   )
)
;; quail-dvorak ends here

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

* Re: Weirdness with Input Method/quail : how to figure out source of it?
  2013-08-20  8:33           ` Vladimir Lomov
@ 2013-08-22 14:58             ` Alex Kost
  0 siblings, 0 replies; 11+ messages in thread
From: Alex Kost @ 2013-08-22 14:58 UTC (permalink / raw
  To: Vladimir Lomov; +Cc: help-gnu-emacs

Vladimir Lomov (2013-08-20 12:33 +0400):

> Seems now I able to reproduce that behaviour with simple script.
>
> Would you mind to run this script (see attachment)? It's the only
> requirement is xdotool tool, you don't even have to switch to dvorak
> layout; moreover, qwerty layout is required to run script without
> intervention.

Hello and sorry for the long wait.

Actually dvorak is my default layout, so i don't need to switch to it, i
have to switch to qwerty one. (It's just a note)

At first i should say that i was faced with strange and unpredictable
results of xdotool (see below).

> What this script do:
> 1. run emacs without any settings but loading 'quail-dvorak.el' file
>    (attached as well) and switching _on_ flyspell mode;
> 2. open a text file to type;
> 3. use a sample text file (xmpl.txt, attached) to type in opened buffer;
> 4. after first round of type, switch _off_ flyspell mode and type the
>    same sample file again.
>
> To run script just open a terminal emulator and run
>    ./test-emacs-flyspell-mode.sh xmpl.txt
> in directory with script and sample file.
>
> If it would give wrong behaviour for you then I send a bug report.

Your script didn't work for me because toggle-input-method prompts for a
method when it is evaluated for the first time (i use GNU Emacs 24.3.1
by the way), so i modified emacs command:

emacs -Q -l 'quail-dvorak.el' --name EmacsDebug sample.txt --eval '(setq default-input-method "russian-computer")' --eval '(toggle-input-method)' --eval '(flyspell-mode)' &

After that i tested this script 3 times with different "sets of layouts":

1. My default configuration.
   To have dvorak layout as default in X i have a file
   </etc/X11/xorg.conf.d/11-keyboard-layout.conf> with this contents:

Section "InputClass"
        Identifier             "keyboard-layout"
        MatchIsKeyboard        "true"
        Option "XkbLayout"     "dvorak,ru,us"
        Option "XkbOptions"    "grp:ctrl_shift_toggle"
EndSection

   When i run the script, i got:

Всем известны цвета радуги: красный. оранжевый. жёлтый. зелёный. голубой и
фиолетовый.

Наше дело правое --- мы победим!

   (There are dots after the names of colors, not commas.)

   After "M-x" i got "flyspell[mode" instead of "flyspell-mode" printed,
   so this mode wasn't turned off, and the second part of loop printed
   text in minibuffer (as there is no match for "flyspell[mode"). As "-"
   in qwerty is placed where "[" is placed in dvorak, i tried this
   command in the script:
      xdotool type --window ${app_id} "flyspell'mode"
   but "flyspell'mode" stays unmodified.

2. I changed "XkbLayout" to "us,dvorak", restarted X and got these
   results:

Вслм иквлстеы бвлта разваи: щрасеыч, ораежлвыч, жёлтыч, кллёеыч, аолвбоч и
фиоллтовыч.

Еапл злло правол эээ Мы поблзим!

   Flyspell-mode wasn't turned off again. This time i got
   "yptsrepp-mode" in minibuffer.

3. At last i just left "us" (i didn't modify config file this time,
   but used "setxkbmap us" instead).

Всем известны цвета радуги: красный, оранжевый, жёлтый, зелёный, голубой и
фиолетовый.

Наше дело правое эээ Мы победим!

   "эээ" is not good of course, but that was the only configuration
   where xdotool produced english letters that were expected.


I tested russian letters *manually* in every configuration with and
without flyspell-mode but i always got correct results. So i can't say
that i met your problem. It's more likely i faced the bug of xdotool or
some X internals. Whenever i tested "xdotool type <text>" it printed weird
combinations of qwerty and dvorak parts of words in any window, not only
emacs (i also tested it with xterm and conkeror).

Some examples of 'xdotool'-ed text (in any window):
| command                               | result                 |
|---------------------------------------+------------------------|
| xdotool type some-text                | some-text              |
| xdotool type flyspell-mode            | yptsrepp-mode          |
| xdotool type communication            | iommuliiatiol          |
| xdotool type "very strange behaviour" | vert stralue behaviour |
These results are the same for "us,dvorak" and "dvorak,us"; as i said
when just "us" layout is used xdotool doesn't distort english words.

Vladimir Lomov (2013-08-14 16:42 +0400):

> Why I call it "weird" problem: because it comes not always, it is very sporadic. It doesn't
> depend if I run Emacs with my settings or without any (emacs -Q), in terminal (tty) or in
> graphical environment (X). (The only difference I noticed when I checked Emacs running with my
> settings and without any is that with my settings problem comes more quickly.) The other
> dependency I noticed: when I type text quickly or if system is slow (one of my computer is
> relatively old notebook) then effect comes earlier.

As it happens in tty as well, i think strangeness i faced is not the
same as yours.

P.S. There is a recent similar bug-report:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15151



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

end of thread, other threads:[~2013-08-22 14:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14 12:42 Weirdness with Input Method/quail : how to figure out source of it? Vladimir Lomov
2013-08-15 20:59 ` Alex Kost
2013-08-15 23:19   ` Vladimir Lomov
2013-08-16  6:32     ` Alex Kost
2013-08-16  7:31       ` Vladimir Lomov
2013-08-16  9:45         ` ISHIKAWA,chiaki
2013-08-19  9:03           ` Vladimir Lomov
2013-08-16 11:37         ` Alex Kost
2013-08-19  8:58           ` Vladimir Lomov
2013-08-20  8:33           ` Vladimir Lomov
2013-08-22 14:58             ` Alex Kost

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.