[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to simulate keyboard input in self-defined function?

From: Rupert Swarbrick
Subject: Re: How to simulate keyboard input in self-defined function?
Date: Sat, 23 Aug 2008 10:48:33 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

"xiaopeng hu" <address@hidden> writes:

So, grumpy stuff first. There's a real reply below.

- Please reply to posts in newsgroups to the groups themselves: there's
  no particular reason this had to go as a private email.
- Please don't top-post.

"xiaopeng hu" <address@hidden> writes:
> I want emacs more intelligent in latex file.
> Every strike input real charater.
> Don't space many keystrike to toggle input method
> Thanks

I'm sorry, but I don't actually understand what you mean here - could
you be more specific?

> 2008/8/23 xiaopeng hu <address@hidden>
>     Thanks for your warm heart!  I want to simulate keystrike "t" +
>     <space> (not simultaneously).  If what I get is not "t ", I know
>     my input method is not english.  Then I will simulate "Ctrl" once
>     to toggle input method between english and chinese.
>     Why I do this is that I want to define a function, which
>     automatically switch my input method to english when I in math
>     mode such as $...$, \[ ...\](in latex file), switch to chinese
>     when I out of math mode.
>     In my computer , I do use another efficient input method ,whic use
>     only "Ctrol" to switch between chinese and english.
>     Input method builded in emacs is poor. 
>     I just don't know how to implement the function, using defined
>     function or hook?
>     Thanks

I now see what you mean about simulating key strokes. I think this is
very dependent on what other software you're using. Is this windows? And
what is the software that's catching single CTRL keypresses and
switching modes?

You see, although I don't know this for sure, I suspect that when you're
in "English Mode", if you hit "t" then " " on the keyboard, "t" then " "
are sent to Emacs. Fine. But if this external software is in another
mode (where it presumably does some clever stuff like composing
characters), the Emacs process won't ever see the "t" and the " " and
instead will see what it gets translated to.

Moreover, I suspect you won't actually have a way to change this input
method from emacs either - how do you propose to send a message to the
external program?

Now, I see two obvious ways forward from here, but bear in mind I don't
use multiple input methods except occaisionally switching to German, so
this might not be that useful:

1) Live with it. No, really, it doesn't seem like an easy problem to
   solve, the way you've got things set up.

2) Try out the inbuilt emacs input methods. I understand you believe
   them to be "poor", but can you explain exactly what's wrong? After
   all, if there is something really wrong and you haven't got them
   mis-configured I'm sure someone will want to fix them.
   If you do use inbuilt emacs modes, then you'll have access to elisp
   like (toggle-input-method) to switch between modes etc. and what you
   want with the $$ characters seems quite achievable.

Hope this is of some help,


Attachment: pgpzRKMBGqe9I.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]